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 Empress SmartMap v1.0.0
EmpressSmartMap.dll
Decompiled 3 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Client-side DirtFinder map intel for players, enemies, and valuables.")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+5f1b735e473ca4ccf3b383128fbebd889cb564da")] [assembly: AssemblyProduct("Empress SmartMap")] [assembly: AssemblyTitle("EmpressSmartMap")] [assembly: AssemblyVersion("1.0.1.0")] [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.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] [Microsoft.CodeAnalysis.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] [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; } } } namespace Empress.SmartMap { [BepInPlugin("com.empress.repo.smartmap", "Empress SmartMap", "1.0.1")] public sealed class EmpressSmartMapPlugin : BaseUnityPlugin { public const string PluginGuid = "com.empress.repo.smartmap"; public const string PluginName = "Empress SmartMap"; public const string PluginVersion = "1.0.1"; internal ConfigEntry<bool> ShowPlayers; internal ConfigEntry<bool> ShowEnemies; internal ConfigEntry<bool> ShowValuables; internal ConfigEntry<bool> ShowDifferentFloors; internal ConfigEntry<bool> HackerPulse; internal ConfigEntry<float> SameFloorAlpha; internal ConfigEntry<float> OtherFloorAlpha; internal ConfigEntry<float> RefreshRate; internal static EmpressSmartMapPlugin Instance { get; private set; } internal static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger; private void Awake() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); ShowPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Intel", "ShowPlayers", true, "Show player dots on the vanilla DirtFinder map."); ShowEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Intel", "ShowEnemies", true, "Show enemy markers on the vanilla DirtFinder map."); ShowValuables = ((BaseUnityPlugin)this).Config.Bind<bool>("Intel", "ShowValuables", true, "Show valuable markers on the vanilla DirtFinder map."); ShowDifferentFloors = ((BaseUnityPlugin)this).Config.Bind<bool>("Intel", "ShowDifferentFloors", true, "Keep markers from nearby floors visible at reduced opacity."); HackerPulse = ((BaseUnityPlugin)this).Config.Bind<bool>("Style", "HackerPulse", true, "Pulse hostile and valuable markers."); SameFloorAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Style", "SameFloorAlpha", 1f, new ConfigDescription("Marker opacity on your current floor.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 1f), Array.Empty<object>())); OtherFloorAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Style", "OtherFloorAlpha", 0.3f, new ConfigDescription("Marker opacity on other floors.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 1f), Array.Empty<object>())); RefreshRate = ((BaseUnityPlugin)this).Config.Bind<float>("Performance", "RefreshRate", 0.18f, new ConfigDescription("Seconds between scene object scans while the map is open.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 2f), Array.Empty<object>())); new Harmony("com.empress.repo.smartmap").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress SmartMap 1.0.1 loaded."); } } [HarmonyPatch(typeof(Map), "Update")] internal static class EmpressSmartMapMapUpdatePatch { private static void Postfix(Map __instance) { EmpressSmartMapRuntime.Tick(__instance); } } internal static class EmpressSmartMapRuntime { private enum MarkerKind { Player, EnemySmall, EnemyMedium, EnemyLarge, Valuable } private sealed class Marker { public Transform? Target; public GameObject? GameObject; public SpriteRenderer? SpriteRenderer; public MarkerKind Kind; public Color BaseColor; public float BaseScale; public string Label = string.Empty; } private static readonly List<PlayerAvatar> _players = new List<PlayerAvatar>(); private static readonly List<Enemy> _enemies = new List<Enemy>(); private static readonly List<ValuableObject> _valuables = new List<ValuableObject>(); private static readonly List<Marker> _markers = new List<Marker>(); private static Sprite? _circleSprite; private static Sprite? _ringSprite; private static Sprite? _squareSprite; private static Sprite? _diamondSprite; private static Transform? _currentOverlayParent; private static float _nextScan; private static bool _wasMapActive; private static readonly Color EnemyRed = new Color(1f, 0.05f, 0.08f, 1f); private static readonly Color ValuableGold = new Color(1f, 0.76f, 0.18f, 1f); private static readonly Color EmpressCyan = new Color(0f, 1f, 0.86f, 1f); private static void EnsureSprites() { if (!((Object)(object)_circleSprite != (Object)null)) { _circleSprite = MakeDiscSprite("EmpressSmartMap.Circle", 48, ringOnly: false, 0.84f); _ringSprite = MakeDiscSprite("EmpressSmartMap.Ring", 64, ringOnly: true, 0.88f); _squareSprite = MakeSquareSprite("EmpressSmartMap.Square", 48); _diamondSprite = MakeDiamondSprite("EmpressSmartMap.Diamond", 48); } } internal static void Tick(Map map) { if ((Object)(object)EmpressSmartMapPlugin.Instance == (Object)null || (Object)(object)map == (Object)null) { return; } Transform overLayerParent = GameAccess.GetOverLayerParent(map); if (!((Object)(object)overLayerParent != (Object)null) || !GameAccess.IsMapActive(map)) { if (_wasMapActive) { SetMarkersVisible(visible: false); } _wasMapActive = false; return; } _wasMapActive = true; if ((Object)(object)_currentOverlayParent != (Object)(object)overLayerParent) { ClearMarkers(); _currentOverlayParent = overLayerParent; _nextScan = 0f; } if (Time.unscaledTime >= _nextScan) { _nextScan = Time.unscaledTime + Mathf.Max(0.05f, EmpressSmartMapPlugin.Instance.RefreshRate.Value); ScanScene(); RebuildMarkers(map); } UpdateMarkers(map); } private static void ScanScene() { _players.Clear(); _enemies.Clear(); _valuables.Clear(); if (EmpressSmartMapPlugin.Instance.ShowPlayers.Value) { AddLiveObjects<PlayerAvatar>(_players, Object.FindObjectsOfType<PlayerAvatar>()); } if (EmpressSmartMapPlugin.Instance.ShowEnemies.Value) { AddLiveObjects<Enemy>(_enemies, Object.FindObjectsOfType<Enemy>()); } if (EmpressSmartMapPlugin.Instance.ShowValuables.Value) { AddLiveObjects<ValuableObject>(_valuables, Object.FindObjectsOfType<ValuableObject>()); } } private static void AddLiveObjects<T>(List<T> list, T[] found) where T : Component { foreach (T val in found) { if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy) { list.Add(val); } } } private static void RebuildMarkers(Map map) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Invalid comparison between Unknown and I4 //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) EnsureSprites(); ClearMarkers(); if (EmpressSmartMapPlugin.Instance.ShowPlayers.Value) { for (int i = 0; i < _players.Count; i++) { PlayerAvatar val = _players[i]; if (!((Object)(object)val == (Object)null) && !GameAccess.IsPlayerDisabled(val)) { CreateMarker(map, ((Component)val).transform, MarkerKind.Player, GetPlayerColor(val, i), 0.18f, SafeName(GameAccess.GetPlayerName(val))); } } } if (EmpressSmartMapPlugin.Instance.ShowEnemies.Value) { for (int j = 0; j < _enemies.Count; j++) { Enemy val2 = _enemies[j]; if (!((Object)(object)val2 == (Object)null)) { EnemyType enemyType = GameAccess.GetEnemyType(val2); MarkerKind enemyKind = GetEnemyKind(enemyType); float scale = enemyKind switch { MarkerKind.EnemyMedium => 0.22f, MarkerKind.EnemyLarge => 0.28f, _ => 0.16f, }; Transform target = GameAccess.GetEnemyCenter(val2) ?? ((Component)val2).transform; CreateMarker(map, target, enemyKind, EnemyRed, scale, ((object)(EnemyType)(ref enemyType)).ToString()); } } } if (!EmpressSmartMapPlugin.Instance.ShowValuables.Value) { return; } for (int k = 0; k < _valuables.Count; k++) { ValuableObject val3 = _valuables[k]; if (!((Object)(object)val3 == (Object)null)) { Type valuableVolumeType = GameAccess.GetValuableVolumeType(val3); float scale2 = (((int)valuableVolumeType >= 3) ? 0.2f : 0.15f); CreateMarker(map, ((Component)val3).transform, MarkerKind.Valuable, ValuableGold, scale2, ((object)(Type)(ref valuableVolumeType)).ToString()); } } } private static void CreateMarker(Map map, Transform target, MarkerKind kind, Color color, float scale, string label) { //IL_007b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) Transform overLayerParent = GameAccess.GetOverLayerParent(map); GameObject customObject = GameAccess.GetCustomObject(map); if (!((Object)(object)overLayerParent == (Object)null) && !((Object)(object)customObject == (Object)null) && !((Object)(object)target == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(customObject, overLayerParent); ((Object)val).name = "Empress SmartMap " + kind.ToString() + " " + label; SpriteRenderer componentInChildren = val.GetComponentInChildren<SpriteRenderer>(true); if ((Object)(object)componentInChildren == (Object)null) { Object.Destroy((Object)(object)val); return; } componentInChildren.sprite = SpriteForKind(kind); componentInChildren.color = color; ((Renderer)componentInChildren).sortingOrder = ((Renderer)componentInChildren).sortingOrder + 100; StripVanillaLogic(val); val.transform.localScale = Vector3.one * scale; _markers.Add(new Marker { Target = target, GameObject = val, SpriteRenderer = componentInChildren, Kind = kind, BaseColor = color, BaseScale = scale, Label = label }); } } private static void UpdateMarkers(Map map) { //IL_00ab: 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_0103: 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_013b: 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_016a: 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_018d: Unknown result type (might be due to invalid IL or missing references) float num = (EmpressSmartMapPlugin.Instance.HackerPulse.Value ? (0.92f + Mathf.Sin(Time.unscaledTime * 6f) * 0.1f) : 1f); for (int num2 = _markers.Count - 1; num2 >= 0; num2--) { Marker marker = _markers[num2]; if ((Object)(object)marker.Target == (Object)null || (Object)(object)marker.GameObject == (Object)null || (Object)(object)marker.SpriteRenderer == (Object)null) { RemoveMarkerAt(num2); } else { Transform target = marker.Target; PositionMarkerOnRealMap(map, marker.GameObject.transform, target); int playerLayer = GameAccess.GetPlayerLayer(map); bool flag = GameAccess.GetLayerForWorldY(map, target.position.y + 1f) == playerLayer; bool flag2 = GameAccess.IsMapPositionDiscovered(target.position) && (flag || EmpressSmartMapPlugin.Instance.ShowDifferentFloors.Value); marker.GameObject.SetActive(flag2); if (flag2) { Color baseColor = marker.BaseColor; baseColor.a = (flag ? EmpressSmartMapPlugin.Instance.SameFloorAlpha.Value : EmpressSmartMapPlugin.Instance.OtherFloorAlpha.Value); marker.SpriteRenderer.color = baseColor; float num3 = ((marker.Kind == MarkerKind.Player) ? 1f : num); marker.GameObject.transform.localScale = Vector3.one * marker.BaseScale * num3; marker.GameObject.transform.localRotation = RotationForKind(marker.Kind, target); } } } } private static void PositionMarkerOnRealMap(Map map, Transform marker, Transform target) { //IL_001a: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) Transform overLayerParent = GameAccess.GetOverLayerParent(map); if (!((Object)(object)overLayerParent == (Object)null)) { float scale = GameAccess.GetScale(map); marker.position = target.position * scale + overLayerParent.position; marker.localPosition = new Vector3(marker.localPosition.x, 0.02f, marker.localPosition.z); } } private static Quaternion RotationForKind(MarkerKind kind, Transform target) { //IL_0009: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) return (Quaternion)(kind switch { MarkerKind.Player => Quaternion.Euler(0f, target.eulerAngles.y, 0f), MarkerKind.Valuable => Quaternion.Euler(0f, 45f, 0f), _ => Quaternion.identity, }); } private static Sprite SpriteForKind(MarkerKind kind) { EnsureSprites(); return (Sprite)(kind switch { MarkerKind.EnemyLarge => _squareSprite, MarkerKind.EnemyMedium => _ringSprite, MarkerKind.Valuable => _diamondSprite, _ => _circleSprite, }); } private static MarkerKind GetEnemyKind(EnemyType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)type >= 3) { return MarkerKind.EnemyLarge; } if ((int)type == 2) { return MarkerKind.EnemyMedium; } return MarkerKind.EnemySmall; } private static Color GetPlayerColor(PlayerAvatar player, int index) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) try { int[] colorsEquipped = GameAccess.GetColorsEquipped(GameAccess.GetPlayerCosmetics(player)); List<SemiColor> metaColors = GameAccess.GetMetaColors(); if (colorsEquipped != null && metaColors != null) { foreach (int num in colorsEquipped) { if (num >= 0 && num < metaColors.Count && (Object)(object)metaColors[num] != (Object)null) { return GameAccess.GetSemiColor(metaColors[num]); } } } } catch { } return Color.HSVToRGB(Mathf.Repeat((float)index * 0.6180339f, 1f), 0.82f, 1f); } private static void StripVanillaLogic(GameObject markerObject) { MapCustomEntity component = markerObject.GetComponent<MapCustomEntity>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } MapValuable component2 = markerObject.GetComponent<MapValuable>(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } private static void SetMarkersVisible(bool visible) { for (int i = 0; i < _markers.Count; i++) { GameObject gameObject = _markers[i].GameObject; if ((Object)(object)gameObject != (Object)null) { gameObject.SetActive(visible); } } } private static void ClearMarkers() { for (int i = 0; i < _markers.Count; i++) { if ((Object)(object)_markers[i].GameObject != (Object)null) { Object.Destroy((Object)(object)_markers[i].GameObject); } } _markers.Clear(); } private static void RemoveMarkerAt(int index) { if ((Object)(object)_markers[index].GameObject != (Object)null) { Object.Destroy((Object)(object)_markers[index].GameObject); } _markers.RemoveAt(index); } private static string SafeName(string name) { if (!string.IsNullOrWhiteSpace(name)) { return name.Trim(); } return "PLAYER"; } private static Sprite MakeDiscSprite(string name, int size, bool ringOnly, float radiusScale) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00e1: 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_0049: 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_00a7: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); ((Object)val).name = name; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; float num = (float)(size - 1) * 0.5f; float num2 = num * radiusScale; float num3 = num2 * 0.72f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num4 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num, num)); float num5 = (ringOnly ? (Mathf.Clamp01(num2 - num4 + 1.2f) * Mathf.Clamp01(num4 - num3 + 1.2f)) : Mathf.Clamp01(num2 - num4 + 1.4f)); val.SetPixel(j, i, new Color(1f, 1f, 1f, num5)); } } val.Apply(false, true); return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size); } private static Sprite MakeSquareSprite(string name, int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_005b: 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_002a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); ((Object)val).name = name; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)0; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { val.SetPixel(j, i, Color.white); } } val.Apply(false, true); return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size); } private static Sprite MakeDiamondSprite(string name, int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00ab: 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_0077: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); ((Object)val).name = name; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; float num = (float)(size - 1) * 0.5f; float num2 = num * 0.84f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num3 = Mathf.Abs((float)j - num) + Mathf.Abs((float)i - num); float num4 = Mathf.Clamp01(num2 - num3 + 1.4f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num4)); } } val.Apply(false, true); return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size); } } internal static class GameAccess { private static readonly FieldInfo? MapInstance = AccessTools.Field(typeof(Map), "Instance"); private static readonly FieldInfo? MapActive = AccessTools.Field(typeof(Map), "Active"); private static readonly FieldInfo? MapOverLayerParent = AccessTools.Field(typeof(Map), "OverLayerParent"); private static readonly FieldInfo? MapCustomObject = AccessTools.Field(typeof(Map), "CustomObject"); private static readonly FieldInfo? MapScale = AccessTools.Field(typeof(Map), "Scale"); private static readonly FieldInfo? MapPlayerLayer = AccessTools.Field(typeof(Map), "PlayerLayer"); private static readonly MethodInfo? MapGetLayerParent = AccessTools.Method(typeof(Map), "GetLayerParent", (Type[])null, (Type[])null); private static readonly FieldInfo? MapLayerLayer = AccessTools.Field(typeof(MapLayer), "layer"); private static readonly FieldInfo? PlayerIsDisabled = AccessTools.Field(typeof(PlayerAvatar), "isDisabled"); private static readonly FieldInfo? PlayerName = AccessTools.Field(typeof(PlayerAvatar), "playerName"); private static readonly FieldInfo? PlayerCosmetics = AccessTools.Field(typeof(PlayerAvatar), "playerCosmetics"); private static readonly FieldInfo? PlayerCosmeticsColorsEquipped = AccessTools.Field(typeof(PlayerCosmetics), "colorsEquipped"); private static readonly FieldInfo? MetaManagerInstance = AccessTools.Field(typeof(MetaManager), "instance"); private static readonly FieldInfo? MetaManagerColors = AccessTools.Field(typeof(MetaManager), "colors"); private static readonly FieldInfo? SemiColorColor = AccessTools.Field(typeof(SemiColor), "color"); private static readonly FieldInfo? EnemyTypeField = AccessTools.Field(typeof(Enemy), "Type"); private static readonly FieldInfo? EnemyCenterTransform = AccessTools.Field(typeof(Enemy), "CenterTransform"); private static readonly FieldInfo? ValuableVolumeType = AccessTools.Field(typeof(ValuableObject), "volumeType"); private static readonly FieldInfo? RoomVolumeExplored = AccessTools.Field(typeof(RoomVolume), "Explored"); private static readonly FieldInfo? RoomVolumeTruck = AccessTools.Field(typeof(RoomVolume), "Truck"); private static readonly FieldInfo? RoomVolumeExtraction = AccessTools.Field(typeof(RoomVolume), "Extraction"); private static readonly FieldInfo? RoomVolumeModule = AccessTools.Field(typeof(RoomVolume), "Module"); private static readonly FieldInfo? ModuleStartRoom = AccessTools.Field(typeof(Module), "StartRoom"); private static readonly FieldInfo? ModuleExplored = AccessTools.Field(typeof(Module), "Explored"); internal static Map? GetMap() { try { object? obj = MapInstance?.GetValue(null); return (Map?)((obj is Map) ? obj : null); } catch { return null; } } internal static bool IsMapActive(Map map) { try { object obj = MapActive?.GetValue(map); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } internal static Transform? GetOverLayerParent(Map map) { try { object? obj = MapOverLayerParent?.GetValue(map); return (Transform?)((obj is Transform) ? obj : null); } catch { return null; } } internal static GameObject? GetCustomObject(Map map) { try { object? obj = MapCustomObject?.GetValue(map); return (GameObject?)((obj is GameObject) ? obj : null); } catch { return null; } } internal static float GetScale(Map map) { try { return (MapScale?.GetValue(map) is float num) ? num : 0.1f; } catch { return 0.1f; } } internal static int GetPlayerLayer(Map map) { try { return (MapPlayerLayer?.GetValue(map) is int num) ? num : 0; } catch { return 0; } } internal static int GetLayerForWorldY(Map map, float positionY) { try { object obj = MapGetLayerParent?.Invoke(map, new object[1] { positionY }); return (((obj == null) ? null : MapLayerLayer?.GetValue(obj)) is int num) ? num : 0; } catch { return 0; } } internal static bool IsPlayerDisabled(PlayerAvatar player) { try { object obj = PlayerIsDisabled?.GetValue(player); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } internal static string GetPlayerName(PlayerAvatar player) { try { return (PlayerName?.GetValue(player) as string) ?? string.Empty; } catch { return string.Empty; } } internal static PlayerCosmetics? GetPlayerCosmetics(PlayerAvatar player) { try { object? obj = PlayerCosmetics?.GetValue(player); return (PlayerCosmetics?)((obj is PlayerCosmetics) ? obj : null); } catch { return null; } } internal static int[]? GetColorsEquipped(PlayerCosmetics? cosmetics) { if ((Object)(object)cosmetics == (Object)null) { return null; } try { return PlayerCosmeticsColorsEquipped?.GetValue(cosmetics) as int[]; } catch { return null; } } internal static List<SemiColor>? GetMetaColors() { try { object? obj = MetaManagerInstance?.GetValue(null); MetaManager val = (MetaManager)((obj is MetaManager) ? obj : null); if ((Object)(object)val == (Object)null) { return null; } return MetaManagerColors?.GetValue(val) as List<SemiColor>; } catch { return null; } } internal static Color GetSemiColor(SemiColor semiColor) { //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_0038: 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_001c: 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_002b: Unknown result type (might be due to invalid IL or missing references) try { return (SemiColorColor?.GetValue(semiColor) is Color val) ? val : Color.white; } catch { return Color.white; } } internal static EnemyType GetEnemyType(Enemy enemy) { //IL_002d: 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_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) try { return (EnemyType)((!(EnemyTypeField?.GetValue(enemy) is EnemyType val)) ? 2 : ((int)val)); } catch { return (EnemyType)2; } } internal static Transform? GetEnemyCenter(Enemy enemy) { try { object? obj = EnemyCenterTransform?.GetValue(enemy); return (Transform?)((obj is Transform) ? obj : null); } catch { return null; } } internal static Type GetValuableVolumeType(ValuableObject valuable) { //IL_002d: 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_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) try { return (Type)((!(ValuableVolumeType?.GetValue(valuable) is Type val)) ? 1 : ((int)val)); } catch { return (Type)1; } } internal static bool IsMapPositionDiscovered(Vector3 position) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) try { int mask = LayerMask.GetMask(new string[1] { "RoomVolume" }); Collider[] array = Physics.OverlapSphere(position, 0.35f, mask, (QueryTriggerInteraction)2); if (array == null || array.Length == 0) { return true; } for (int i = 0; i < array.Length; i++) { RoomVolume val = ((Component)array[i]).GetComponent<RoomVolume>(); if ((Object)(object)val == (Object)null) { val = ((Component)array[i]).GetComponentInParent<RoomVolume>(); } if ((Object)(object)val != (Object)null && IsRoomDiscovered(val)) { return true; } } return false; } catch { return true; } } private static bool IsRoomDiscovered(RoomVolume room) { if (GetBool(RoomVolumeTruck, room) || GetBool(RoomVolumeExtraction, room) || GetBool(RoomVolumeExplored, room)) { return true; } Module val = null; try { object? obj = RoomVolumeModule?.GetValue(room); val = (Module)((obj is Module) ? obj : null); } catch { val = null; } if ((Object)(object)val == (Object)null) { return false; } if (!GetBool(ModuleStartRoom, val)) { return GetBool(ModuleExplored, val); } return true; } private static bool GetBool(FieldInfo? field, object instance) { try { object obj = field?.GetValue(instance); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } } }