using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AIGraph;
using Agents;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using GTFO.API.Utilities;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Player;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MinimapMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MinimapMod")]
[assembly: AssemblyTitle("MinimapMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MinimapMod;
[BepInPlugin("minimap.HazardousMonkey", "MinimapMod", "1.2.4")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MinimapPlugin : BasePlugin
{
public enum minimapHudRespect
{
No,
Yes
}
public static ConfigEntry<float> MapScale;
public static ConfigEntry<minimapHudRespect> minimapRespectHudStatus;
public static ConfigEntry<string> MapBackgroundZoomColor;
public static ConfigEntry<float> OffsetX;
public static ConfigEntry<float> OffsetY;
public static ConfigEntry<string> AnchorX;
public static ConfigEntry<string> AnchorY;
public static ConfigEntry<KeyCode> ToggleKey;
public static ConfigEntry<KeyCode> ZoomKey;
public static ConfigEntry<bool> SuppressInventoryOnZoom;
public static ConfigEntry<bool> SuppressMapCursorForMinimap;
public static ConfigEntry<bool> MapMatchPlayerRotation;
public static ConfigEntry<string> MapShape;
public static ConfigEntry<int> MapUpdateRate;
public static ConfigEntry<int> PlayerLineThickness;
public static ConfigEntry<float> PlayerIconScale;
public static ConfigEntry<float> MinimapObjectIconScale;
public static ConfigEntry<bool> ShowLocationLabel;
public static ConfigEntry<string> LocationLabelPosition;
public static ConfigEntry<int> LocationLabelFontSize;
public static ConfigEntry<string> LocationLabelFont;
public static ConfigEntry<string> LabelOutlineColor;
public static ConfigEntry<float> LabelOutlineThickness;
public static ConfigEntry<bool> DetectCombatState;
public static ConfigEntry<string> ColorElevatorIdle;
public static ConfigEntry<string> ColorElevatorGoingDown;
public static ConfigEntry<string> ColorUndetected;
public static ConfigEntry<string> ColorEncounter;
public static ConfigEntry<string> ColorCombat;
public static ConfigEntry<string> ColorSurvival;
public static ConfigEntry<string> ColorIntentionalCombat;
public static ConfigEntry<bool> ShowCompass;
public static ConfigEntry<int> CompassFontSize;
public static ConfigEntry<string> CompassNorthColor;
public static ConfigEntry<string> CompassSouthColor;
public static ConfigEntry<string> CompassEastColor;
public static ConfigEntry<string> CompassWestColor;
public static ConfigEntry<float> MinimapOpacity;
public const int MinimapLayer = 31;
public static int UILayer = -1;
public static MinimapPlugin Instance { get; private set; }
public static bool DimensionMapsInstalled { get; private set; }
public static bool LobbyExpansionInstalled { get; private set; }
public static bool EECInstalled { get; private set; }
public override void Load()
{
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Expected O, but got Unknown
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Expected O, but got Unknown
//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
//IL_06f0: Expected O, but got Unknown
Instance = this;
DimensionMapsInstalled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("dev.aurirex.gtfo.dimensionmaps");
((BasePlugin)this).Log.LogWarning((object)("DimensionMaps: " + (DimensionMapsInstalled ? "detected" : "not found") + "."));
LobbyExpansionInstalled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("GTFO.LobbyExpansion");
((BasePlugin)this).Log.LogWarning((object)("LobbyExpansionInstalled: " + (LobbyExpansionInstalled ? "detected" : "not found") + "."));
EECInstalled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("GTFO.EECustomization");
((BasePlugin)this).Log.LogWarning((object)("EEC-H Installed: " + (EECInstalled ? "detected" : "not found") + "."));
MapShape = ((BasePlugin)this).Config.Bind<string>("- Shape and Position", "Shape", "Square", new ConfigDescription("Minimap shape.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Square", "Circle" }), Array.Empty<object>()));
MapScale = ((BasePlugin)this).Config.Bind<float>("- Shape and Position", "Scale", 0.3f, "Size of the minimap panel as a fraction of screen size (0.1 - 1.0)");
MinimapOpacity = ((BasePlugin)this).Config.Bind<float>("- Shape and Position", "Opacity", 1f, new ConfigDescription("Overall opacity of the minimap overlay (0.0 = fully transparent, 1.0 = fully opaque).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
AnchorX = ((BasePlugin)this).Config.Bind<string>("- Shape and Position", "AnchorX", "Right", new ConfigDescription("Horizontal screen edge to anchor the minimap to.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Left", "Right" }), Array.Empty<object>()));
AnchorY = ((BasePlugin)this).Config.Bind<string>("- Shape and Position", "AnchorY", "Bottom", new ConfigDescription("Vertical screen edge to anchor the minimap to.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Top", "Bottom" }), Array.Empty<object>()));
OffsetX = ((BasePlugin)this).Config.Bind<float>("- Shape and Position", "OffsetX", 16f, "Distance in pixels inward from the chosen horizontal edge.");
OffsetY = ((BasePlugin)this).Config.Bind<float>("- Shape and Position", "OffsetY", 16f, "Distance in pixels inward from the chosen vertical edge.");
MapMatchPlayerRotation = ((BasePlugin)this).Config.Bind<bool>("- General Functions", "Match player rotation (False disables compass)", true, "Minimap rotates to match your facing direction");
ToggleKey = ((BasePlugin)this).Config.Bind<KeyCode>("- General Functions", "ToggleKey", (KeyCode)109, "Key to show/hide the minimap");
ZoomKey = ((BasePlugin)this).Config.Bind<KeyCode>("- General Functions", "ZoomKey", (KeyCode)308, "Hold this key while scrolling to zoom the minimap.");
SuppressInventoryOnZoom = ((BasePlugin)this).Config.Bind<bool>("- General Functions", "SuppressInventoryOnZoom", true, "Holding ZoomKey prevents weapon switching while scrolling. ");
SuppressMapCursorForMinimap = ((BasePlugin)this).Config.Bind<bool>("- General Functions", "SuppressUnintendedMinimapCursorUpdates", true, "Because we're keeping regular map logic running for the minimap even while the fullscreen map is closed, for other players, this can sometimes appear as though you're constantly movng your mouse around on the map. This is an attempt to prevent that.");
MapBackgroundZoomColor = ((BasePlugin)this).Config.Bind<string>("- General Functions", "MapBackgroundZoomColor", "#ff9933", "Color of the minimap background while ZoomKey is held (hex #rrggbb)");
PlayerLineThickness = ((BasePlugin)this).Config.Bind<int>("- General Functions", "PlayerLineThickness", 5, "Thickness of player-to-player lines on the minimap in world units (0 = off)");
PlayerIconScale = ((BasePlugin)this).Config.Bind<float>("- General Functions", "PlayerIconScale", 2f, "Scale multiplier applied to player icons on the minimap 1.0 = game default, 2.0 = double size, etc");
MinimapObjectIconScale = ((BasePlugin)this).Config.Bind<float>("- General Functions", "MinimapObjectIconScale", 2f, "Scale multiplier applied to map object icons (doors, lockers, terminals, ladders, etc.) on the minimap. CM_MapSign items are excluded as they lack a centered origin. 1.0 = game default, 2.0 = double size, etc");
MapUpdateRate = ((BasePlugin)this).Config.Bind<int>("- General Functions", "UpdateRate", 0, "Frames between minimap data ticks. 0 = every frame (smoothest) Higher values reduce CPU cost but obviously will look worse");
minimapRespectHudStatus = ((BasePlugin)this).Config.Bind<minimapHudRespect>("- General Functions", "Respect HUD Disabled Status", minimapHudRespect.No, "Auto-disable when the rest of the player-hud is disabled. Works with EEC-H EMP mechanics. (This is a dropdown because I might build in more choice in the future)");
ShowLocationLabel = ((BasePlugin)this).Config.Bind<bool>("Zone label", "ShowLocationLabel", true, "Reveal what Zone & Area you're in above the minimap. Updated every 0.25 seconds");
LocationLabelPosition = ((BasePlugin)this).Config.Bind<string>("Zone label", "Label Position (might require Offset adjustment)", "Top", new ConfigDescription("Position of the zone label relative to the minimap edge. Top = floats above, Bottom = floats below.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Top", "Bottom" }), Array.Empty<object>()));
LocationLabelFontSize = ((BasePlugin)this).Config.Bind<int>("Zone label", "LocationLabelFontSize", 24, "Font size of the Zone|Area label displayed near the minimap");
LocationLabelFont = ((BasePlugin)this).Config.Bind<string>("Zone label", "Font", "Arial", "Font name for the Zone|Area label. Must be a Unity built-in resource name (e.g. \"Arial\"). Falls back to Arial if the name is not found.");
LabelOutlineColor = ((BasePlugin)this).Config.Bind<string>("Zone label", "OutlineColor", "#000000", "Color of the text outline stroke (hex #rrggbb). Applied once at first level load — requires a game restart to change.");
LabelOutlineThickness = ((BasePlugin)this).Config.Bind<float>("Zone label", "OutlineThickness", 2f, "Pixel radius of the text outline stroke. Applied once at first level load — requires a game restart to change.");
DetectCombatState = ((BasePlugin)this).Config.Bind<bool>("Zone label", "DetectCombatState (2 second delay)", true, "Zone label changes color to reflect the current drama state (Undetected, Scout wave, Door Alarm, etc). There's a 2 second delay in color changes to avoid balance concerns");
ColorElevatorIdle = ((BasePlugin)this).Config.Bind<string>("Zone label", "ElevatorIdle", "#ffffff", "Level not yet started, obviously (hex #rrggbb)");
ColorElevatorGoingDown = ((BasePlugin)this).Config.Bind<string>("Zone label", "ElevatorGoingDown", "#ffffff", "Level not yet started, obviously (hex #rrggbb)");
ColorUndetected = ((BasePlugin)this).Config.Bind<string>("Zone label", "Undetected", "#1ae08c", "Label color while undetected (hex #rrggbb)");
ColorEncounter = ((BasePlugin)this).Config.Bind<string>("Zone label", "Encounter", "#ffa600", "Label color while generally detected (hex #rrggbb)");
ColorCombat = ((BasePlugin)this).Config.Bind<string>("Zone label", "Combat", "#ffff00", "Label color while fighting several sleepers (hex #rrggbb)");
ColorSurvival = ((BasePlugin)this).Config.Bind<string>("Zone label", "Survival", "#00ffff", "Label color during Scout & Reactor waves (hex #rrggbb)");
ColorIntentionalCombat = ((BasePlugin)this).Config.Bind<string>("Zone label", "IntentionalCombat", "#ff0000", "Label color during Door Alert wave (hex #rrggbb)");
ShowCompass = ((BasePlugin)this).Config.Bind<bool>("Compass", "Show Compass (Requires ► Match Player Rotation)", true, "Show N/S/E/W compass labels around the minimap edge. Most useful when MapMatchPlayerRotation is enabled.");
CompassFontSize = ((BasePlugin)this).Config.Bind<int>("Compass", "FontSize", 22, "Font size for the compass direction labels.");
CompassNorthColor = ((BasePlugin)this).Config.Bind<string>("Compass", "NorthColor", "#1ae08c", "Color of the North (N) compass label (hex #rrggbb) (Green = default).");
CompassSouthColor = ((BasePlugin)this).Config.Bind<string>("Compass", "SouthColor", "#ff0000", "Color of the South (S) compass label (hex #rrggbb) (Red = default).");
CompassEastColor = ((BasePlugin)this).Config.Bind<string>("Compass", "EastColor", "#3ca3ff", "Color of the East (E) compass label (hex #rrggbb) (Blue = default).");
CompassWestColor = ((BasePlugin)this).Config.Bind<string>("Compass", "WestColor", "#ffe600", "Color of the West (W) compass label (hex #rrggbb) (Yellow = default).");
ClassInjector.RegisterTypeInIl2Cpp<MinimapToggler>();
new Harmony("minimap.HazardousMonkey").PatchAll();
LiveEdit.CreateListener(Paths.ConfigPath, Path.GetFileName(((BasePlugin)this).Config.ConfigFilePath), false).FileChanged += (LiveEditEventHandler)delegate
{
((BasePlugin)this).Config.Reload();
MinimapManager.MarkConfigDirty();
};
((BasePlugin)this).Log.LogInfo((object)"MinimapMod loaded.");
}
}
public static class OverlayCanvasManager
{
public static GameObject CanvasRoot { get; private set; }
public static CanvasGroup CanvasGroup { get; private set; }
public static void EnsureCreated()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)CanvasRoot != (Object)null && ((Il2CppObjectBase)CanvasRoot).Pointer != IntPtr.Zero)
{
return;
}
try
{
CanvasRoot = new GameObject("MinimapOverlayCanvas");
Object.DontDestroyOnLoad((Object)(object)CanvasRoot);
Canvas obj = ((Il2CppObjectBase)CanvasRoot.AddComponent(Il2CppType.Of<Canvas>())).Cast<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 50;
CanvasScaler obj2 = ((Il2CppObjectBase)CanvasRoot.AddComponent(Il2CppType.Of<CanvasScaler>())).Cast<CanvasScaler>();
obj2.uiScaleMode = (ScaleMode)1;
obj2.referenceResolution = new Vector2(1920f, 1080f);
CanvasGroup obj3 = ((Il2CppObjectBase)CanvasRoot.AddComponent(Il2CppType.Of<CanvasGroup>())).Cast<CanvasGroup>();
obj3.alpha = MinimapPlugin.MinimapOpacity.Value;
obj3.interactable = false;
obj3.blocksRaycasts = false;
CanvasGroup = obj3;
}
catch (Exception value)
{
Debug.LogError(Object.op_Implicit($"[MinimapMod] Failed to create overlay canvas: {value}"));
CanvasRoot = null;
CanvasGroup = null;
}
}
}
public static class ZoneAreaTracker
{
private const float _tickInterval = 0.25f;
private static float _nextTickTime = 0f;
public static string CachedLabel { get; private set; } = "";
public static void Reset()
{
_nextTickTime = 0f;
CachedLabel = "";
}
public static void Tick()
{
if (!(Time.time < _nextTickTime))
{
_nextTickTime = Time.time + 0.25f;
CachedLabel = BuildLabel();
}
}
private static string LayerSuffix(LG_LayerType type)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
if ((int)type != 1)
{
if ((int)type == 2)
{
return "c";
}
return "";
}
return "b";
}
private static string BuildLabel()
{
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
try
{
PlayerAgent localPlayerAgent = MinimapManager.LocalPlayerAgent;
if ((Object)(object)localPlayerAgent == (Object)null || ((Il2CppObjectBase)localPlayerAgent).Pointer == IntPtr.Zero)
{
return "";
}
AIG_CourseNode courseNode = ((Agent)localPlayerAgent).CourseNode;
if (courseNode == null || ((Il2CppObjectBase)courseNode).Pointer == IntPtr.Zero)
{
return "";
}
LG_Area area = courseNode.m_area;
if ((Object)(object)area == (Object)null || ((Il2CppObjectBase)area).Pointer == IntPtr.Zero)
{
return "";
}
LG_Zone zone = area.m_zone;
if ((Object)(object)zone == (Object)null || ((Il2CppObjectBase)zone).Pointer == IntPtr.Zero)
{
return "";
}
string value = ((zone.Layer != null) ? LayerSuffix(zone.Layer.m_type) : "");
string text = $"Zone {zone.Alias}{value}";
string text2 = "Area ?";
List<LG_Area> areas = zone.m_areas;
if (areas != null)
{
for (int i = 0; i < areas.Count; i++)
{
try
{
LG_Area val = areas[i];
if ((Object)(object)val != (Object)null && ((Il2CppObjectBase)val).Pointer == ((Il2CppObjectBase)area).Pointer)
{
text2 = "Area " + (char)(65 + i);
break;
}
}
catch (Exception value2)
{
Debug.LogWarning(Object.op_Implicit($"[MinimapMod] Couldn't resolve Zone Label area name -- {value2}"));
}
}
}
return text + " | " + text2;
}
catch (Exception ex)
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] ZoneAreaTracker.BuildLabel failed: " + ex.Message));
return "";
}
}
}
public static class MinimapManager
{
public static CM_PageMap MapPageInstance;
public static CM_PageMap MonkeyMapPageInstance;
public static bool activeEMP = false;
public static List<Transform> ObjectGUIList = new List<Transform>(4000);
public static List<Transform> PlayerGUIIconList = new List<Transform>(4);
public static bool IsTickingUpdate = false;
private static volatile bool _configDirty = false;
internal static CM_PageMap _cachedMapPage;
private static bool _isVisible = true;
internal static bool _isFullMapOpen = false;
internal static bool _isMenuLayerActive = false;
private static bool _isMapDisconnected = false;
private static bool _isCameraEnabledByPlayerLayer = false;
private static bool _playerIconScaleApplied = false;
private static bool _objectIconScaleApplied = false;
private static Camera _minimapCamera;
private static RenderTexture _minimapRT;
private static float _minimapScale = 2f;
private static float _fullmapScale = 2f;
private static GameObject _mapHolderHost;
internal static GameObject _mapHolderInstance;
private static Transform _mapHolderOriginalParent;
private static int _mapHolderOriginalLayer = 5;
internal static List<GameObject> _mapHolderAllObjects = new List<GameObject>();
private static Transform _mapMover;
private static Transform _mapMoverElements;
private static Transform _localPlayerMapItem;
private static PlayerAgent _localPlayerAgent;
private static eDimensionIndex _lastKnownDimension = (eDimensionIndex)(-1);
private static readonly List<SpriteRenderer> _mapSpriteRenderers = new List<SpriteRenderer>(2);
private static readonly List<Material> _mapSpriteMats = new List<Material>(2);
private static readonly List<Texture> _gridTileOriginals = new List<Texture>(2);
private static readonly Texture2D _blankGridTile = CreateBlankGridTile();
private static readonly List<GameObject> _playerLineObjects = new List<GameObject>(4);
private static readonly List<Transform> _cachedPlayerItems = new List<Transform>(4);
private static readonly List<LineRenderer> _cachedLineRenderers = new List<LineRenderer>(4);
private static int _playerLineInsertionIndex = -1;
private static Shader _spriteDefaultShader = null;
private static float _playerCountNextCheckTime = 0f;
private static float _pixelDrawCheckTime = 8f;
public static bool _pixelDrawShouldCheck = true;
internal static CM_MapDrawPixel[] _pixelBufferFlat = null;
private static int _pixelBufferCount = 0;
private static int _pixelBufferSize = 0;
private static readonly int[] _lastPixelBufferIndices = new int[4];
private static Text _locationLabel;
private static string _lastLabelText = null;
private static DRAMA_State _lastDramaState = (DRAMA_State)2;
private static DRAMA_State _pendingDramaState = (DRAMA_State)2;
private static float _pendingStateTime = -1f;
private static Graphic _backgroundGraphic = null;
private static Graphic _borderGraphic = null;
private static bool _wasZoomHeld = false;
private static Color? _cachedZoomColor = null;
private static Color? _cachedBorderColor = null;
private static Sprite _circleSprite = null;
private static GameObject _compassRoot = null;
private static RectTransform[] _compassLabelRects = null;
private static float _compassRadius = 0f;
private static float _lastCompassY = float.NaN;
private static KeyCode _cfgToggleKey = (KeyCode)109;
public static KeyCode _cfgZoomKey = (KeyCode)308;
private static int _cfgPlayerLineThickness = 5;
private static bool _cfgShowLocationLabel = true;
private static bool _cfgDetectCombatState = true;
private static bool _cfgMatchRotation = true;
private static bool _cfgShowCompass = true;
public static bool _cfgSuppressInventory = true;
private static float _snapMapScale;
private static string _snapMapShape;
private static string _snapAnchorX;
private static string _snapAnchorY;
private static float _snapOffsetX;
private static float _snapOffsetY;
private static string _snapMapBackgroundZoomColor;
private static KeyCode _snapToggleKey;
private static KeyCode _snapZoomKey;
private static bool _snapSuppressInventory;
private static bool _snapMatchRotation;
private static int _snapMapUpdateRate;
private static int _snapPlayerLineThickness;
private static float _snapPlayerIconScale;
private static float _snapMinimapObjectIconScale;
private static bool _snapShowLocationLabel;
private static string _snapLocationLabelPosition;
private static int _snapLocationLabelFontSize;
private static string _snapLocationLabelFont;
private static string _snapLabelOutlineColor;
private static float _snapLabelOutlineThickness;
private static bool _snapDetectCombatState;
private static string _snapColorElevatorIdle;
private static string _snapColorElevatorGoingDown;
private static string _snapColorUndetected;
private static string _snapColorEncounter;
private static string _snapColorCombat;
private static string _snapColorSurvival;
private static string _snapColorIntentionalCombat;
private static Color _cachedColorElevatorIdle;
private static Color _cachedColorElevatorGoingDown;
private static Color _cachedColorUndetected;
private static Color _cachedColorEncounter;
private static Color _cachedColorCombat;
private static Color _cachedColorSurvival;
private static Color _cachedColorIntentionalCombat;
private static readonly Color _cachedColorDramaDefault = new Color(0.9f, 0.9f, 0.9f, 1f);
private static bool _snapShowCompass;
private static int _snapCompassFontSize;
private static string _snapCompassNorthColor;
private static string _snapCompassSouthColor;
private static string _snapCompassEastColor;
private static string _snapCompassWestColor;
private static float _snapMinimapOpacity;
public static GameObject BackgroundPanel { get; private set; }
public static GameObject MinimapDisplay { get; private set; }
public static bool IsFullMapOpen => _isFullMapOpen;
public static bool IsLabelEnabled => _cfgShowLocationLabel;
public static PlayerAgent LocalPlayerAgent => _localPlayerAgent;
public static int SnapMapUpdateRate => _snapMapUpdateRate;
public static void MarkConfigDirty()
{
_configDirty = true;
}
public static bool ConsumeConfigDirty()
{
if (!_configDirty)
{
return false;
}
_configDirty = false;
return true;
}
public static void CacheMapPage(CM_PageMap page)
{
_cachedMapPage = page;
}
private static Texture2D CreateBlankGridTile()
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
val.SetPixel(0, 0, Color.clear);
val.Apply();
return val;
}
public static void CacheHotConfig()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
_cfgToggleKey = MinimapPlugin.ToggleKey.Value;
_cfgZoomKey = MinimapPlugin.ZoomKey.Value;
_cfgPlayerLineThickness = MinimapPlugin.PlayerLineThickness.Value;
_cfgShowLocationLabel = MinimapPlugin.ShowLocationLabel.Value;
_cfgDetectCombatState = MinimapPlugin.DetectCombatState.Value;
_cfgMatchRotation = MinimapPlugin.MapMatchPlayerRotation.Value;
_cfgShowCompass = MinimapPlugin.ShowCompass.Value;
_cfgSuppressInventory = MinimapPlugin.SuppressInventoryOnZoom.Value;
SnapshotLiveConfig();
}
private static void SnapshotLiveConfig()
{
//IL_006e: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: 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_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
_snapMapScale = MinimapPlugin.MapScale.Value;
_snapMapShape = MinimapPlugin.MapShape.Value;
_snapAnchorX = MinimapPlugin.AnchorX.Value;
_snapAnchorY = MinimapPlugin.AnchorY.Value;
_snapOffsetX = MinimapPlugin.OffsetX.Value;
_snapOffsetY = MinimapPlugin.OffsetY.Value;
_snapMapBackgroundZoomColor = MinimapPlugin.MapBackgroundZoomColor.Value;
_snapToggleKey = MinimapPlugin.ToggleKey.Value;
_snapZoomKey = MinimapPlugin.ZoomKey.Value;
_snapSuppressInventory = MinimapPlugin.SuppressInventoryOnZoom.Value;
_snapMatchRotation = MinimapPlugin.MapMatchPlayerRotation.Value;
_snapMapUpdateRate = MinimapPlugin.MapUpdateRate.Value;
_snapPlayerLineThickness = MinimapPlugin.PlayerLineThickness.Value;
_snapPlayerIconScale = MinimapPlugin.PlayerIconScale.Value;
_snapMinimapObjectIconScale = MinimapPlugin.MinimapObjectIconScale.Value;
_snapShowLocationLabel = MinimapPlugin.ShowLocationLabel.Value;
_snapLocationLabelPosition = MinimapPlugin.LocationLabelPosition.Value;
_snapLocationLabelFontSize = MinimapPlugin.LocationLabelFontSize.Value;
_snapLocationLabelFont = MinimapPlugin.LocationLabelFont.Value;
_snapLabelOutlineColor = MinimapPlugin.LabelOutlineColor.Value;
_snapLabelOutlineThickness = MinimapPlugin.LabelOutlineThickness.Value;
_snapDetectCombatState = MinimapPlugin.DetectCombatState.Value;
_snapColorElevatorIdle = MinimapPlugin.ColorElevatorIdle.Value;
_snapColorElevatorGoingDown = MinimapPlugin.ColorElevatorGoingDown.Value;
_snapColorUndetected = MinimapPlugin.ColorUndetected.Value;
_snapColorEncounter = MinimapPlugin.ColorEncounter.Value;
_snapColorCombat = MinimapPlugin.ColorCombat.Value;
_snapColorSurvival = MinimapPlugin.ColorSurvival.Value;
_snapColorIntentionalCombat = MinimapPlugin.ColorIntentionalCombat.Value;
_cachedColorElevatorIdle = ParseColor(_snapColorElevatorIdle, new Color(0.75f, 0.75f, 0.75f, 1f), "ColorElevatorIdle");
_cachedColorElevatorGoingDown = ParseColor(_snapColorElevatorGoingDown, new Color(0.75f, 0.75f, 0.75f, 1f), "ColorElevatorGoingDown");
_cachedColorUndetected = ParseColor(_snapColorUndetected, new Color(0.1f, 0.88f, 0.55f, 1f), "ColorUndetected");
_cachedColorEncounter = ParseColor(_snapColorEncounter, new Color(1f, 0.55f, 0.1f, 1f), "ColorEncounter");
_cachedColorCombat = ParseColor(_snapColorCombat, new Color(1f, 1f, 0f, 1f), "ColorCombat");
_cachedColorSurvival = ParseColor(_snapColorSurvival, new Color(0.85f, 0.05f, 0.05f, 1f), "ColorSurvival");
_cachedColorIntentionalCombat = ParseColor(_snapColorIntentionalCombat, new Color(1f, 0.35f, 0.1f, 1f), "ColorIntentionalCombat");
_snapShowCompass = MinimapPlugin.ShowCompass.Value;
_snapCompassFontSize = MinimapPlugin.CompassFontSize.Value;
_snapCompassNorthColor = MinimapPlugin.CompassNorthColor.Value;
_snapCompassSouthColor = MinimapPlugin.CompassSouthColor.Value;
_snapCompassEastColor = MinimapPlugin.CompassEastColor.Value;
_snapCompassWestColor = MinimapPlugin.CompassWestColor.Value;
_snapMinimapOpacity = MinimapPlugin.MinimapOpacity.Value;
}
public static CM_PageMap FindMapPage()
{
if ((Object)(object)_cachedMapPage != (Object)null && ((Il2CppObjectBase)_cachedMapPage).Pointer != IntPtr.Zero)
{
return _cachedMapPage;
}
GameObject val = GameObject.Find("CM_PageMap_CellUI(Clone)");
if ((Object)(object)val == (Object)null)
{
val = GameObject.Find("CM_PageMap_CellUI");
}
if ((Object)(object)val != (Object)null)
{
CM_PageMap component = val.GetComponent<CM_PageMap>();
if ((Object)(object)component != (Object)null)
{
return component;
}
}
GameObject val2 = GameObject.Find("GUI");
if ((Object)(object)val2 == (Object)null)
{
return null;
}
Transform val3 = val2.transform.Find("CellUI_Camera(Clone)");
if ((Object)(object)val3 == (Object)null)
{
val3 = val2.transform.Find("CellUI_Camera");
}
if ((Object)(object)val3 == (Object)null)
{
return null;
}
Transform val4 = val3.Find("MainMenuLayer");
if ((Object)(object)val4 == (Object)null)
{
return null;
}
for (int i = 0; i < val4.childCount; i++)
{
CM_PageMap component2 = ((Component)val4.GetChild(i)).GetComponent<CM_PageMap>();
if ((Object)(object)component2 != (Object)null)
{
return component2;
}
}
return null;
}
public static void InitFromMapPage(CM_PageMap mapPage)
{
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Expected O, but got Unknown
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Expected O, but got Unknown
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Expected O, but got Unknown
//IL_02c8: 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)
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_0439: Unknown result type (might be due to invalid IL or missing references)
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_0445: Unknown result type (might be due to invalid IL or missing references)
//IL_044a: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
Debug.LogWarning(Object.op_Implicit("[MinimapMod] InitFromMapPage ran"));
if ((Object)(object)mapPage == (Object)null || ((Il2CppObjectBase)mapPage).Pointer == IntPtr.Zero)
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] mapPage pointer was null — skipping."));
return;
}
CacheHotConfig();
OverlayCanvasManager.EnsureCreated();
if ((Object)(object)OverlayCanvasManager.CanvasRoot == (Object)null || ((Il2CppObjectBase)OverlayCanvasManager.CanvasRoot).Pointer == IntPtr.Zero)
{
Debug.LogError(Object.op_Implicit("[MinimapMod] CanvasRoot unavailable."));
return;
}
try
{
Cleanup();
MapPageInstance = mapPage;
_isFullMapOpen = false;
Camera val = null;
GameObject val2 = GameObject.Find("CellUI_Camera(Clone)");
if ((Object)(object)val2 == (Object)null)
{
val2 = GameObject.Find("CellUI_Camera");
}
if ((Object)(object)val2 != (Object)null)
{
val = val2.GetComponent<Camera>();
}
if ((Object)(object)val == (Object)null)
{
foreach (Camera item in (Il2CppArrayBase<Camera>)(object)Camera.allCameras)
{
if (((Component)item).gameObject.layer == LayerMask.NameToLayer("UI") && (Object)(object)item.targetTexture != (Object)null)
{
val = item;
break;
}
}
}
if ((Object)(object)val == (Object)null)
{
Debug.LogError(Object.op_Implicit("[MinimapMod] Could not find CellUI_Camera."));
return;
}
MinimapPlugin.UILayer = LayerMask.NameToLayer("UI");
Transform val3 = ((Component)mapPage).transform.Find("MapHolder");
if ((Object)(object)val3 == (Object)null)
{
Debug.LogError(Object.op_Implicit("[MinimapMod] Could not find MapHolder."));
return;
}
_mapHolderOriginalParent = val3.parent;
_mapHolderOriginalLayer = ((Component)val3).gameObject.layer;
_mapHolderInstance = ((Component)val3).gameObject;
_mapMover = val3.Find("MapMover");
_mapMoverElements = (((Object)(object)_mapMover != (Object)null) ? _mapMover.Find("MapMoverElements") : null);
_localPlayerMapItem = null;
if ((Object)(object)_mapMover == (Object)null)
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] MapMover not found — player centering disabled."));
}
else if ((Object)(object)_mapMoverElements == (Object)null)
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] MapMoverElements not found — player centering disabled."));
}
if ((Object)(object)_mapHolderHost == (Object)null)
{
_mapHolderHost = new GameObject("MinimapMapHolderHost");
Object.DontDestroyOnLoad((Object)(object)_mapHolderHost);
}
val3.SetParent(_mapHolderHost.transform, true);
_mapHolderHost.SetActive(true);
CollectAllGUIChildren();
SetLayerFlat(31);
int num = (((Object)(object)val.targetTexture != (Object)null) ? ((Texture)val.targetTexture).width : 1920);
int num2 = (((Object)(object)val.targetTexture != (Object)null) ? ((Texture)val.targetTexture).height : 1080);
_minimapRT = new RenderTexture(num, num2, 16);
_minimapRT.Create();
GameObject val4 = new GameObject("MinimapCamera");
Object.DontDestroyOnLoad((Object)val4);
val4.transform.position = ((Component)val).transform.position;
val4.transform.rotation = ((Component)val).transform.rotation;
_minimapCamera = ((Il2CppObjectBase)val4.AddComponent(Il2CppType.Of<Camera>())).Cast<Camera>();
_minimapCamera.orthographic = val.orthographic;
_minimapCamera.orthographicSize = val.orthographicSize;
_minimapCamera.nearClipPlane = val.nearClipPlane;
_minimapCamera.farClipPlane = val.farClipPlane;
_minimapCamera.clearFlags = (CameraClearFlags)2;
_minimapCamera.backgroundColor = new Color(0f, 0f, 0f, 0f);
_minimapCamera.cullingMask = int.MinValue;
_minimapCamera.targetTexture = _minimapRT;
_minimapCamera.depth = val.depth + 1f;
_minimapCamera.aspect = 1f;
((Behaviour)_minimapCamera).enabled = true;
_isCameraEnabledByPlayerLayer = true;
BuildUI();
_mapHolderInstance.transform.localScale = new Vector3(_minimapScale, _minimapScale, 1f);
MapPageInstance.m_scaleCurrent = _minimapScale;
if (_cfgDetectCombatState && (Object)(object)_locationLabel != (Object)null && ((Il2CppObjectBase)_locationLabel).Pointer != IntPtr.Zero)
{
DRAMA_State currentStateEnum = DramaManager.CurrentStateEnum;
((Graphic)_locationLabel).color = GetDramaStateColor(currentStateEnum);
_lastDramaState = currentStateEnum;
_pendingDramaState = currentStateEnum;
_pendingStateTime = -1f;
}
_pixelBufferCount = ((Il2CppArrayBase<int>)(object)mapPage.m_drawPixelBufferIndex).Length;
_pixelBufferSize = mapPage.m_drawPixelBufferSize;
_pixelBufferFlat = (CM_MapDrawPixel[])(object)new CM_MapDrawPixel[_pixelBufferCount * _pixelBufferSize];
for (int i = 0; i < _pixelBufferCount; i++)
{
for (int j = 0; j < _pixelBufferSize; j++)
{
_pixelBufferFlat[i * _pixelBufferSize + j] = ((Il2CppArrayBase<CM_MapDrawPixel>)(object)((Il2CppArrayBase<Il2CppReferenceArray<CM_MapDrawPixel>>)(object)mapPage.m_drawPixelBuffer)[i])[j];
}
}
Array.Clear(_lastPixelBufferIndices, 0, _lastPixelBufferIndices.Length);
RefreshPanelVisibility();
PatchMapSpriteMaterial();
}
catch (Exception value)
{
Debug.LogError(Object.op_Implicit($"[MinimapMod] Exception in InitFromMapPage: {value}"));
Cleanup();
}
}
public static void Cleanup()
{
//IL_0143: 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_0207: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_mapHolderInstance != (Object)null && ((Il2CppObjectBase)_mapHolderInstance).Pointer != IntPtr.Zero && (Object)(object)_mapHolderOriginalParent != (Object)null)
{
_mapHolderInstance.transform.SetParent(_mapHolderOriginalParent, true);
if (_mapHolderAllObjects.Count > 0)
{
SetLayerFlat(_mapHolderOriginalLayer);
}
else
{
SetLayerRecursively(_mapHolderInstance, _mapHolderOriginalLayer);
}
}
_mapHolderAllObjects.Clear();
_mapHolderInstance = null;
_mapHolderOriginalParent = null;
for (int i = 0; i < _mapSpriteRenderers.Count; i++)
{
SpriteRenderer val = _mapSpriteRenderers[i];
Material val2 = _mapSpriteMats[i];
Texture val3 = _gridTileOriginals[i];
if ((Object)(object)val != (Object)null && ((Il2CppObjectBase)val).Pointer != IntPtr.Zero && (Object)(object)val2 != (Object)null && ((Il2CppObjectBase)val2).Pointer != IntPtr.Zero && (Object)(object)val3 != (Object)null)
{
val2.SetTexture("_GridTile", val3);
}
}
_mapSpriteMats.Clear();
_mapSpriteRenderers.Clear();
_gridTileOriginals.Clear();
DestroyPlayerLines();
_mapMover = null;
_mapMoverElements = null;
_localPlayerMapItem = null;
_localPlayerAgent = null;
_lastKnownDimension = (eDimensionIndex)(-1);
_isMapDisconnected = false;
_lastCompassY = float.NaN;
MapPageInstance = null;
_cachedMapPage = null;
_isFullMapOpen = false;
_isMenuLayerActive = false;
_isCameraEnabledByPlayerLayer = false;
_playerIconScaleApplied = false;
_objectIconScaleApplied = false;
_pixelBufferFlat = null;
_pixelBufferCount = 0;
_pixelBufferSize = 0;
Array.Clear(_lastPixelBufferIndices, 0, _lastPixelBufferIndices.Length);
if ((Object)(object)MinimapDisplay != (Object)null && ((Il2CppObjectBase)MinimapDisplay).Pointer != IntPtr.Zero)
{
RawImage component = MinimapDisplay.GetComponent<RawImage>();
if ((Object)(object)component != (Object)null && ((Il2CppObjectBase)component).Pointer != IntPtr.Zero)
{
component.texture = null;
}
}
_lastLabelText = null;
_lastDramaState = (DRAMA_State)2;
_pendingDramaState = (DRAMA_State)2;
_pendingStateTime = -1f;
_wasZoomHeld = false;
_cachedZoomColor = null;
_cachedBorderColor = null;
if ((Object)(object)_minimapCamera != (Object)null)
{
Object.DestroyImmediate((Object)(object)((Component)_minimapCamera).gameObject);
_minimapCamera = null;
}
if ((Object)(object)_minimapRT != (Object)null)
{
_minimapRT.Release();
_minimapRT = null;
}
if ((Object)(object)BackgroundPanel != (Object)null && ((Il2CppObjectBase)BackgroundPanel).Pointer != IntPtr.Zero)
{
BackgroundPanel.SetActive(false);
}
if ((Object)(object)_mapHolderHost != (Object)null && ((Il2CppObjectBase)_mapHolderHost).Pointer != IntPtr.Zero)
{
_mapHolderHost.SetActive(false);
}
}
private static void BuildUI()
{
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Expected O, but got Unknown
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: 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_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Expected O, but got Unknown
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03d3: Expected O, but got Unknown
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_0478: Unknown result type (might be due to invalid IL or missing references)
//IL_0483: Unknown result type (might be due to invalid IL or missing references)
//IL_0498: Unknown result type (might be due to invalid IL or missing references)
//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)BackgroundPanel != (Object)null && ((Il2CppObjectBase)BackgroundPanel).Pointer != IntPtr.Zero)
{
if ((Object)(object)MinimapDisplay != (Object)null && ((Il2CppObjectBase)MinimapDisplay).Pointer != IntPtr.Zero)
{
RawImage component = MinimapDisplay.GetComponent<RawImage>();
if ((Object)(object)component != (Object)null && ((Il2CppObjectBase)component).Pointer != IntPtr.Zero)
{
component.texture = (Texture)(object)_minimapRT;
}
}
if ((Object)(object)_locationLabel != (Object)null && ((Il2CppObjectBase)_locationLabel).Pointer != IntPtr.Zero)
{
((Component)_locationLabel).gameObject.SetActive(MinimapPlugin.ShowLocationLabel.Value);
}
if ((Object)(object)_compassRoot != (Object)null && ((Il2CppObjectBase)_compassRoot).Pointer != IntPtr.Zero)
{
_compassRoot.SetActive(MinimapPlugin.MapMatchPlayerRotation.Value && MinimapPlugin.ShowCompass.Value);
}
return;
}
string value = MinimapPlugin.MapShape.Value;
float value2 = MinimapPlugin.MapScale.Value;
float num;
float num2 = (num = 1080f * value2);
bool flag = !string.Equals(MinimapPlugin.AnchorX.Value, "Left", StringComparison.OrdinalIgnoreCase);
bool num3 = string.Equals(MinimapPlugin.AnchorY.Value, "Top", StringComparison.OrdinalIgnoreCase);
float num4 = (flag ? 1f : 0f);
float num5 = (num3 ? 1f : 0f);
float num6 = (flag ? (0f - MinimapPlugin.OffsetX.Value) : MinimapPlugin.OffsetX.Value);
float num7 = (num3 ? (0f - MinimapPlugin.OffsetY.Value) : MinimapPlugin.OffsetY.Value);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(num4, num5);
Vector2 pivot = default(Vector2);
((Vector2)(ref pivot))..ctor(num4, num5);
Vector2 anchoredPosition = default(Vector2);
((Vector2)(ref anchoredPosition))..ctor(num6, num7);
BackgroundPanel = new GameObject("MinimapBackground");
BackgroundPanel.transform.SetParent(OverlayCanvasManager.CanvasRoot.transform, false);
RectTransform obj = ((Il2CppObjectBase)BackgroundPanel.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
obj.anchorMin = val;
obj.anchorMax = val;
obj.pivot = pivot;
obj.anchoredPosition = anchoredPosition;
obj.sizeDelta = new Vector2(num, num2);
Transform transform = BackgroundPanel.transform;
if (value == "Circle")
{
GameObject val2 = new GameObject("MinimapCircleMask");
val2.transform.SetParent(BackgroundPanel.transform, false);
RectTransform obj2 = ((Il2CppObjectBase)val2.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
obj2.anchorMin = Vector2.zero;
obj2.anchorMax = Vector2.one;
obj2.sizeDelta = Vector2.zero;
obj2.anchoredPosition = Vector2.zero;
Image obj3 = ((Il2CppObjectBase)val2.AddComponent(Il2CppType.Of<Image>())).Cast<Image>();
obj3.sprite = _circleSprite ?? (_circleSprite = CreateCircleSprite(256));
((Graphic)obj3).color = Color.white;
((Il2CppObjectBase)val2.AddComponent(Il2CppType.Of<Mask>())).Cast<Mask>().showMaskGraphic = false;
GameObject val3 = new GameObject("MinimapCircleBackground");
val3.transform.SetParent(val2.transform, false);
RectTransform obj4 = ((Il2CppObjectBase)val3.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
obj4.anchorMin = Vector2.zero;
obj4.anchorMax = Vector2.one;
obj4.sizeDelta = Vector2.zero;
obj4.anchoredPosition = Vector2.zero;
Image val4 = ((Il2CppObjectBase)val3.AddComponent(Il2CppType.Of<Image>())).Cast<Image>();
((Graphic)val4).color = Color.clear;
val3.transform.SetAsFirstSibling();
transform = val2.transform;
_backgroundGraphic = ((Il2CppObjectBase)val4).Cast<Graphic>();
}
else
{
Image obj5 = ((Il2CppObjectBase)BackgroundPanel.AddComponent(Il2CppType.Of<Image>())).Cast<Image>();
((Graphic)obj5).color = Color.clear;
_backgroundGraphic = ((Il2CppObjectBase)obj5).Cast<Graphic>();
}
MinimapDisplay = new GameObject("MinimapDisplay");
MinimapDisplay.transform.SetParent(transform, false);
RectTransform obj6 = ((Il2CppObjectBase)MinimapDisplay.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
obj6.anchorMin = Vector2.zero;
obj6.anchorMax = Vector2.one;
obj6.sizeDelta = Vector2.zero;
obj6.anchoredPosition = Vector2.zero;
((Il2CppObjectBase)MinimapDisplay.AddComponent(Il2CppType.Of<RawImage>())).Cast<RawImage>().texture = (Texture)(object)_minimapRT;
BuildLocationLabel();
GameObject val5 = new GameObject("MinimapBorder");
val5.transform.SetParent(BackgroundPanel.transform, false);
RectTransform obj7 = ((Il2CppObjectBase)val5.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
obj7.anchorMin = Vector2.zero;
obj7.anchorMax = Vector2.one;
obj7.sizeDelta = new Vector2(8f, 8f);
obj7.anchoredPosition = Vector2.zero;
Image val6 = ((Il2CppObjectBase)val5.AddComponent(Il2CppType.Of<Image>())).Cast<Image>();
if (value == "Circle")
{
val6.sprite = _circleSprite ?? (_circleSprite = CreateCircleSprite(256));
}
((Graphic)val6).color = Color.clear;
_borderGraphic = ((Il2CppObjectBase)val6).Cast<Graphic>();
val5.transform.SetAsFirstSibling();
if (MinimapPlugin.MapMatchPlayerRotation.Value)
{
BuildCompass();
}
}
private static void BuildLocationLabel()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0031: 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_00fa: 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_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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_0168: 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_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("MinimapLocationLabel");
val.transform.SetParent(BackgroundPanel.transform, false);
((Il2CppObjectBase)val.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
_locationLabel = ((Il2CppObjectBase)val.AddComponent(Il2CppType.Of<Text>())).Cast<Text>();
string text = MinimapPlugin.LocationLabelFont.Value.Trim();
string text2 = (text.EndsWith(".ttf", StringComparison.OrdinalIgnoreCase) ? text : (text + ".ttf"));
Font builtinResource = Resources.GetBuiltinResource<Font>(text2);
if ((Object)(object)builtinResource == (Object)null)
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] Font '" + text2 + "' not found — falling back to Arial."));
builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf");
}
_locationLabel.font = builtinResource;
_locationLabel.fontSize = MinimapPlugin.LocationLabelFontSize.Value;
_locationLabel.alignment = (TextAnchor)4;
_locationLabel.text = "";
ApplyLabelPosition(MinimapPlugin.LocationLabelPosition.Value);
_lastDramaState = DramaManager.CurrentStateEnum;
_pendingDramaState = _lastDramaState;
_pendingStateTime = -1f;
((Graphic)_locationLabel).color = (MinimapPlugin.DetectCombatState.Value ? GetDramaStateColor(_lastDramaState) : Color.white);
float value = MinimapPlugin.LabelOutlineThickness.Value;
Color effectColor = ParseColor(MinimapPlugin.LabelOutlineColor.Value, new Color(0f, 0f, 0f, 1f), "LabelOutlineColor");
Outline obj = ((Il2CppObjectBase)val.AddComponent(Il2CppType.Of<Outline>())).Cast<Outline>();
((Shadow)obj).effectColor = effectColor;
((Shadow)obj).effectDistance = new Vector2(value, 0f - value);
val.SetActive(MinimapPlugin.ShowLocationLabel.Value);
}
private static void ApplyLabelPosition(string position)
{
//IL_00db: 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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: 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)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_locationLabel == (Object)null || ((Il2CppObjectBase)_locationLabel).Pointer == IntPtr.Zero)
{
return;
}
RectTransform val = ((Il2CppObjectBase)((Component)_locationLabel).gameObject.GetComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
if (!((Object)(object)val == (Object)null) && !(((Il2CppObjectBase)val).Pointer == IntPtr.Zero))
{
float num = (float)_locationLabel.fontSize + 8f;
if (string.Equals(position, "Bottom", StringComparison.OrdinalIgnoreCase))
{
val.anchorMin = new Vector2(0f, 0f);
val.anchorMax = new Vector2(1f, 0f);
val.pivot = new Vector2(0.5f, 1f);
val.anchoredPosition = new Vector2(0f, -6f);
}
else
{
val.anchorMin = new Vector2(0f, 1f);
val.anchorMax = new Vector2(1f, 1f);
val.pivot = new Vector2(0.5f, 0f);
val.anchoredPosition = new Vector2(0f, 6f);
}
val.sizeDelta = new Vector2(0f, num);
}
}
private static void BuildCompass()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_003e: 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_005e: 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_0073: 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_009e: 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_0117: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: 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_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
_compassRoot = new GameObject("CompassRoot");
_compassRoot.transform.SetParent(BackgroundPanel.transform, false);
RectTransform obj = ((Il2CppObjectBase)_compassRoot.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
obj.anchorMin = Vector2.zero;
obj.anchorMax = Vector2.one;
obj.pivot = new Vector2(0.5f, 0.5f);
obj.sizeDelta = Vector2.zero;
obj.anchoredPosition = Vector2.zero;
RectTransform val = ((Il2CppObjectBase)BackgroundPanel.GetComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
_compassRadius = Mathf.Min(val.sizeDelta.x, val.sizeDelta.y) * 0.5f * 0.88f;
Font builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf");
int value = MinimapPlugin.CompassFontSize.Value;
string[] array = new string[4] { "N", "S", "E", "W" };
Color[] array2 = (Color[])(object)new Color[4]
{
ParseColor(MinimapPlugin.CompassNorthColor.Value, Color.white, "CompassNorthColor"),
ParseColor(MinimapPlugin.CompassSouthColor.Value, Color.white, "CompassSouthColor"),
ParseColor(MinimapPlugin.CompassEastColor.Value, Color.white, "CompassEastColor"),
ParseColor(MinimapPlugin.CompassWestColor.Value, Color.white, "CompassWestColor")
};
_compassLabelRects = (RectTransform[])(object)new RectTransform[4];
for (int i = 0; i < 4; i++)
{
GameObject val2 = new GameObject("CompassLabel_" + array[i]);
val2.transform.SetParent(_compassRoot.transform, false);
float num = (float)value * 1.8f;
RectTransform val3 = ((Il2CppObjectBase)val2.AddComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
val3.anchorMin = new Vector2(0.5f, 0.5f);
val3.anchorMax = new Vector2(0.5f, 0.5f);
val3.pivot = new Vector2(0.5f, 0.5f);
val3.sizeDelta = new Vector2(num, num);
val3.anchoredPosition = Vector2.zero;
Text obj2 = ((Il2CppObjectBase)val2.AddComponent(Il2CppType.Of<Text>())).Cast<Text>();
obj2.text = array[i];
((Graphic)obj2).color = array2[i];
obj2.font = builtinResource;
obj2.fontSize = value;
obj2.fontStyle = (FontStyle)1;
obj2.alignment = (TextAnchor)4;
Outline obj3 = ((Il2CppObjectBase)val2.AddComponent(Il2CppType.Of<Outline>())).Cast<Outline>();
((Shadow)obj3).effectColor = new Color(0f, 0f, 0f, 0.85f);
((Shadow)obj3).effectDistance = new Vector2(2f, -2f);
_compassLabelRects[i] = val3;
}
_compassRoot.SetActive(MinimapPlugin.ShowCompass.Value);
}
private static Sprite CreateCircleSprite(int size)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
Color[] array = (Color[])(object)new Color[size * size];
float num = (float)(size - 1) / 2f;
float num2 = (float)size / 2f;
float num3 = num2 * num2;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
float num4 = (float)j - num;
float num5 = (float)i - num;
float num6 = num4 * num4 + num5 * num5;
float num7 = ((num6 > num3) ? 0f : Mathf.Clamp01(num2 - Mathf.Sqrt(num6)));
array[i * size + j] = new Color(1f, 1f, 1f, num7);
}
}
val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
val.Apply();
return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f));
}
private static void ApplyPanelLayout()
{
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: 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_0130: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)BackgroundPanel == (Object)null || ((Il2CppObjectBase)BackgroundPanel).Pointer == IntPtr.Zero)
{
return;
}
float value = MinimapPlugin.MapScale.Value;
float num;
float num2 = (num = 1080f * value);
bool flag = !string.Equals(MinimapPlugin.AnchorX.Value, "Left", StringComparison.OrdinalIgnoreCase);
bool num3 = string.Equals(MinimapPlugin.AnchorY.Value, "Top", StringComparison.OrdinalIgnoreCase);
float num4 = (flag ? 1f : 0f);
float num5 = (num3 ? 1f : 0f);
float num6 = (flag ? (0f - MinimapPlugin.OffsetX.Value) : MinimapPlugin.OffsetX.Value);
float num7 = (num3 ? (0f - MinimapPlugin.OffsetY.Value) : MinimapPlugin.OffsetY.Value);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(num4, num5);
RectTransform val2 = ((Il2CppObjectBase)BackgroundPanel.GetComponent(Il2CppType.Of<RectTransform>())).Cast<RectTransform>();
if ((Object)(object)val2 != (Object)null && ((Il2CppObjectBase)val2).Pointer != IntPtr.Zero)
{
val2.anchorMin = val;
val2.anchorMax = val;
val2.pivot = val;
val2.anchoredPosition = new Vector2(num6, num7);
val2.sizeDelta = new Vector2(num, num2);
if ((Object)(object)_compassRoot != (Object)null && ((Il2CppObjectBase)_compassRoot).Pointer != IntPtr.Zero)
{
_compassRadius = Mathf.Min(num, num2) * 0.5f * 0.88f;
}
}
}
private static void RebuildPanel()
{
if ((Object)(object)BackgroundPanel != (Object)null && ((Il2CppObjectBase)BackgroundPanel).Pointer != IntPtr.Zero)
{
Object.Destroy((Object)(object)BackgroundPanel);
}
BackgroundPanel = null;
MinimapDisplay = null;
_backgroundGraphic = null;
_borderGraphic = null;
_locationLabel = null;
_compassRoot = null;
_compassLabelRects = null;
_snapMapScale = MinimapPlugin.MapScale.Value;
_snapAnchorX = MinimapPlugin.AnchorX.Value;
_snapAnchorY = MinimapPlugin.AnchorY.Value;
_snapOffsetX = MinimapPlugin.OffsetX.Value;
_snapOffsetY = MinimapPlugin.OffsetY.Value;
BuildUI();
_playerIconScaleApplied = false;
_objectIconScaleApplied = false;
_lastLabelText = null;
RefreshPanelVisibility();
}
private static bool CanToggle(bool gameStateReady)
{
if ((Object)(object)BackgroundPanel == (Object)null)
{
return false;
}
return _isCameraEnabledByPlayerLayer && !_isFullMapOpen && !_isMenuLayerActive && !_isMapDisconnected && gameStateReady;
}
private static bool ShouldShow()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Invalid comparison between Unknown and I4
bool gameStateReady = (int)GameStateManager.CurrentStateName >= 8;
int num;
if (!MinimapPlugin.DimensionMapsInstalled)
{
PlayerAgent localPlayerAgent = _localPlayerAgent;
num = ((localPlayerAgent != null && (int)((Agent)localPlayerAgent).DimensionIndex > 0) ? 1 : 0);
}
else
{
num = 0;
}
bool flag = (byte)num != 0;
if (CanToggle(gameStateReady) && _isVisible)
{
return !flag;
}
return false;
}
public static void CheckToggle()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)BackgroundPanel == (Object)null) && !_isMapDisconnected && (int)FocusStateManager.CurrentState == 4 && Input.GetKeyDown(_cfgToggleKey))
{
_isVisible = !_isVisible;
RefreshPanelVisibility();
}
}
public static void UpdateZoomBackground()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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)
if ((Object)(object)_backgroundGraphic == (Object)null || ((Il2CppObjectBase)_backgroundGraphic).Pointer == IntPtr.Zero || _isMenuLayerActive)
{
return;
}
bool key = Input.GetKey(_cfgZoomKey);
if (key != _wasZoomHeld)
{
_wasZoomHeld = key;
_backgroundGraphic.color = (key ? ParseZoomColor() : Color.clear);
if ((Object)(object)_borderGraphic != (Object)null && ((Il2CppObjectBase)_borderGraphic).Pointer != IntPtr.Zero)
{
_borderGraphic.color = (key ? ParseBorderColor() : Color.clear);
}
}
}
public static void CenterOnLocalPlayer(bool forceMinimapUpdate)
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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)
//IL_0091: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: 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_0102: 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_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
if (_isFullMapOpen || !_isVisible || _isMenuLayerActive || (Object)(object)_mapMover == (Object)null || (Object)(object)_mapMoverElements == (Object)null)
{
return;
}
if ((Object)(object)_localPlayerMapItem == (Object)null || ((Il2CppObjectBase)_localPlayerMapItem).Pointer == IntPtr.Zero)
{
_localPlayerMapItem = FindLocalPlayerMapItem();
}
if ((Object)(object)_localPlayerMapItem == (Object)null)
{
return;
}
try
{
Vector3 localPosition = _localPlayerMapItem.localPosition;
_mapMover.localPosition = new Vector3(0f - localPosition.x, 0f - localPosition.y, _mapMover.localPosition.z);
if ((Object)(object)_localPlayerAgent == (Object)null || ((Il2CppObjectBase)_localPlayerAgent).Pointer == IntPtr.Zero)
{
_localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
}
PlayerAgent localPlayerAgent = _localPlayerAgent;
if ((Object)(object)localPlayerAgent != (Object)null && ((Il2CppObjectBase)localPlayerAgent).Pointer != IntPtr.Zero)
{
eDimensionIndex dimensionIndex = ((Agent)localPlayerAgent).DimensionIndex;
if (dimensionIndex != _lastKnownDimension)
{
_lastKnownDimension = dimensionIndex;
SyncActiveDimension(dimensionIndex);
}
}
if (!_cfgMatchRotation || !((Object)(object)localPlayerAgent != (Object)null) || !(((Il2CppObjectBase)localPlayerAgent).Pointer != IntPtr.Zero))
{
return;
}
float y = ((Component)localPlayerAgent).transform.eulerAngles.y;
if (forceMinimapUpdate || !Mathf.Approximately(y, _lastCompassY))
{
_lastCompassY = y;
if ((Object)(object)_mapHolderHost != (Object)null)
{
_mapHolderHost.transform.localEulerAngles = new Vector3(0f, 0f, y);
}
if ((Object)(object)_mapHolderInstance != (Object)null)
{
_mapHolderInstance.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
}
UpdateCompassPositions(y);
}
}
catch (Exception ex)
{
_localPlayerMapItem = null;
Debug.LogWarning(Object.op_Implicit("[MinimapMod] CenterOnLocalPlayer failed: " + ex.Message));
}
}
private static Transform FindLocalPlayerMapItem()
{
if ((Object)(object)_mapMoverElements == (Object)null)
{
return null;
}
for (int i = 0; i < _mapMoverElements.childCount; i++)
{
Transform child = _mapMoverElements.GetChild(i);
if (!((Object)(object)child == (Object)null) && !(((Object)child).name != "CM_MapSyncPlayerGUIItem(Clone)"))
{
Transform val = child.Find("localPlayer");
if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
{
return child;
}
}
}
return null;
}
private static void SyncActiveDimension(eDimensionIndex dim)
{
MapPageInstance.UpdatePlayerData();
if (!MinimapPlugin.DimensionMapsInstalled || (Object)(object)_mapMover == (Object)null)
{
return;
}
try
{
if (!MinimapPlugin.DimensionMapsInstalled)
{
return;
}
string text = ((object)(eDimensionIndex)(ref dim)).ToString();
string value = "_" + text;
for (int i = 0; i < _mapMover.childCount; i++)
{
Transform child = _mapMover.GetChild(i);
if (!((Object)(object)child == (Object)null))
{
string name = ((Object)child).name;
if (name.StartsWith("MapDetailsUI(Clone)_"))
{
((Component)child).gameObject.SetActive(name.EndsWith(value));
}
else if (IsDimensionRootName(name))
{
((Component)child).gameObject.SetActive(name == text);
}
}
}
}
catch (Exception ex)
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] SyncActiveDimension failed: " + ex.Message));
}
}
public static void SyncMapDisconnectedState()
{
if ((Object)(object)MapPageInstance == (Object)null || ((Il2CppObjectBase)MapPageInstance).Pointer == IntPtr.Zero)
{
return;
}
bool flag = false;
if (MinimapPlugin.minimapRespectHudStatus.Value == MinimapPlugin.minimapHudRespect.No)
{
flag = (Object)(object)MapPageInstance.m_mapDisconnected != (Object)null && MapPageInstance.m_mapDisconnected.activeSelf;
}
else
{
bool flag2 = false;
if (!((Component)GuiManager.PlayerLayer.m_playerStatus).gameObject.activeSelf)
{
flag2 = true;
}
flag = flag2 || ((Object)(object)MapPageInstance.m_mapDisconnected != (Object)null && MapPageInstance.m_mapDisconnected.activeSelf);
}
if (flag != _isMapDisconnected)
{
_isMapDisconnected = flag;
RefreshPanelVisibility();
}
}
private static bool IsDimensionRootName(string name)
{
if (name == "Reality")
{
return true;
}
if (name.StartsWith("Dimension_") && name.Length > "Dimension_".Length)
{
return true;
}
return false;
}
private static void UpdateCompassPositions(float playerY)
{
//IL_0053: 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_0082: 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)
if (!((Object)(object)_compassRoot == (Object)null) && !(((Il2CppObjectBase)_compassRoot).Pointer == IntPtr.Zero) && _compassLabelRects != null)
{
float num = (float)Math.PI / 180f * playerY;
float num2 = Mathf.Cos(num);
float num3 = Mathf.Sin(num);
float compassRadius = _compassRadius;
_compassLabelRects[0].anchoredPosition = new Vector2((0f - compassRadius) * num3, compassRadius * num2);
_compassLabelRects[1].anchoredPosition = new Vector2(compassRadius * num3, (0f - compassRadius) * num2);
_compassLabelRects[2].anchoredPosition = new Vector2(compassRadius * num2, compassRadius * num3);
_compassLabelRects[3].anchoredPosition = new Vector2((0f - compassRadius) * num2, (0f - compassRadius) * num3);
}
}
public static void UpdateLocationLabel()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0065: 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_006d: 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_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_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)
if ((Object)(object)_locationLabel == (Object)null || ((Il2CppObjectBase)_locationLabel).Pointer == IntPtr.Zero || !_cfgShowLocationLabel)
{
return;
}
string cachedLabel = ZoneAreaTracker.CachedLabel;
if (cachedLabel != _lastLabelText)
{
_lastLabelText = cachedLabel;
_locationLabel.text = cachedLabel;
}
if (!_cfgDetectCombatState)
{
return;
}
DRAMA_State currentStateEnum = DramaManager.CurrentStateEnum;
if (currentStateEnum != _lastDramaState)
{
if (currentStateEnum != _pendingDramaState)
{
_pendingDramaState = currentStateEnum;
_pendingStateTime = Time.time;
}
else if (Time.time - _pendingStateTime >= 2f)
{
_lastDramaState = _pendingDramaState;
((Graphic)_locationLabel).color = GetDramaStateColor(_lastDramaState);
}
}
}
private static Color GetDramaStateColor(DRAMA_State state)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected I4, but got Unknown
//IL_002c: 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)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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_0041: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_006a: 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_0069: Unknown result type (might be due to invalid IL or missing references)
switch ((int)state)
{
case 0:
return _cachedColorElevatorIdle;
case 1:
return _cachedColorElevatorGoingDown;
case 2:
case 3:
case 4:
return _cachedColorUndetected;
case 5:
return _cachedColorEncounter;
case 6:
return _cachedColorCombat;
case 7:
return _cachedColorSurvival;
case 8:
return _cachedColorIntentionalCombat;
default:
return _cachedColorDramaDefault;
}
}
public static void UpdatePlayerLines()
{
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: 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_0160: Expected O, but got Unknown
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Expected O, but got Unknown
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: 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_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
if (_cfgPlayerLineThickness <= 0)
{
if (_playerLineObjects.Count > 0)
{
DestroyPlayerLines();
}
}
else
{
if (!_isCameraEnabledByPlayerLayer || _isFullMapOpen || _isMenuLayerActive || (Object)(object)_mapMoverElements == (Object)null || (Object)(object)_localPlayerMapItem == (Object)null || ((Il2CppObjectBase)_localPlayerMapItem).Pointer == IntPtr.Zero)
{
return;
}
int num = _playerLineObjects.Count;
if (Time.time >= _playerCountNextCheckTime)
{
num = 0;
int childCount = _mapMoverElements.childCount;
for (int i = 0; i < childCount; i++)
{
Transform child = _mapMoverElements.GetChild(i);
if (!((Object)(object)child == (Object)null) && !((Object)(object)child == (Object)(object)_localPlayerMapItem) && !(((Object)child).name != "CM_MapSyncPlayerGUIItem(Clone)") && ((Component)child).gameObject.activeSelf)
{
Transform val = child.Find("syncPlayer");
if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
{
num++;
}
}
}
_playerCountNextCheckTime = Time.time + 1f;
}
if (_playerLineObjects.Count != num)
{
_playerCountNextCheckTime = 0f;
DestroyPlayerLines();
float num2 = _cfgPlayerLineThickness;
if (_spriteDefaultShader == null)
{
_spriteDefaultShader = Shader.Find("Sprites/Default");
}
Material material = new Material(_spriteDefaultShader);
int childCount2 = _mapMoverElements.childCount;
for (int j = 0; j < childCount2; j++)
{
Transform child2 = _mapMoverElements.GetChild(j);
if ((Object)(object)child2 == (Object)null || (Object)(object)child2 == (Object)(object)_localPlayerMapItem || ((Object)child2).name != "CM_MapSyncPlayerGUIItem(Clone)")
{
continue;
}
Transform val2 = child2.Find("syncPlayer");
if ((Object)(object)val2 == (Object)null || !((Component)val2).gameObject.activeSelf)
{
continue;
}
GameObject val3 = new GameObject($"MinimapPlayerLine_{_playerLineObjects.Count}");
val3.layer = 31;
if ((Object)(object)_mapHolderHost != (Object)null)
{
val3.transform.SetParent(_mapHolderHost.transform, false);
}
LineRenderer val4 = ((Il2CppObjectBase)val3.AddComponent(Il2CppType.Of<LineRenderer>())).Cast<LineRenderer>();
val4.positionCount = 2;
val4.useWorldSpace = true;
val4.startWidth = num2;
val4.endWidth = num2;
((Renderer)val4).material = material;
Color val5 = Color.white;
Image componentInChildren = ((Component)child2).GetComponentInChildren<Image>();
if ((Object)(object)componentInChildren != (Object)null)
{
val5 = ((Graphic)componentInChildren).color;
}
else
{
SpriteRenderer componentInChildren2 = ((Component)child2).GetComponentInChildren<SpriteRenderer>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
val5 = componentInChildren2.color;
}
}
val4.startColor = val5;
val4.endColor = val5;
_playerLineObjects.Add(val3);
_cachedPlayerItems.Add(child2);
_cachedLineRenderers.Add(val4);
if (_playerLineInsertionIndex < 0)
{
_playerLineInsertionIndex = _mapHolderAllObjects.Count;
}
_mapHolderAllObjects.Add(val3);
}
}
Vector3 position = _localPlayerMapItem.position;
for (int k = 0; k < _cachedLineRenderers.Count; k++)
{
Transform val6 = _cachedPlayerItems[k];
LineRenderer val7 = _cachedLineRenderers[k];
if ((Object)(object)val7 == (Object)null)
{
continue;
}
bool flag = (Object)(object)val6 != (Object)null && ((Il2CppObjectBase)val6).Pointer != IntPtr.Zero && ((Component)val6).gameObject.activeSelf;
if (!((Renderer)val7).enabled && flag)
{
Color val8 = Color.white;
Image componentInChildren3 = ((Component)val6).GetComponentInChildren<Image>();
if ((Object)(object)componentInChildren3 != (Object)null)
{
val8 = ((Graphic)componentInChildren3).color;
}
else
{
SpriteRenderer componentInChildren4 = ((Component)val6).GetComponentInChildren<SpriteRenderer>();
if ((Object)(object)componentInChildren4 != (Object)null)
{
val8 = componentInChildren4.color;
}
}
val7.startColor = val8;
val7.endColor = val8;
((Renderer)val7).enabled = true;
}
else if (((Renderer)val7).enabled != flag)
{
((Renderer)val7).enabled = flag;
}
if (flag)
{
val7.SetPosition(0, val6.position);
val7.SetPosition(1, position);
}
}
}
}
public static void TickMapUpdate()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MapPageInstance == (Object)null || (Object)(object)_minimapCamera == (Object)null || !_isCameraEnabledByPlayerLayer)
{
return;
}
IsTickingUpdate = true;
try
{
if ((int)GameStateManager.CurrentStateName >= 8)
{
((CM_PageBase)MapPageInstance).Update();
}
}
catch (Exception ex)
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] Map tick failed: " + ex.Message));
}
finally
{
IsTickingUpdate = false;
}
if (!_isFullMapOpen && (Object)(object)_mapHolderInstance != (Object)null && ((Il2CppObjectBase)_mapHolderInstance).Pointer != IntPtr.Zero)
{
_minimapScale = _mapHolderInstance.transform.localScale.x;
}
if (!_playerIconScaleApplied && (Object)(object)_mapMoverElements != (Object)null && !_isFullMapOpen)
{
for (int i = 0; i < _mapMoverElements.childCount; i++)
{
Transform child = _mapMoverElements.GetChild(i);
if ((Object)(object)child != (Object)null && ((Object)child).name == "CM_MapSyncPlayerGUIItem(Clone)")
{
ApplyPlayerIconScale();
_playerIconScaleApplied = true;
break;
}
}
}
if (_objectIconScaleApplied || !((Object)(object)_mapMover != (Object)null) || _isFullMapOpen)
{
return;
}
bool flag = false;
for (int j = 0; j < _mapMover.childCount; j++)
{
if (flag)
{
break;
}
Transform child2 = _mapMover.GetChild(j);
if ((Object)(object)child2 == (Object)null)
{
continue;
}
for (int k = 0; k < child2.childCount; k++)
{
if (flag)
{
break;
}
Transform child3 = child2.GetChild(k);
if ((Object)(object)child3 == (Object)null || !((Object)child3).name.StartsWith("CM_MapZoneGUIItem"))
{
continue;
}
Transform val = child3.Find("AreaRoot");
if ((Object)(object)val == (Object)null)
{
continue;
}
for (int l = 0; l < val.childCount; l++)
{
if (flag)
{
break;
}
Transform child4 = val.GetChild(l);
if (!((Object)(object)child4 == (Object)null) && ((Object)child4).name.StartsWith("CM_MapAreaGUIItem"))
{
Transform val2 = child4.Find("GUIObjRoot");
if ((Object)(object)val2 != (Object)null && val2.childCount > 0)
{
flag = true;
}
}
}
}
}
if (flag)
{
ApplyObjectIconScale();
_objectIconScaleApplied = true;
}
}
public static void OnFullMapOpened()
{
//IL_0082: 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)
if (IsTickingUpdate)
{
return;
}
_isFullMapOpen = true;
int count = _playerLineObjects.Count;
for (int i = 0; i < count; i++)
{
GameObject val = _playerLineObjects[i];
if ((Object)(object)val != (Object)null && ((Il2CppObjectBase)val).Pointer != IntPtr.Zero)
{
val.SetActive(false);
}
}
if ((Object)(object)_mapHolderHost != (Object)null)
{
_mapHolderHost.SetActive(true);
}
if ((Object)(object)_mapHolderHost != (Object)null)
{
_mapHolderHost.transform.localEulerAngles = Vector3.zero;
}
if ((Object)(object)_mapHolderInstance != (Object)null)
{
SetLayerFlat(MinimapPlugin.UILayer);
}
RestorePlayerIconScale();
RestoreObjectIconScale();
SetGridVisible(visible: true);
_pixelDrawShouldCheck = false;
if ((Object)(object)BackgroundPanel != (Object)null)
{
BackgroundPanel.SetActive(false);
}
if ((Object)(object)_mapHolderInstance != (Object)null)
{
_mapHolderInstance.transform.localScale = new Vector3(_fullmapScale, _fullmapScale, 1f);
if ((Object)(object)MapPageInstance != (Object)null)
{
MapPageInstance.m_scaleCurrent = _fullmapScale;
}
}
}
public static void OnFullMapClosed()
{
//IL_0043: 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)
if (IsTickingUpdate)
{
return;
}
if ((Object)(object)_mapHolderInstance != (Object)null)
{
SetLayerFlat(31);
}
ApplyPlayerIconScale();
ApplyObjectIconScale();
SetGridVisible(visible: false);
if ((Object)(object)_mapHolderInstance != (Object)null)
{
_fullmapScale = _mapHolderInstance.transform.localScale.x;
_mapHolderInstance.transform.localScale = new Vector3(_minimapScale, _minimapScale, 1f);
if ((Object)(object)MapPageInstance != (Object)null)
{
MapPageInstance.m_scaleCurrent = _minimapScale;
}
}
_pixelDrawCheckTime = Time.time + 8f;
_pixelDrawShouldCheck = true;
}
public static void OnPlayerLayerStateChanged(bool playerLayerActive)
{
if (!((Object)(object)_minimapCamera == (Object)null))
{
_isCameraEnabledByPlayerLayer = playerLayerActive;
((Behaviour)_minimapCamera).enabled = playerLayerActive;
RefreshPanelVisibility();
}
}
public static void SetMinimapCameraForTick(bool enable)
{
if (!((Object)(object)_minimapCamera == (Object)null))
{
if (enable && !((Behaviour)_minimapCamera).enabled)
{
((Behaviour)_minimapCamera).enabled = _isCameraEnabledByPlayerLayer;
}
else if (!enable && _isCameraEnabledByPlayerLayer)
{
((Behaviour)_minimapCamera).enabled = false;
}
}
}
internal static void RefreshPanelVisibility()
{
if ((Object)(object)BackgroundPanel == (Object)null)
{
return;
}
bool flag = ShouldShow();
BackgroundPanel.SetActive(flag);
if ((Object)(object)_mapHolderHost != (Object)null)
{
_mapHolderHost.SetActive(flag || _isFullMapOpen);
}
int count = _playerLineObjects.Count;
for (int i = 0; i < count; i++)
{
GameObject val = _playerLineObjects[i];
if ((Object)(object)val != (Object)null && ((Il2CppObjectBase)val).Pointer != IntPtr.Zero)
{
val.SetActive(flag);
}
}
if ((Object)(object)_locationLabel != (Object)null && ((Il2CppObjectBase)_locationLabel).Pointer != IntPtr.Zero)
{
((Component)_locationLabel).gameObject.SetActive(flag && _cfgShowLocationLabel);
}
if ((Object)(object)_compassRoot != (Object)null && ((Il2CppObjectBase)_compassRoot).Pointer != IntPtr.Zero)
{
_compassRoot.SetActive(flag && _cfgMatchRotation && _cfgShowCompass);
}
}
internal static void SetLayerFlat(int layer)
{
int count = _mapHolderAllObjects.Count;
for (int i = 0; i < count; i++)
{
_mapHolderAllObjects[i].layer = layer;
}
}
internal static void CollectAllGUIChildren()
{
//IL_0b9e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ba4: Invalid comparison between Unknown and I4
_mapHolderAllObjects.Clear();
int num = 12000;
if (_mapHolderAllObjects.Capacity != num && _mapHolderAllObjects.Count < num)
{
_mapHolderAllObjects.Capacity = num;
}
Debug.LogWarning(Object.op_Implicit("------------ Building Minimap GUI object registry ------------"));
Transform transform = MonkeyMapPageInstance.m_mapMover.transform;
if (!MinimapPlugin.DimensionMapsInstalled && (Object)(object)MonkeyMapPageInstance != (Object)null)
{
List<GameObject> list = new List<GameObject>(200);
List<GameObject> list2 = new List<GameObject>(20);
bool flag = false;
Transform transform2 = CM_PageMap.m_mapMoverElementsRoot.transform;
int childCount = transform2.childCount;
for (int i = 0; i < childCount; i++)
{
GameObject gameObject = ((Component)transform2.GetChild(i)).gameObject;
if (!CustomExtensions.ContainsIgnoreCase(((Object)gameObject).name, "CM_MapZoneGUIItem") && !CustomExtensions.ContainsIgnoreCase(((Object)gameObject).name, "CM_MapElevator"))
{
continue;
}
if (CustomExtensions.ContainsIgnoreCase(((Object)gameObject).name, "CM_MapZoneGUIItem"))
{
if (!flag)
{
continue;
}
list.Add(gameObject);
}
if (CustomExtensions.ContainsIgnoreCase(((Object)gameObject).name, "CM_MapElevator"))
{
if (flag)
{
list2.Add(gameObject);
}
else
{
flag = true;
}
}
}
List<GameObject> list3 = new List<GameObject>(20);
int childCount2 = transform.childCount;
for (int j = 0; j < childCount2; j++)
{
if (CustomExtensions.ContainsIgnoreCase(((Object)((Component)transform.GetChild(j)).gameObject).name, "MapDetailsUI"))
{
list3.Add(((Component)transform.GetChild(j).GetChild(0)).gameObject);
}
}
if (list3.Count > 1)
{
foreach (GameObject item11 in list3)
{
((Component)item11.transform.parent).gameObject.SetActive(false);
item11.SetActive(false);
}
((Component)list3[0].transform.parent).gameObject.SetActive(true);
list3[0].SetActive(true);
Debug.LogWarning(Object.op_Implicit($"[MinimapMod] {list3.Count - 1} duplicate map background(s) have been disabled"));
}
if (list.Count > 0)
{
Debug.LogWarning(Object.op_Implicit($"[MinimapMod] Destroying {list.Count} duplicate or bad ZoneGUI roots"));
foreach (GameObject item12 in list)
{
Object.DestroyImmediate((Object)(object)item12);
}
}
else
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] no bad ZoneGUI roots"));
}
if (list2.Count > 0)
{
Debug.LogWarning(Object.op_Implicit($"[MinimapMod] Destroying {list2.Count} duplicate elevator icons"));
foreach (GameObject item13 in list2)
{
Object.DestroyImmediate((Object)(object)item13);
}
}
else
{
Debug.LogWarning(Object.op_Implicit("[MinimapMod] no duplicate elevator icons"));
}
if (ObjectGUIList.Count > 0)
{
int count = ObjectGUIList.Count;
ObjectGUIList.RemoveAll((Transform item) => (Object)(object)item == (Object)null);
ObjectGUIList.TrimExcess();
if (ObjectGUIList.Count < count)
{
Debug.LogWarning(Object.op_Implicit($"[MinimapMod] -- This killed off {count - ObjectGUIList.Count} duplicate or OOB GUI objects"));
}
}
if (PlayerGUIIconList.Count > 0)
{
PlayerGUIIconList.RemoveAll((Transform item) => (Object)(object)item == (Object)null);
}
}
if (MinimapPlugin.DimensionMapsInstalled)
{
Transform transform3 = MonkeyMapPageInstance.m_mapMover.transform;
int childCount3 = transform3.childCount;
for (int k = 0; k < childCount3; k++)
{
if (!CustomExtensions.ContainsIgnoreCase(((Object)((Component)transform3.GetChild(k)).gameObject).name, "Reality") && !CustomExtensions.ContainsIgnoreCase(((Object)((Component)transform3.GetChild(k)).gameObject).name, "Dimension"))
{
continue;
}
foreach (SpriteRenderer componentsInChild in ((Component)transform3.GetChild(k)).GetComponentsInChildren<SpriteRenderer>(true))
{
_mapHolderAllObjects.Add(((Component)componentsInChild).gameObject);
}
foreach (TextMeshPro componentsInChild2 in ((Component)transform3.GetChild(k)).GetComponentsInChildren<TextMeshPro>(true))
{
_mapHolderAllObjects.Add(((Component)componentsInChild2).gameObject);
}
}
foreach (SpriteRenderer componentsInChild3 in CM_PageMap.m_mapMoverElementsRoot.GetComponentsInChildren<SpriteRenderer>(true))
{
_mapHolderAllObjects.Add(((Component)componentsInChild3).gameObject);
}
foreach (TextMeshPro componentsInChild4 in CM_PageMap.m_mapMoverElementsRoot.GetComponentsInChildren<TextMeshPro>(true))
{
_mapHolderAllObjects.Add(((Component)componentsInChild4).gameObject);
}
}
else
{
foreach (SpriteRenderer componentsInChild5 in CM_PageMap.m_mapMoverElementsRoot.GetComponentsInChildren<SpriteRenderer>(true))
{
_mapHolderAllObjects.Add(((Component)componentsInChild5).gameObject);
}
foreach (TextMeshPro componentsInChild6 in CM_PageMap.m_mapMoverElementsRoot.GetComponentsInChildren<TextMeshPro>(true))
{
_mapHolderAllObjects.Add(((Component)componentsInChild6).gameObject);
}
}
for (int l = 0; l < transform.childCount; l++)
{
if (CustomExtensions.ContainsIgnoreCase(((Object)((Component)transform.GetChild(l)).gameObject).name, "MapDetailsUI"))
{
_mapHolderAllObjects.Add(((Component)transform.GetChild(l).GetChild(0)).gameObject);
}
}
int count2 = _mapHolderAllObjects.Count;
foreach (CM_SyncedGUIItem componentsInChild7 in MonkeyMapPageInstance.m_mapMover.GetComponentsInChildren<CM_SyncedGUIItem>(true))
{
if (CustomExtensions.ContainsIgnoreCase(((Object)((Component)componentsInChild7).gameObject).name, "MapResource"))
{
Transform transform4 = ((Component)componentsInChild7).transform;
int childCount4 = transform4.childCount;
for (int m = 0; m < childCount4; m++)
{
Transform child = transform4.GetChild(m);
if (CustomExtensions.ContainsIgnoreCase(((Object)child).name, "Secure"))
{
foreach (SpriteRenderer SecureDoor3 in ((Component)child).gameObject.GetComponentsInChildren<SpriteRenderer>(true))
{
GameObject item2 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)SecureDoor3).gameObject);
_mapHolderAllObjects.Remove(item2);
}
}
foreach (TextMeshPro SecureDoor4 in ((Component)child).gameObject.GetComponentsInChildren<TextMeshPro>(true))
{
GameObject item3 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)SecureDoor4).gameObject);
_mapHolderAllObjects.Remove(item3);
}
}
}
else
{
if ((Object)(object)componentsInChild7 == (Object)null || (Object)(object)componentsInChild7.m_gfxSecureApex == (Object)null)
{
continue;
}
bool flag2 = (Object)(object)CustomExtensions.GetComponentInParents<LG_WeakDoor>(componentsInChild7.RevealerBase) != (Object)null;
if (flag2)
{
Transform transform5 = ((Component)componentsInChild7).transform;
int childCount5 = transform5.childCount;
for (int n = 0; n < childCount5; n++)
{
Transform child2 = transform5.GetChild(n);
if (!CustomExtensions.ContainsIgnoreCase(((Object)child2).name, "Secure") && !CustomExtensions.ContainsIgnoreCase(((Object)child2).name, "Bulkhead"))
{
continue;
}
foreach (SpriteRenderer SecureDoor5 in ((Component)child2).gameObject.GetComponentsInChildren<SpriteRenderer>(true))
{
GameObject item4 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)SecureDoor5).gameObject);
_mapHolderAllObjects.Remove(item4);
}
foreach (TextMeshPro SecureDoor6 in ((Component)child2).gameObject.GetComponentsInChildren<TextMeshPro>(true))
{
GameObject item5 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)SecureDoor6).gameObject);
_mapHolderAllObjects.Remove(item5);
}
}
continue;
}
LG_SecurityDoor componentInParents = CustomExtensions.GetComponentInParents<LG_SecurityDoor>(componentsInChild7.RevealerBase);
if (flag2 || !((Object)(object)componentInParents != (Object)null))
{
continue;
}
Transform transform6 = ((Component)componentsInChild7).transform;
int childCount6 = transform6.childCount;
for (int num2 = 0; num2 < childCount6; num2++)
{
Transform child3 = transform6.GetChild(num2);
if (!CustomExtensions.ContainsIgnoreCase(((Object)child3).name, "Weak"))
{
continue;
}
foreach (SpriteRenderer SecureDoor7 in ((Component)child3).gameObject.GetComponentsInChildren<SpriteRenderer>(true))
{
GameObject item6 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)SecureDoor7).gameObject);
_mapHolderAllObjects.Remove(item6);
}
foreach (TextMeshPro SecureDoor2 in ((Component)child3).gameObject.GetComponentsInChildren<TextMeshPro>(true))
{
GameObject item7 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)SecureDoor2).gameObject);
_mapHolderAllObjects.Remove(item7);
}
}
if (!((Component)componentInParents).gameObject.GetComponent<LG_SecurityDoor_Locks>().m_hasAlarm)
{
foreach (SpriteRenderer door in componentsInChild7.m_gfxSecureApex.GetComponentsInChildren<SpriteRenderer>())
{
GameObject item8 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)door).gameObject);
_mapHolderAllObjects.Remove(item8);
}
foreach (TextMeshPro text in componentsInChild7.m_gfxSecureApex.GetComponentsInChildren<TextMeshPro>())
{
GameObject item9 = _mapHolderAllObjects.Find((GameObject taco) => (Object)(object)taco == (Object)(object)((Component)text).gameObject);
_mapHolderAllObjects.Remove(item9);
}
}
if ((int)componentInParents.m_securityDoorType == 2)
{
continue;
}
for (int num3 = 0; num3 < childCount6; num3++)
{
Transform child4 = transform6.GetChild(num3);
if (!CustomExtensions.ContainsIgnoreCase(((Object)child4).name, "Bulkhead"))
{
continue;
}
foreach (SpriteRenderer SecureDoor in ((Component)child4).gameObject.GetComponentsInChildren<SpriteRendere