using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MiniMapLibrary; using MiniMapLibrary.Config; using MiniMapLibrary.Helpers; using MiniMapLibrary.Scanner; using MiniMapMod.Adapters; using RoR2; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; [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("MiniMapMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+05279d035f5da8ed464cf1a60b821886fd98ec5a")] [assembly: AssemblyProduct("MiniMapMod")] [assembly: AssemblyTitle("MiniMapMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MiniMapLibrary { public class Minimap { private readonly ILogger Logger; private RectTransform ContainerTransform; public static GameObject gameObject { get; private set; } public static GameObject Container { get; private set; } public bool Created { get; private set; } public Minimap(ILogger logger) { Logger = logger; } public void CreateMinimap(ISpriteManager spriteManager, GameObject Parent) { if (!Created) { Created = true; gameObject = CreateMask(); SetParent(gameObject, Parent); gameObject.transform.SetAsFirstSibling(); CreateIconContainer(); CreatePlayerIcon(spriteManager); } } public void Destroy() { if (Created) { Logger.LogDebug((object)"Destroying minimap gameobject"); Object.Destroy((Object)(object)gameObject); gameObject = null; Container = null; ContainerTransform = null; Created = false; } } public void DestroyIcons() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in Container.transform) { Object.Destroy((Object)(object)((Component)item).gameObject); } } public void SetRotation(Quaternion rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; ((Transform)ContainerTransform).localRotation = Quaternion.Euler(0f, 0f, eulerAngles.y); } public RectTransform CreateIcon(InteractableKind type, Vector3 minimapPosition, ISpriteManager spriteManager) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0016: 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_0049: Unknown result type (might be due to invalid IL or missing references) Sprite sprite; try { sprite = spriteManager.GetSprite(type); } catch (MissingComponentException ex) { MissingComponentException ex2 = ex; Logger.LogError((object)$"Failed to get sprite for type {type}"); Logger.LogError((object)((Exception)(object)ex2).Message); return null; } RectTransform component = CreateIcon(type, sprite).GetComponent(); ((Transform)component).localPosition = minimapPosition; Transforms.SetParent((Transform)(object)component, (Transform)(object)ContainerTransform); return component; } private void CreateIconContainer() { GameObject val = Create(delegate(GameObject obj) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) ((Object)obj).name = "icon_container"; ContainerTransform = obj.AddComponent(); ContainerTransform.sizeDelta = new Vector2(Settings.MinimapSize.Width, Settings.MinimapSize.Height); }); SetParent(val, gameObject); Container = val; } private void CreatePlayerIcon(ISpriteManager spriteManager) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateIcon((InteractableKind)32768, spriteManager.GetSprite((InteractableKind)32768)); ((Graphic)val.GetComponent()).color = Settings.PlayerIconColor; SetParent(val, gameObject); } private unsafe GameObject CreateIcon(InteractableKind type, Sprite iconTexture) { //IL_0000: 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) InteractibleSetting setting = Settings.GetSetting(type); GameObject obj = Sprites.CreateIcon(iconTexture, setting.Dimensions.Width, setting.Dimensions.Height, setting.ActiveColor); ((Object)obj).name = ((object)(*(InteractableKind*)(&type))/*cast due to .constrained prefix*/).ToString(); return obj; } private GameObject CreateMask() { return Create(delegate(GameObject mask) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((Object)mask).name = "Minimap"; mask.AddComponent().sizeDelta = new Vector2(Settings.ViewfinderSize.Width, Settings.ViewfinderSize.Height); mask.AddComponent(); mask.AddComponent(); mask.AddComponent().showMaskGraphic = false; LayoutElement obj = mask.AddComponent(); obj.minHeight = Settings.MinimapSize.Height; obj.flexibleHeight = 0f; }); } private GameObject SetParent(GameObject child, GameObject parent) { Transforms.SetParent(child.transform, parent.transform); return child; } private GameObject Create(Action Expression) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown GameObject val = new GameObject(); Expression(val); return val; } } } namespace MiniMapMod { public class Log : ILogger { private readonly ManualLogSource _logSource; public Log(ManualLogSource logSource) { _logSource = logSource; } public void LogDebug(object data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)Settings.LogLevel > 1) { _logSource.LogDebug(data); } } public void LogError(object data) { _logSource.LogError(data); } public void LogFatal(object data) { _logSource.LogFatal(data); } public void LogInfo(object data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)Settings.LogLevel > 0) { _logSource.LogDebug(data); } } public void LogMessage(object data) { _logSource.LogMessage(data); } public void LogWarning(object data) { _logSource.LogWarning(data); } public void LogException(Exception head, string message = "") { LogError(message); while (head != null) { LogError("\t" + head.Message); LogError("\t" + head.StackTrace); if (head.InnerException != null) { head = head.InnerException; } } } } public static class MinimapExtensions { public static Vector2 ToMinimapPosition(this Vector3 position, Range3D dimensions) { //IL_0000: 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_0058: Unknown result type (might be due to invalid IL or missing references) float x = position.x; float z = position.z; float num = x + dimensions.X.Offset; z += dimensions.Z.Offset; float num2 = num / dimensions.X.Difference; z /= dimensions.Z.Difference; return new Vector2(num2 * Settings.MinimapSize.Width, z * Settings.MinimapSize.Height); } public static T? Check(this T value, Func expression) where T : class { if (!((!(expression?.Invoke(value))) ?? true) || 1 == 0) { return value; } return null; } } [BepInPlugin("MiniMap", "Mini Map Mod", "4.0.0")] public class MiniMapPlugin : BaseUnityPlugin { private ISpriteManager SpriteManager; private readonly List TrackedObjects = new List(); private Minimap Minimap; private readonly Range3D TrackedDimensions = new Range3D(); private bool Enable = true; private bool ScannedStaticObjects; private IConfig config; private ILogger logger; private ITrackedObjectScanner[] staticScanners; private ITrackedObjectScanner[] dynamicScanners; private readonly Timer dynamicScanTimer = new Timer(5f, true); private readonly Timer cooldownTimer = new Timer(2f, false) { Value = -1f }; private CameraRigController cameraRig; public void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown logger = (ILogger)(object)new Log(((BaseUnityPlugin)this).Logger); SpriteManager = (ISpriteManager)new SpriteManager(logger); Minimap = new Minimap(logger); config = (IConfig)(object)new ConfigAdapter(((BaseUnityPlugin)this).Config); Settings.LoadApplicationSettings(logger, config); InteractableKind[] array = (from InteractableKind x in Enum.GetValues(typeof(InteractableKind)) where (int)x != 0 && (int)x != int.MaxValue select x).ToArray(); for (int num = 0; num < array.Length; num++) { Settings.LoadConfigEntries(array[num], config); } logger.LogInfo((object)"Creating scene scan hooks"); CreateStaticScanners(); CreateDynamicScanners(); GlobalEventManager.onCharacterDeathGlobal += delegate { ScanScene(); }; GlobalEventManager.OnInteractionsGlobal += delegate { ScanScene(); }; dynamicScanTimer.OnFinished += delegate { ScanScene(); }; } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(Settings.MinimapKey)) { Enable = !Enable; if (!Enable) { logger.LogInfo((object)"Resetting minimap"); Reset(); return; } } cooldownTimer.Update(Time.deltaTime); dynamicScanTimer.Update(Time.deltaTime); if (!Enable) { return; } if ((Object)(object)Camera.main == (Object)null) { logger.LogDebug((object)"Main camera was null, resetting minimap"); Reset(); return; } if (Minimap.Created) { try { Minimap.SetRotation(((Component)Camera.main).transform.rotation); UpdateIconPositions(); if (Input.GetKeyDown(Settings.MinimapIncreaseScaleKey)) { Transform transform = Minimap.Container.transform; transform.localScale *= 1.1f; } else if (Input.GetKeyDown(Settings.MinimapDecreaseScaleKey)) { Transform transform2 = Minimap.Container.transform; transform2.localScale *= 0.9f; } return; } catch (NullReferenceException) { logger.LogDebug((object)"NullReferenceException was encountered while updating positions, reseting minimap"); Reset(); return; } } if (TryCreateMinimap()) { TrackedDimensions.Clear(); ScanScene(); } } private void UpdateIconPositions() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Vector2 val = GetPlayerPosition().ToMinimapPosition(TrackedDimensions); for (int i = 0; i < TrackedObjects.Count; i++) { ITrackedObject val2 = TrackedObjects[i]; if ((Object)(object)val2.gameObject == (Object)null) { TrackedObjects.RemoveAt(i); if ((Object)(object)val2.MinimapTransform != (Object)null) { Object.Destroy((Object)(object)((Component)val2.MinimapTransform).gameObject); } continue; } Vector2 val3 = val2.gameObject.transform.position.ToMinimapPosition(TrackedDimensions) - val; if ((Object)(object)val2.MinimapTransform == (Object)null) { val2.MinimapTransform = Minimap.CreateIcon(val2.InteractableType, Vector2.op_Implicit(val3), SpriteManager); } else { ((Transform)val2.MinimapTransform).localPosition = Vector2.op_Implicit(val3); ((Transform)val2.MinimapTransform).rotation = Quaternion.identity; } val2.CheckActive(); } } private bool TryCreateMinimap() { //IL_005a: 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) GameObject val = GameObject.Find("ObjectivePanel"); if ((Object)(object)val == (Object)null || SpriteManager == null) { Minimap.Destroy(); return false; } logger.LogInfo((object)"Creating Minimap object"); Minimap.CreateMinimap(SpriteManager, val.gameObject); Minimap.Container.transform.localScale = Vector3.one * Settings.MinimapScale; logger.LogInfo((object)"Finished creating Minimap"); return true; } private void Reset() { logger.LogDebug((object)"Clearing TrackedObjects"); TrackedObjects.Clear(); logger.LogDebug((object)"Clearing TrackedDimensions"); TrackedDimensions.Clear(); logger.LogDebug((object)"Destroying Minimap"); Minimap.Destroy(); dynamicScanTimer.Reset(); cooldownTimer.Reset(); ScannedStaticObjects = false; cameraRig = null; } private void ScanScene() { if (!Enable) { return; } try { if (!cooldownTimer.Started) { cooldownTimer.Start(); } else if (!cooldownTimer.Expired) { return; } cooldownTimer.Reset(); cooldownTimer.Start(); logger.LogDebug((object)"Scanning Scene"); logger.LogDebug((object)"Clearing dynamically tracked objects"); ClearDynamicTrackedObjects(); logger.LogDebug((object)"Scanning static types"); ScanStaticTypes(); logger.LogDebug((object)"Scanning dynamic types"); ScanDynamicTypes(); } catch (Exception ex) { logger.LogException(ex, "Fatal exception within minimap"); } } private ITrackedObjectScanner CreateChestScanner(Func activeChecker) { return (ITrackedObjectScanner)(object)new MultiKindScanner(false, (IScanner)(object)new MonoBehaviorScanner(logger), (IInteractibleSorter)(object)new MonoBehaviourSorter(new ISorter[2] { (ISorter)(object)new DefaultSorter((InteractableKind)1, (Func)((ChestBehavior x) => ((Component)x).gameObject), (Func)ChestSelector, activeChecker), (ISorter)(object)new DefaultSorter((InteractableKind)128, (Func)((ChestBehavior x) => ((Component)x).gameObject), (Func)LunarPodSelector, activeChecker) }), TrackedDimensions, SpriteManager, (Func)(() => GetPlayerPosition().y)); bool ChestSelector(ChestBehavior chest) { if (TryGetPurchaseToken(chest, out var out_token)) { if (out_token.Contains("CHEST") && out_token != "LUNAR_CHEST_CONTEXT") { return !out_token.Contains("STEALTH"); } return false; } return false; } bool LunarPodSelector(ChestBehavior chest) { if (TryGetPurchaseToken(chest, out var out_token)) { return out_token == "LUNAR_CHEST_CONTEXT"; } return false; } bool TryGetPurchaseToken(T value, out string out_token) where T : MonoBehaviour { object obj = value; string text = ((obj == null) ? null : ((Component)obj).GetComponent()?.contextToken); if (text == null) { logger.LogDebug((object)("No PurchaseInteraction component on " + typeof(T).Name + ". GameObject.name = " + ((Object)((Component)(object)value).gameObject).name)); } out_token = text; return text != null; } } private ITrackedObjectScanner CreateGenericInteractionScanner() { return (ITrackedObjectScanner)(object)new MultiKindScanner(false, (IScanner)(object)new MonoBehaviorScanner(logger), (IInteractibleSorter)(object)new MonoBehaviourSorter(new ISorter[2] { (ISorter)(object)new DefaultSorter((InteractableKind)131072, (Func)DefaultConverter, (Func)PortalSelector, (Func)GenericActiveChecker), (ISorter)(object)new DefaultSorter((InteractableKind)8, (Func)DefaultConverter, (Func)DefaultSelector, (Func)GenericActiveChecker) }), TrackedDimensions, SpriteManager, (Func)(() => GetPlayerPosition().y)); static GameObject DefaultConverter(T value) where T : MonoBehaviour { object obj = value; if (obj == null) { return null; } return ((Component)obj).gameObject; } static bool DefaultSelector(GenericInteraction interaction) { return true; } static bool GenericActiveChecker(GenericInteraction interaction) { if (interaction == null) { return true; } return ((Behaviour)interaction).isActiveAndEnabled; } static bool PortalSelector(GenericInteraction interaction) { return interaction?.contextToken?.Contains("PORTAL") == true; } } private ITrackedObjectScanner CreatePurchaseInteractionScanner() { return (ITrackedObjectScanner)(object)new MultiKindScanner(false, (IScanner)(object)new MonoBehaviorScanner(logger), (IInteractibleSorter)(object)new MonoBehaviourSorter(new ISorter[7] { (ISorter)(object)new DefaultSorter((InteractableKind)64, (Func)DefaultConverter, (Func)PrinterSelector, (Func)InteractionActiveChecker), (ISorter)(object)new DefaultSorter((InteractableKind)8, (Func)DefaultConverter, (Func)FanSelector, (Func)InteractionActiveChecker), (ISorter)(object)new DefaultSorter((InteractableKind)256, (Func)DefaultConverter, (Func)ShopSelector, (Func)InteractionActiveChecker), (ISorter)(object)new DefaultSorter((InteractableKind)512, (Func)DefaultConverter, (Func)EquipmentSelector, (Func)InteractionActiveChecker), (ISorter)(object)new DefaultSorter((InteractableKind)131072, (Func)DefaultConverter, (Func)GoldShoresSelector, (Func)InteractionActiveChecker), (ISorter)(object)new DefaultSorter((InteractableKind)262144, (Func)DefaultConverter, (Func)GoldShoresBeaconSelector, (Func)GoldShoresSelector), (ISorter)(object)new DefaultSorter((InteractableKind)1048576, (Func)DefaultConverter, (Func)LunarShopSelector, (Func)InteractionActiveChecker) }), TrackedDimensions, SpriteManager, (Func)(() => GetPlayerPosition().y)); static GameObject DefaultConverter(T value) where T : MonoBehaviour { object obj = value; if (obj == null) { return null; } return ((Component)obj).gameObject; } static bool EquipmentSelector(PurchaseInteraction interaction) { return interaction?.contextToken?.Contains("EQUIPMENTBARREL") == true; } static bool FanSelector(PurchaseInteraction interaction) { return interaction?.contextToken == "FAN_CONTEXT"; } static bool GoldShoresBeaconSelector(PurchaseInteraction interaction) { return interaction?.contextToken?.Contains("TOTEM") == true; } static bool GoldShoresSelector(PurchaseInteraction interaction) { return interaction?.contextToken?.Contains("GOLDSHORE") == true; } static bool InteractionActiveChecker(PurchaseInteraction interaction) { return interaction?.available ?? true; } static bool LunarShopSelector(PurchaseInteraction interaction) { //IL_001a: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (interaction == null) { return false; } return ((Component)interaction).GetComponent()?.portalType == (PortalType?)0; } static bool PrinterSelector(PurchaseInteraction interaction) { return interaction?.contextToken?.Contains("DUPLICATOR") == true; } static bool ShopSelector(PurchaseInteraction interaction) { return interaction?.contextToken?.Contains("TERMINAL") == true; } } private void CreateStaticScanners() { staticScanners = (ITrackedObjectScanner[])(object)new ITrackedObjectScanner[14] { CreateChestScanner(DefaultActiveChecker), CreatePurchaseInteractionScanner(), CreateGenericInteractionScanner(), SimpleScanner((InteractableKind)1), SimpleScanner((InteractableKind)4), SimpleScanner((InteractableKind)4), SimpleScanner((InteractableKind)4), SimpleScanner((InteractableKind)4), SimpleScanner((InteractableKind)4), SimpleScanner((InteractableKind)4), SimpleScanner((InteractableKind)2), SimpleScanner((InteractableKind)1024, (TeleporterInteraction teleporter) => (int)teleporter.activationState != 3), SimpleScanner((InteractableKind)16), SimpleScanner((InteractableKind)32, (BarrelInteraction barrel) => !barrel.Networkopened) }; static bool DefaultActiveChecker(T value) where T : MonoBehaviour { object obj = value; PurchaseInteraction val = (PurchaseInteraction)((obj is PurchaseInteraction) ? obj : null); if (val != null) { return val.available; } object obj2 = value; PurchaseInteraction val2 = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); if ((Object)(object)val2 != (Object)null) { return val2.available; } return true; } static GameObject DefaultConverter(T value) where T : MonoBehaviour { object obj = value; if (obj == null) { return null; } return ((Component)obj).gameObject; } ITrackedObjectScanner SimpleScanner(InteractableKind kind, Func activeChecker = null, Func selector = null, Func converter = null) where T : MonoBehaviour { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return (ITrackedObjectScanner)(object)new SingleKindScanner(kind, false, (IScanner)(object)new MonoBehaviorScanner(logger), TrackedDimensions, SpriteManager, (Func)(() => GetPlayerPosition().y), converter ?? new Func(DefaultConverter), activeChecker ?? new Func(DefaultActiveChecker), selector); } } private ITrackedObjectScanner CreateAliveEntityScanner() { return (ITrackedObjectScanner)(object)new MultiKindScanner(true, (IScanner)(object)new MonoBehaviorScanner(logger), (IInteractibleSorter)(object)new MonoBehaviourSorter(new ISorter[6] { (ISorter)(object)new DefaultSorter((InteractableKind)2048, (Func)DefaultConverter, (Func)EnemyMonsterSelector, (Func)((TeamComponent x) => true)), (ISorter)(object)new DefaultSorter((InteractableKind)4096, (Func)DefaultConverter, (Func)EnemyLunarSelector, (Func)((TeamComponent x) => true)), (ISorter)(object)new DefaultSorter((InteractableKind)8192, (Func)DefaultConverter, (Func)EnemyVoidSelector, (Func)((TeamComponent x) => true)), (ISorter)(object)new DefaultSorter((InteractableKind)16384, (Func)DefaultConverter, (Func)MinionSelector, (Func)((TeamComponent x) => true)), (ISorter)(object)new DefaultSorter((InteractableKind)32768, (Func)DefaultConverter, (Func)PlayerSelector, (Func)((TeamComponent x) => true)), (ISorter)(object)new DefaultSorter((InteractableKind)524288, (Func)DefaultConverter, (Func)NeutralSelector, (Func)((TeamComponent x) => x == null || ((Component)x).gameObject.activeSelf)) }), TrackedDimensions, SpriteManager, (Func)(() => GetPlayerPosition().y)); static GameObject DefaultConverter(T value) where T : MonoBehaviour { object obj = value; if (obj == null) { return null; } return ((Component)obj).gameObject; } static bool EnemyLunarSelector(TeamComponent team) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if (team == null) { return false; } return (int)team.teamIndex == 3; } static bool EnemyMonsterSelector(TeamComponent team) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if (team == null) { return false; } return (int)team.teamIndex == 2; } static bool EnemyVoidSelector(TeamComponent team) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if (team == null) { return false; } return (int)team.teamIndex == 4; } static bool MinionSelector(TeamComponent team) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 bool flag = team != null && (int)team.teamIndex == 1; bool? obj; if (team == null) { obj = null; } else { CharacterBody component = ((Component)team).GetComponent(); obj = ((component != null) ? new bool?(component.isPlayerControlled) : ((bool?)null)); } bool? flag2 = obj; if (!flag2.HasValue) { return flag; } if (flag) { return flag2 == false; } return false; } static bool NeutralSelector(TeamComponent team) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if (team == null) { return false; } return (int)team.teamIndex == 0; } static bool PlayerSelector(TeamComponent team) { bool? obj; if (team == null) { obj = null; } else { NetworkStateMachine component = ((Component)team).GetComponent(); obj = ((component != null) ? new bool?(((NetworkBehaviour)component).hasAuthority) : ((bool?)null)); } bool? flag = obj; bool? obj2; if (team == null) { obj2 = null; } else { CharacterBody component2 = ((Component)team).GetComponent(); obj2 = ((component2 != null) ? new bool?(component2.isPlayerControlled) : ((bool?)null)); } bool? flag2 = obj2; if (!flag.HasValue || !flag2.HasValue) { return false; } if (flag == false) { return flag2 == true; } return false; } } private Vector3 GetPlayerPosition() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cameraRig == (Object)null) { cameraRig = ((Component)((Component)Camera.main).transform.parent).GetComponent(); if ((Object)(object)cameraRig == (Object)null) { logger.LogError((object)"Failed to retrieve camera rig in scene to retrieve camera position"); } } GameObject target = cameraRig.target; Vector3? obj; if (target == null) { obj = null; } else { Transform transform = target.transform; obj = ((transform != null) ? new Vector3?(transform.position) : ((Vector3?)null)); } return (Vector3)(((??)obj) ?? ((Component)Camera.main).transform.position); } private void CreateDynamicScanners() { dynamicScanners = (ITrackedObjectScanner[])(object)new ITrackedObjectScanner[3] { CreateAliveEntityScanner(), (ITrackedObjectScanner)new SingleKindScanner((InteractableKind)65536, true, (IScanner)(object)new MonoBehaviorScanner(logger), TrackedDimensions, SpriteManager, (Func)(() => GetPlayerPosition().y), (Func)((GenericPickupController x) => ((Component)x).gameObject), (Func)((GenericPickupController x) => true), (Func)null), CreateGenericInteractionScanner() }; } private void ScanStaticTypes() { if (!ScannedStaticObjects) { for (int i = 0; i < staticScanners.Length; i++) { staticScanners[i].ScanScene((IList)TrackedObjects); } ScannedStaticObjects = true; } } private void ScanDynamicTypes() { for (int i = 0; i < dynamicScanners.Length; i++) { dynamicScanners[i].ScanScene((IList)TrackedObjects); } } private void ClearDynamicTrackedObjects() { if (!ScannedStaticObjects) { return; } for (int i = 0; i < TrackedObjects.Count; i++) { ITrackedObject val = TrackedObjects[i]; if (val.DynamicObject) { val.Destroy(); TrackedObjects.RemoveAt(i); } } } } } namespace MiniMapMod.Adapters { public class ConfigAdapter : IConfig { private readonly ConfigFile plugin; public ConfigAdapter(ConfigFile plugin) { this.plugin = plugin; } public IConfigEntry Bind(string section, string key, T defaultValue, string description) { return new ConfigEntryAdapter(plugin.Bind(section, key, defaultValue, description)); } } public class ConfigEntryAdapter : IConfigEntry { private readonly ConfigEntry entry; public T Value => entry.Value; public ConfigEntryAdapter(ConfigEntry entry) { this.entry = entry; } } }