using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Agents;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using Enemies;
using GameData;
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 Player;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BiotrackerMapMarkers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BiotrackerMapMarkers")]
[assembly: AssemblyTitle("BiotrackerMapMarkers")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BiotrackerMapMarkers;
public class EnemyBlipConfig
{
public ConfigEntry<string> BlipColor;
public ConfigEntry<bool> ShowOutline;
public ConfigEntry<string> OutlineColor;
}
[BepInPlugin("biotrackermapmarkers.HazardousMonkey", "BiotrackerMapMarkers", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class EnemyBlipPlugin : BasePlugin
{
private readonly struct EnemyDef
{
public readonly string Name;
public readonly bool DefaultOutline;
public readonly string DefaultOutlineColor;
public readonly string DefaultColor;
public readonly string TypeNote;
public EnemyDef(string name, bool outline, string outlineColor, string color, string typeNote)
{
Name = name;
DefaultOutline = outline;
DefaultOutlineColor = outlineColor;
DefaultColor = color;
TypeNote = typeNote;
}
}
public static ConfigEntry<bool> ShowEnemyBlips;
public static ConfigEntry<float> EnemyBlipScaleMap;
public static ConfigEntry<float> EnemyBlipScaleMinimap;
public static ConfigEntry<float> EnemyBlipOutlineThickness;
public static ConfigEntry<bool> DebugDumpEnemyTypes;
public static ConfigEntry<string> EnemyBlipColorDefault;
public static ConfigEntry<bool> FallbackShowOutlineWeakling;
public static ConfigEntry<string> FallbackOutlineWeakling;
public static ConfigEntry<string> FallbackBodyWeakling;
public static ConfigEntry<bool> FallbackShowOutlineStandard;
public static ConfigEntry<string> FallbackOutlineStandard;
public static ConfigEntry<string> FallbackBodyStandard;
public static ConfigEntry<bool> FallbackShowOutlineSpecial;
public static ConfigEntry<string> FallbackOutlineSpecial;
public static ConfigEntry<string> FallbackBodySpecial;
public static ConfigEntry<bool> FallbackShowOutlineMiniBoss;
public static ConfigEntry<string> FallbackOutlineMiniBoss;
public static ConfigEntry<string> FallbackBodyMiniBoss;
public static ConfigEntry<bool> FallbackShowOutlineBoss;
public static ConfigEntry<string> FallbackOutlineBoss;
public static ConfigEntry<string> FallbackBodyBoss;
public static readonly Dictionary<string, EnemyBlipConfig> EnemyConfigs = new Dictionary<string, EnemyBlipConfig>(64);
private static readonly (string Section, EnemyDef[] Enemies)[] EnemyGroups = new(string, EnemyDef[])[9]
{
("Blips - Striker", new EnemyDef[15]
{
new EnemyDef("Striker_Child", outline: false, "#ff0000", "#ffff96", "Standard"),
new EnemyDef("Striker_Child_Nightmare", outline: false, "#ff0000", "#ffff96", "Standard"),
new EnemyDef("Striker_Hibernate", outline: false, "#ff0000", "#ffff00", "Standard"),
new EnemyDef("Striker_Wave", outline: false, "#ff0000", "#ffff00", "Standard"),
new EnemyDef("Striker_Wave_Fast", outline: false, "#ff0000", "#ffff00", "Standard"),
new EnemyDef("Striker_Patrol", outline: false, "#ff0000", "#ffff00", "Standard"),
new EnemyDef("Striker_Berserk", outline: false, "#ff0000", "#ffff00", "Standard"),
new EnemyDef("Striker_Bullrush", outline: false, "#ff0000", "#ffff00", "Standard"),
new EnemyDef("Shadow", outline: true, "#ffff00", "#9600ff", "Weakling"),
new EnemyDef("Striker_Big_Shadow", outline: true, "#ff0000", "#9600ff", "MiniBoss"),
new EnemyDef("Striker_Big_Hibernate", outline: true, "#ff0000", "#ffff00", "MiniBoss"),
new EnemyDef("Striker_Big_Wave", outline: true, "#ff0000", "#ffff00", "MiniBoss"),
new EnemyDef("Striker_Big_nightmare", outline: true, "#ff0000", "#ffff00", "MiniBoss"),
new EnemyDef("Striker_Big_Bullrush", outline: true, "#ff0000", "#ffff00", "MiniBoss"),
new EnemyDef("Striker_Boss", outline: true, "#ff0000", "#ffff00", "Boss")
}),
("Blips - Shooter", new EnemyDef[6]
{
new EnemyDef("Shooter_Hibernate", outline: false, "#ff0000", "#00ffff", "Special"),
new EnemyDef("Shooter_Wave", outline: false, "#ff0000", "#00ffff", "Special"),
new EnemyDef("Shooter_Spread", outline: false, "#ff0000", "#00ffff", "Special"),
new EnemyDef("Shooter_Big", outline: true, "#ff0000", "#00ffff", "Boss"),
new EnemyDef("Shooter_Big_RapidFire", outline: true, "#ff0000", "#00ffff", "Boss"),
new EnemyDef("Shooter_Big_Infection", outline: true, "#ff0000", "#00ffff", "Boss")
}),
("Blips - Scout", new EnemyDef[5]
{
new EnemyDef("Scout", outline: true, "#ffffff", "#0064ff", "Special"),
new EnemyDef("Scout_nightmare", outline: true, "#ff0000", "#0064ff", "Special"),
new EnemyDef("Scout_zoomer", outline: true, "#00ff96", "#0064ff", "Special"),
new EnemyDef("Scout_Bullrush", outline: true, "#ff0000", "#0064ff", "Special"),
new EnemyDef("Scout_Shadow", outline: true, "#0064ff", "#9600ff", "Special")
}),
("Blips - Birther", new EnemyDef[3]
{
new EnemyDef("Birther", outline: true, "#ffff96", "#ff00ff", "Boss"),
new EnemyDef("Birther_Boss", outline: true, "#ffff96", "#ff00ff", "Boss"),
new EnemyDef("MegaMother", outline: true, "#ff0000", "#ff00ff", "Boss")
}),
("Blips - Tank", new EnemyDef[2]
{
new EnemyDef("Tank", outline: true, "#ffffff", "#ff0000", "MiniBoss"),
new EnemyDef("Tank_Boss", outline: true, "#ffffff", "#ff0000", "MiniBoss")
}),
("Blips - Flyer", new EnemyDef[2]
{
new EnemyDef("Flyer", outline: true, "#00ff96", "#d2006e", "Standard"),
new EnemyDef("Flyer_Big", outline: true, "#ff0000", "#d2006e", "Standard")
}),
("Blips - Cocoon", new EnemyDef[1]
{
new EnemyDef("Cocoon", outline: false, "#888888", "#aaaaaa", "Standard")
}),
("Blips - Squid", new EnemyDef[4]
{
new EnemyDef("Squidward", outline: true, "#960000", "#ff0000", "Boss"),
new EnemyDef("SquidBoss_Big", outline: true, "#960000", "#ff0000", "Boss"),
new EnemyDef("SquidBoss_Big_Complex", outline: true, "#960000", "#ff0000", "Boss"),
new EnemyDef("SquidBoss_VS", outline: true, "#960000", "#ff0000", "Boss")
}),
("Blips - Pouncer", new EnemyDef[1]
{
new EnemyDef("Pouncer", outline: true, "#ff0000", "#00ff96", "Standard")
})
};
public const int UILayer = 5;
public const int MinimapLayer = 31;
public static EnemyBlipPlugin Instance { get; private set; }
public static bool MinimapModInstalled { get; private set; }
public override void Load()
{
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
MinimapModInstalled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("minimap.HazardousMonkey");
((BasePlugin)this).Log.LogInfo((object)("[BiotrackerMapMarkers] MinimapMod: " + (MinimapModInstalled ? "detected" : "not found") + "."));
ShowEnemyBlips = ((BasePlugin)this).Config.Bind<bool>("- General", "ShowEnemyBlips", true, "Show enemy positions as colored dots on the map. Only tagged enemies are shown.");
EnemyBlipScaleMap = ((BasePlugin)this).Config.Bind<float>("- General", "BlipScaleMap", 25f, "Size multiplier for enemy blip dots on the fullscreen map. 1 unit is one pixel?");
EnemyBlipScaleMinimap = ((BasePlugin)this).Config.Bind<float>("- General", "BlipScaleMinimap", 40f, "Size multiplier for enemy blip dots on the minimap. 1 unit is one pixel? (MinimapMod only)");
EnemyBlipOutlineThickness = ((BasePlugin)this).Config.Bind<float>("- General", "OutlineThickness", 0.4f, "Scale factor added to the body for the outline ring. 0.4 = outline is 130% of body size. Applies only to enemies that have ShowOutline enabled; all others use a transparent outline.");
(string, EnemyDef[])[] enemyGroups = EnemyGroups;
for (int i = 0; i < enemyGroups.Length; i++)
{
(string, EnemyDef[]) tuple = enemyGroups[i];
string item = tuple.Item1;
EnemyDef[] item2 = tuple.Item2;
for (int j = 0; j < item2.Length; j++)
{
EnemyDef enemyDef = item2[j];
EnemyBlipConfig enemyBlipConfig = new EnemyBlipConfig();
enemyBlipConfig.ShowOutline = ((BasePlugin)this).Config.Bind<bool>(item, enemyDef.Name + " --- Show Outline?", enemyDef.DefaultOutline, $"Show outline ring behind the blip for {enemyDef.Name} ({enemyDef.TypeNote}).");
enemyBlipConfig.OutlineColor = ((BasePlugin)this).Config.Bind<string>(item, "Outline Color ► " + enemyDef.Name, enemyDef.DefaultOutlineColor, $"Outline ring color for {enemyDef.Name} ({enemyDef.TypeNote}). Only visible when {enemyDef.Name}_ShowOutline is true. #rrggbb");
enemyBlipConfig.BlipColor = ((BasePlugin)this).Config.Bind<string>(item, "Base Colorㅤ ► " + enemyDef.Name, enemyDef.DefaultColor, $"Blip fill color for {enemyDef.Name} ({enemyDef.TypeNote}). #rrggbb");
EnemyConfigs[enemyDef.Name] = enemyBlipConfig;
}
}
DebugDumpEnemyTypes = ((BasePlugin)this).Config.Bind<bool>("Debug", "DumpEnemyTypes", false, "When true, logs a full catalog of every EnemyDataBlock (static) and every unique enemy type seen at runtime to the BepInEx console. Used to build an enemy catalog, and may be of use in the future if I support modded enemies");
EnemyBlipColorDefault = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "-- Absolute Fallback --", "#ff0000", "Fallback blip color for any enemy that falls through ALL name/type checks. Applies to modded enemies if anything. (#rrggbb).");
FallbackShowOutlineWeakling = ((BasePlugin)this).Config.Bind<bool>("Blips - Unknown Enemy Fallbacks", "Show Outline -- Weakling", false, "Show outline ring for unrecognized Weakling-tier enemies.");
FallbackOutlineWeakling = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Outline Color ► Weakling", "#ffffff", "Outline color for unrecognized Weakling-tier enemies. #rrggbb");
FallbackBodyWeakling = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Body Color ► Weakling", "#ffff00", "Body color for unrecognized Weakling-tier enemies. #rrggbb");
FallbackShowOutlineStandard = ((BasePlugin)this).Config.Bind<bool>("Blips - Unknown Enemy Fallbacks", "Show Outline -- Standard", false, "Show outline ring for unrecognized Standard-tier enemies.");
FallbackOutlineStandard = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Outline Color ► Standard", "#ffffff", "Outline color for unrecognized Standard-tier enemies. #rrggbb");
FallbackBodyStandard = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Body Color ► Standard", "#00ffff", "Body color for unrecognized Standard-tier enemies. #rrggbb");
FallbackShowOutlineSpecial = ((BasePlugin)this).Config.Bind<bool>("Blips - Unknown Enemy Fallbacks", "Show Outline -- Special", true, "Show outline ring for unrecognized Special-tier enemies.");
FallbackOutlineSpecial = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Outline Color ► Special", "#ffffff", "Outline color for unrecognized Special-tier enemies. #rrggbb");
FallbackBodySpecial = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Body Color ► Special", "#0064ff", "Body color for unrecognized Special-tier enemies. #rrggbb");
FallbackShowOutlineMiniBoss = ((BasePlugin)this).Config.Bind<bool>("Blips - Unknown Enemy Fallbacks", "Show Outline -- MiniBoss", true, "Show outline ring for unrecognized MiniBoss-tier enemies.");
FallbackOutlineMiniBoss = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Outline Color ► MiniBoss", "#ff0000", "Outline color for unrecognized MiniBoss-tier enemies. #rrggbb");
FallbackBodyMiniBoss = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Body Color ► MiniBoss", "#00ffff", "Body color for unrecognized MiniBoss-tier enemies. #rrggbb");
FallbackShowOutlineBoss = ((BasePlugin)this).Config.Bind<bool>("Blips - Unknown Enemy Fallbacks", "Show Outline -- Boss", true, "Show outline ring for unrecognized Boss-tier enemies.");
FallbackOutlineBoss = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Outline Color ► Boss", "#ff0000", "Outline color for unrecognized Boss-tier enemies. #rrggbb");
FallbackBodyBoss = ((BasePlugin)this).Config.Bind<string>("Blips - Unknown Enemy Fallbacks", "Body Color ► Boss", "#ffff00", "Body color for unrecognized Boss-tier enemies. #rrggbb");
ClassInjector.RegisterTypeInIl2Cpp<EnemyBlipUpdater>();
new Harmony("biotrackermapmarkers.HazardousMonkey").PatchAll();
((BasePlugin)this).Log.LogInfo((object)"[BiotrackerMapMarkers] Loaded.");
}
}
public static class EnemyBlipAPI
{
public static bool IsInitialized => EnemyBlipManager.Initialized;
public static void SetLayer(int layer)
{
EnemyBlipManager.SetLayer(layer);
}
public static void SetVisible(bool visible)
{
EnemyBlipManager.SetVisible(visible);
}
}
public class EnemyBlipUpdater : MonoBehaviour
{
private float _nextConfigPollTime;
private DateTime _lastConfigWriteTime;
private bool _configTimeInitialized;
private const float CONFIG_POLL_INTERVAL = 1f;
public EnemyBlipUpdater(IntPtr p)
: base(p)
{
}
private void Update()
{
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Invalid comparison between Unknown and I4
if (Time.time >= _nextConfigPollTime)
{
_nextConfigPollTime = Time.time + 1f;
try
{
DateTime lastWriteTime = File.GetLastWriteTime(((BasePlugin)EnemyBlipPlugin.Instance).Config.ConfigFilePath);
if (!_configTimeInitialized)
{
_lastConfigWriteTime = lastWriteTime;
_configTimeInitialized = true;
}
else if (lastWriteTime != _lastConfigWriteTime)
{
_lastConfigWriteTime = lastWriteTime;
((BasePlugin)EnemyBlipPlugin.Instance).Config.Reload();
EnemyBlipManager.LiveConfigTick();
}
}
catch (Exception ex)
{
Debug.LogWarning(Object.op_Implicit("[BiotrackerMapMarkers] Config poll failed: " + ex.Message));
}
}
if (!EnemyBlipManager.Initialized)
{
try
{
if ((Object)(object)CM_PageMap.Current != (Object)null && ((Il2CppObjectBase)CM_PageMap.Current).Pointer != IntPtr.Zero && (Object)(object)CM_PageMap.GUIRef != (Object)null && ((Il2CppObjectBase)CM_PageMap.GUIRef).Pointer != IntPtr.Zero && (int)GameStateManager.CurrentStateName >= 8)
{
EnemyBlipManager.TryInit();
}
return;
}
catch (Exception ex2)
{
Debug.LogWarning(Object.op_Implicit("[BiotrackerMapMarkers] Init gate failed: " + ex2.Message));
return;
}
}
try
{
EnemyBlipManager.Tick();
}
catch (Exception value)
{
Debug.LogWarning(Object.op_Implicit($"[BiotrackerMapMarkers] Unhandled exception in Tick: {value}"));
}
}
}
public static class EnemyBlipManager
{
private sealed class BlipSlot
{
public GameObject go;
public SpriteRenderer sr;
public GameObject outlineGo;
public SpriteRenderer outlineSr;
public EnemyAgent agent;
public eEnemyType cachedEnemyType;
public string cachedEnemyName;
public bool colorAssigned;
public bool lastActive;
public Vector3 lastMapPos;
public bool inTaggedList;
public int activeListPos;
public int taggedListPos;
public int untrackedListPos;
public IntPtr agentTransformPtr;
}
private readonly struct CachedEnemyStyle
{
public readonly Color Body;
public readonly bool ShowOutline;
public readonly Color Outline;
public CachedEnemyStyle(Color body, bool showOutline, Color outline)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Body = body;
ShowOutline = showOutline;
Outline = outline;
}
}
private static Transform _mapMoverElements;
private static Sprite _blipSprite;
private static readonly List<BlipSlot> _pool = new List<BlipSlot>(128);
private static readonly Stack<int> _freeIndices = new Stack<int>(128);
private static readonly Dictionary<IntPtr, int> _agentToSlot = new Dictionary<IntPtr, int>(128);
private static readonly List<int> _activeIndices = new List<int>(128);
private static readonly List<int> _taggedIndices = new List<int>(16);
private static readonly List<int> _untrackedIndices = new List<int>(128);
private static readonly HashSet<IntPtr> _trackedTransformPtrs = new HashSet<IntPtr>(128);
private static float _nextScanTime = 0f;
private const float SCAN_INTERVAL = 0.5f;
private static float _nextTagScanTime = 0f;
private const float TAG_SCAN_INTERVAL = 0.1f;
private static Transform _cachedAllocRoot;
private static bool _tagEventPending = false;
private static float _nextSpritePollTime = 0f;
private const float SPRITE_POLL_INTERVAL = 1f;
private static bool _cfgShow;
private static float _cfgScaleMap;
private static float _cfgScaleMinimap;
private static float _cfgOutlineThickness;
private static bool _cfgDebugDump;
private static Color _cfgColorDefault;
private static bool _cfgFallbackShowOutlineWeakling;
private static Color _cfgFallbackOutlineWeakling;
private static Color _cfgFallbackBodyWeakling;
private static bool _cfgFallbackShowOutlineStandard;
private static Color _cfgFallbackOutlineStandard;
private static Color _cfgFallbackBodyStandard;
private static bool _cfgFallbackShowOutlineSpecial;
private static Color _cfgFallbackOutlineSpecial;
private static Color _cfgFallbackBodySpecial;
private static bool _cfgFallbackShowOutlineMiniBoss;
private static Color _cfgFallbackOutlineMiniBoss;
private static Color _cfgFallbackBodyMiniBoss;
private static bool _cfgFallbackShowOutlineBoss;
private static Color _cfgFallbackOutlineBoss;
private static Color _cfgFallbackBodyBoss;
private static bool _wasFullMapOpen = false;
private static readonly Dictionary<string, CachedEnemyStyle> _cachedStyles = new Dictionary<string, CachedEnemyStyle>(64);
private static readonly Dictionary<uint, string> _dataIdToName = new Dictionary<uint, string>(64);
private static readonly HashSet<uint> _debugSeenDataIDs = new HashSet<uint>();
private const float BLIP_Z = 0.05f;
private static Func<bool> _minimapIsFullMapOpenGetter;
private static bool _minimapBridgeAttempted;
public static bool Initialized { get; private set; }
public static void TryInit()
{
try
{
Transform gUIRef = CM_PageMap.GUIRef;
if (!((Object)(object)gUIRef == (Object)null) && !(((Il2CppObjectBase)gUIRef).Pointer == IntPtr.Zero))
{
Init(gUIRef);
}
}
catch (Exception ex)
{
Debug.LogWarning(Object.op_Implicit("[BiotrackerMapMarkers] TryInit failed: " + ex.Message));
}
}
public static void Init(Transform mapMoverElements)
{
HardReset();
_mapMoverElements = mapMoverElements;
_blipSprite = CreateBlipSprite(32);
BuildDataIdLookup();
CacheConfig();
Initialized = true;
_nextScanTime = 0f;
_nextTagScanTime = 0f;
_nextSpritePollTime = 0f;
Debug.Log(Object.op_Implicit("[BiotrackerMapMarkers] EnemyBlipManager initialized."));
if (_cfgDebugDump)
{
DumpEnemyDataBlocks();
}
}
public static void Cleanup()
{
HardReset();
Initialized = false;
_wasFullMapOpen = false;
}
private static void HardReset()
{
foreach (BlipSlot item in _pool)
{
if ((Object)(object)item.go != (Object)null && ((Il2CppObjectBase)item.go).Pointer != IntPtr.Zero)
{
Object.Destroy((Object)(object)item.go);
}
}
_pool.Clear();
_freeIndices.Clear();
_agentToSlot.Clear();
_activeIndices.Clear();
_taggedIndices.Clear();
_untrackedIndices.Clear();
_trackedTransformPtrs.Clear();
_debugSeenDataIDs.Clear();
_tagEventPending = false;
_nextSpritePollTime = 0f;
_mapMoverElements = null;
_blipSprite = null;
_cachedAllocRoot = null;
}
private static void CacheConfig()
{
//IL_0064: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
_cfgShow = EnemyBlipPlugin.ShowEnemyBlips.Value;
_cfgScaleMap = EnemyBlipPlugin.EnemyBlipScaleMap.Value;
_cfgScaleMinimap = EnemyBlipPlugin.EnemyBlipScaleMinimap.Value;
_cfgOutlineThickness = EnemyBlipPlugin.EnemyBlipOutlineThickness.Value;
_cfgDebugDump = EnemyBlipPlugin.DebugDumpEnemyTypes.Value;
_cfgColorDefault = ParseColor(EnemyBlipPlugin.EnemyBlipColorDefault.Value, new Color(0.67f, 0.67f, 0.67f), "ColorDefault");
_cachedStyles.Clear();
foreach (KeyValuePair<string, EnemyBlipConfig> enemyConfig in EnemyBlipPlugin.EnemyConfigs)
{
EnemyBlipConfig value = enemyConfig.Value;
Color body = ParseColor(value.BlipColor.Value, Color.white, enemyConfig.Key + "_Color");
Color outline = ParseColor(value.OutlineColor.Value, Color.clear, enemyConfig.Key + "_OutlineColor");
_cachedStyles[enemyConfig.Key] = new CachedEnemyStyle(body, value.ShowOutline.Value, outline);
}
CacheFallbackColors();
Debug.Log(Object.op_Implicit($"[BiotrackerMapMarkers] CacheConfig: {_cachedStyles.Count} per-enemy styles loaded."));
}
private static void CacheFallbackColors()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: 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_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: 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)
_cfgFallbackShowOutlineWeakling = EnemyBlipPlugin.FallbackShowOutlineWeakling.Value;
_cfgFallbackOutlineWeakling = ParseColor(EnemyBlipPlugin.FallbackOutlineWeakling.Value, new Color(1f, 1f, 1f), "FallbackOutlineWeakling");
_cfgFallbackBodyWeakling = ParseColor(EnemyBlipPlugin.FallbackBodyWeakling.Value, new Color(1f, 1f, 0f), "FallbackBodyWeakling");
_cfgFallbackShowOutlineStandard = EnemyBlipPlugin.FallbackShowOutlineStandard.Value;
_cfgFallbackOutlineStandard = ParseColor(EnemyBlipPlugin.FallbackOutlineStandard.Value, new Color(1f, 1f, 1f), "FallbackOutlineStandard");
_cfgFallbackBodyStandard = ParseColor(EnemyBlipPlugin.FallbackBodyStandard.Value, new Color(0f, 1f, 1f), "FallbackBodyStandard");
_cfgFallbackShowOutlineSpecial = EnemyBlipPlugin.FallbackShowOutlineSpecial.Value;
_cfgFallbackOutlineSpecial = ParseColor(EnemyBlipPlugin.FallbackOutlineSpecial.Value, new Color(1f, 1f, 1f), "FallbackOutlineSpecial");
_cfgFallbackBodySpecial = ParseColor(EnemyBlipPlugin.FallbackBodySpecial.Value, new Color(0f, 0.392f, 1f), "FallbackBodySpecial");
_cfgFallbackShowOutlineMiniBoss = EnemyBlipPlugin.FallbackShowOutlineMiniBoss.Value;
_cfgFallbackOutlineMiniBoss = ParseColor(EnemyBlipPlugin.FallbackOutlineMiniBoss.Value, new Color(1f, 0f, 0f), "FallbackOutlineMiniBoss");
_cfgFallbackBodyMiniBoss = ParseColor(EnemyBlipPlugin.FallbackBodyMiniBoss.Value, new Color(0f, 1f, 1f), "FallbackBodyMiniBoss");
_cfgFallbackShowOutlineBoss = EnemyBlipPlugin.FallbackShowOutlineBoss.Value;
_cfgFallbackOutlineBoss = ParseColor(EnemyBlipPlugin.FallbackOutlineBoss.Value, new Color(1f, 0f, 0f), "FallbackOutlineBoss");
_cfgFallbackBodyBoss = ParseColor(EnemyBlipPlugin.FallbackBodyBoss.Value, new Color(1f, 1f, 0f), "FallbackBodyBoss");
}
public static void LiveConfigTick()
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: 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_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
if (!Initialized)
{
return;
}
bool cfgShow = _cfgShow;
float cfgScaleMap = _cfgScaleMap;
float cfgScaleMinimap = _cfgScaleMinimap;
float cfgOutlineThickness = _cfgOutlineThickness;
_cfgShow = EnemyBlipPlugin.ShowEnemyBlips.Value;
_cfgScaleMap = EnemyBlipPlugin.EnemyBlipScaleMap.Value;
_cfgScaleMinimap = EnemyBlipPlugin.EnemyBlipScaleMinimap.Value;
_cfgOutlineThickness = EnemyBlipPlugin.EnemyBlipOutlineThickness.Value;
_cfgColorDefault = ParseColor(EnemyBlipPlugin.EnemyBlipColorDefault.Value, new Color(0.67f, 0.67f, 0.67f), "ColorDefault");
_cachedStyles.Clear();
foreach (KeyValuePair<string, EnemyBlipConfig> enemyConfig in EnemyBlipPlugin.EnemyConfigs)
{
EnemyBlipConfig value = enemyConfig.Value;
Color body = ParseColor(value.BlipColor.Value, Color.white, enemyConfig.Key + "_Color");
Color outline = ParseColor(value.OutlineColor.Value, Color.clear, enemyConfig.Key + "_OutlineColor");
_cachedStyles[enemyConfig.Key] = new CachedEnemyStyle(body, value.ShowOutline.Value, outline);
}
CacheFallbackColors();
Debug.Log(Object.op_Implicit($"[BiotrackerMapMarkers] LiveConfigTick: {_cachedStyles.Count} styles rebuilt, {_taggedIndices.Count} tagged slot(s) updated."));
if (_cfgShow != cfgShow)
{
SetVisible(_wasFullMapOpen || EnemyBlipPlugin.MinimapModInstalled);
}
if (_wasFullMapOpen && _cfgScaleMap != cfgScaleMap)
{
ApplyScale(_cfgScaleMap);
}
else if (!_wasFullMapOpen && EnemyBlipPlugin.MinimapModInstalled && _cfgScaleMinimap != cfgScaleMinimap)
{
ApplyScale(_cfgScaleMinimap);
}
if (_cfgOutlineThickness != cfgOutlineThickness)
{
Vector3 localScale = Vector3.one * (1f + _cfgOutlineThickness);
for (int i = 0; i < _pool.Count; i++)
{
BlipSlot blipSlot = _pool[i];
if ((Object)(object)blipSlot.outlineGo != (Object)null && ((Il2CppObjectBase)blipSlot.outlineGo).Pointer != IntPtr.Zero)
{
blipSlot.outlineGo.transform.localScale = localScale;
}
}
}
for (int j = 0; j < _taggedIndices.Count; j++)
{
BlipSlot blipSlot2 = _pool[_taggedIndices[j]];
if (!((Object)(object)blipSlot2.agent == (Object)null) && !(((Il2CppObjectBase)blipSlot2.agent).Pointer == IntPtr.Zero) && !((Object)(object)blipSlot2.go == (Object)null) && !(((Il2CppObjectBase)blipSlot2.go).Pointer == IntPtr.Zero))
{
blipSlot2.sr.color = GetBodyColor(blipSlot2);
blipSlot2.outlineSr.color = GetOutlineColor(blipSlot2);
blipSlot2.colorAssigned = true;
}
}
for (int k = 0; k < _untrackedIndices.Count; k++)
{
_pool[_untrackedIndices[k]].colorAssigned = false;
}
}
private static void BuildDataIdLookup()
{
_dataIdToName.Clear();
try
{
foreach (EnemyDataBlock allBlock in GameDataBlockBase<EnemyDataBlock>.GetAllBlocks())
{
_dataIdToName[((GameDataBlockBase<EnemyDataBlock>)(object)allBlock).persistentID] = ((GameDataBlockBase<EnemyDataBlock>)(object)allBlock).name;
}
Debug.Log(Object.op_Implicit($"[BiotrackerMapMarkers] DataID lookup built: {_dataIdToName.Count} entries."));
}
catch (Exception ex)
{
Debug.LogWarning(Object.op_Implicit("[BiotrackerMapMarkers] BuildDataIdLookup failed: " + ex.Message));
}
}
public static void SignalTagEvent()
{
_tagEventPending = true;
}
public static void Tick()
{
if (!Initialized || !_cfgShow || (Object)(object)_mapMoverElements == (Object)null || ((Il2CppObjectBase)_mapMoverElements).Pointer == IntPtr.Zero)
{
return;
}
EnsureBlipSprite();
if ((Object)(object)_cachedAllocRoot == (Object)null || ((Il2CppObjectBase)_cachedAllocRoot).Pointer == IntPtr.Zero)
{
_cachedAllocRoot = EnemyAllocator.RootObj;
}
if ((Object)(object)_cachedAllocRoot == (Object)null)
{
return;
}
bool flag = IsFullMapOpen();
if (flag != _wasFullMapOpen)
{
_wasFullMapOpen = flag;
if (flag)
{
SetLayer(5);
ApplyScale(_cfgScaleMap);
SetVisible(visible: true);
}
else if (EnemyBlipPlugin.MinimapModInstalled)
{
SetLayer(31);
ApplyScale(_cfgScaleMinimap);
}
else
{
SetVisible(visible: false);
}
}
if (Time.time >= _nextTagScanTime)
{
_nextTagScanTime = Time.time + 0.1f;
PromoteTagged();
}
if (Time.time >= _nextScanTime)
{
_nextScanTime = Time.time + 0.5f;
Transform rootObj = EnemyAllocator.RootObj;
if ((Object)(object)rootObj != (Object)null)
{
_cachedAllocRoot = rootObj;
}
SyncPool(_cachedAllocRoot);
}
UpdateBlips();
}
private static bool IsFullMapOpen()
{
if (EnemyBlipPlugin.MinimapModInstalled)
{
if (!_minimapBridgeAttempted)
{
_minimapBridgeAttempted = true;
try
{
Type type = Type.GetType("MinimapMod.MinimapManager, MinimapMod");
if (type != null)
{
PropertyInfo property = type.GetProperty("IsFullMapOpen", BindingFlags.Static | BindingFlags.Public);
if (property != null)
{
_minimapIsFullMapOpenGetter = (Func<bool>)Delegate.CreateDelegate(typeof(Func<bool>), property.GetGetMethod());
}
}
}
catch
{
}
Debug.Log(Object.op_Implicit("[BiotrackerMapMarkers] IsFullMapOpen bridge: " + ((_minimapIsFullMapOpenGetter != null) ? "delegate cached." : "fallback to activeInHierarchy.")));
}
if (_minimapIsFullMapOpenGetter != null)
{
try
{
return _minimapIsFullMapOpenGetter();
}
catch
{
}
}
}
try
{
CM_PageMap current = CM_PageMap.Current;
return (Object)(object)current != (Object)null && ((Il2CppObjectBase)current).Pointer != IntPtr.Zero && ((Component)current).gameObject.activeInHierarchy;
}
catch
{
return false;
}
}
public static void SetVisible(bool visible)
{
bool flag = visible && _cfgShow;
for (int i = 0; i < _activeIndices.Count; i++)
{
BlipSlot blipSlot = _pool[_activeIndices[i]];
if (!((Object)(object)blipSlot.go == (Object)null) && !(((Il2CppObjectBase)blipSlot.go).Pointer == IntPtr.Zero) && !((Object)(object)blipSlot.agent == (Object)null) && !(((Il2CppObjectBase)blipSlot.agent).Pointer == IntPtr.Zero))
{
bool flag2 = flag && blipSlot.agent.m_alive && blipSlot.agent.IsTagged;
if (flag2 != blipSlot.lastActive)
{
blipSlot.go.SetActive(flag2);
blipSlot.lastActive = flag2;
}
}
}
}
public static void SetLayer(int layer)
{
for (int i = 0; i < _activeIndices.Count; i++)
{
BlipSlot blipSlot = _pool[_activeIndices[i]];
if ((Object)(object)blipSlot.go != (Object)null && ((Il2CppObjectBase)blipSlot.go).Pointer != IntPtr.Zero)
{
blipSlot.go.layer = layer;
if ((Object)(object)blipSlot.outlineGo != (Object)null && ((Il2CppObjectBase)blipSlot.outlineGo).Pointer != IntPtr.Zero)
{
blipSlot.outlineGo.layer = layer;
}
}
}
}
public static void ApplyScale(float scale)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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)
Vector3 localScale = Vector3.one * scale;
for (int i = 0; i < _pool.Count; i++)
{
BlipSlot blipSlot = _pool[i];
if ((Object)(object)blipSlot.go != (Object)null && ((Il2CppObjectBase)blipSlot.go).Pointer != IntPtr.Zero)
{
blipSlot.go.transform.localScale = localScale;
}
}
}
private static void PromoteTagged()
{
if (!_tagEventPending)
{
return;
}
_tagEventPending = false;
for (int num = _untrackedIndices.Count - 1; num >= 0; num--)
{
int num2 = _untrackedIndices[num];
BlipSlot blipSlot = _pool[num2];
if ((Object)(object)blipSlot.agent == (Object)null || ((Il2CppObjectBase)blipSlot.agent).Pointer == IntPtr.Zero)
{
continue;
}
bool isTagged;
try
{
if (!blipSlot.agent.m_alive)
{
continue;
}
isTagged = blipSlot.agent.IsTagged;
goto IL_0087;
}
catch
{
}
continue;
IL_0087:
if (isTagged)
{
int num3 = _untrackedIndices.Count - 1;
if (num != num3)
{
int num4 = _untrackedIndices[num3];
_untrackedIndices[num] = num4;
_pool[num4].untrackedListPos = num;
}
_untrackedIndices.RemoveAt(num3);
blipSlot.taggedListPos = _taggedIndices.Count;
_taggedIndices.Add(num2);
blipSlot.inTaggedList = true;
}
}
}
private static void SyncPool(Transform root)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
eDimensionIndex localPlayerDimension = GetLocalPlayerDimension();
for (int num = _activeIndices.Count - 1; num >= 0; num--)
{
BlipSlot blipSlot = _pool[_activeIndices[num]];
bool flag = false;
try
{
flag = ((Il2CppObjectBase)blipSlot.agent).Pointer == IntPtr.Zero || !((Component)blipSlot.agent).gameObject.activeInHierarchy || !blipSlot.agent.m_alive || ((Agent)blipSlot.agent).m_isBeingDestroyed || ((Agent)blipSlot.agent).DimensionIndex != localPlayerDimension;
}
catch
{
flag = true;
}
if (flag)
{
_agentToSlot.Remove(((Il2CppObjectBase)blipSlot.agent).Pointer);
FreeSlot(_activeIndices[num]);
}
}
for (int i = 0; i < root.childCount; i++)
{
Transform child = root.GetChild(i);
if ((Object)(object)child == (Object)null || !((Component)child).gameObject.activeInHierarchy || _trackedTransformPtrs.Contains(((Il2CppObjectBase)child).Pointer))
{
continue;
}
EnemyAgent component;
try
{
component = ((Component)child).GetComponent<EnemyAgent>();
}
catch
{
continue;
}
if ((Object)(object)component == (Object)null || ((Il2CppObjectBase)component).Pointer == IntPtr.Zero || _agentToSlot.ContainsKey(((Il2CppObjectBase)component).Pointer) || !component.m_alive || ((Agent)component).m_isBeingDestroyed || ((Agent)component).DimensionIndex != localPlayerDimension)
{
continue;
}
int num2 = AcquireSlot();
BlipSlot blipSlot2 = _pool[num2];
blipSlot2.agent = component;
blipSlot2.cachedEnemyType = CacheEnemyType(component);
blipSlot2.cachedEnemyName = CacheEnemyName(component);
blipSlot2.colorAssigned = false;
blipSlot2.lastActive = false;
blipSlot2.lastMapPos = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
_agentToSlot[((Il2CppObjectBase)component).Pointer] = num2;
try
{
blipSlot2.agentTransformPtr = ((Il2CppObjectBase)((Component)component).transform).Pointer;
}
catch
{
blipSlot2.agentTransformPtr = IntPtr.Zero;
}
if (blipSlot2.agentTransformPtr != IntPtr.Zero)
{
_trackedTransformPtrs.Add(blipSlot2.agentTransformPtr);
}
try
{
if (component.IsTagged)
{
_tagEventPending = true;
}
}
catch
{
}
blipSlot2.go.SetActive(false);
if (_cfgDebugDump && _debugSeenDataIDs.Add(component.EnemyDataID))
{
Debug.Log(Object.op_Implicit($"[BiotrackerMapMarkers][EnemySeen] GO={((Object)((Component)component).gameObject).name} DataID={component.EnemyDataID} EnemyType={blipSlot2.cachedEnemyType} ResolvedName={blipSlot2.cachedEnemyName}"));
}
}
}
private static void UpdateBlips()
{
//IL_013a: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: 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_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
for (int num = _taggedIndices.Count - 1; num >= 0; num--)
{
int num2 = _taggedIndices[num];
BlipSlot blipSlot = _pool[num2];
if (((Il2CppObjectBase)blipSlot.agent).Pointer == IntPtr.Zero)
{
if (blipSlot.lastActive)
{
blipSlot.go.SetActive(false);
blipSlot.lastActive = false;
}
}
else
{
bool flag = !blipSlot.agent.m_alive;
if (!blipSlot.agent.IsTagged || flag)
{
int num3 = _taggedIndices.Count - 1;
if (num != num3)
{
int num4 = _taggedIndices[num3];
_taggedIndices[num] = num4;
_pool[num4].taggedListPos = num;
}
_taggedIndices.RemoveAt(num3);
blipSlot.untrackedListPos = _untrackedIndices.Count;
_untrackedIndices.Add(num2);
blipSlot.inTaggedList = false;
if (blipSlot.lastActive)
{
blipSlot.go.SetActive(false);
blipSlot.lastActive = false;
}
}
else
{
if (!blipSlot.lastActive)
{
blipSlot.go.SetActive(true);
blipSlot.lastActive = true;
}
Vector3 val = WorldToMapPos(blipSlot.agent.Position);
if (val != blipSlot.lastMapPos)
{
blipSlot.go.transform.localPosition = val;
blipSlot.lastMapPos = val;
}
if (!blipSlot.colorAssigned)
{
blipSlot.sr.color = GetBodyColor(blipSlot);
blipSlot.outlineSr.color = GetOutlineColor(blipSlot);
blipSlot.colorAssigned = true;
}
}
}
}
}
private static Color GetBodyColor(BlipSlot slot)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected I4, but got Unknown
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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)
if (_cachedStyles.TryGetValue(slot.cachedEnemyName, out var value))
{
return value.Body;
}
eEnemyType cachedEnemyType = slot.cachedEnemyType;
return (Color)((int)cachedEnemyType switch
{
0 => _cfgFallbackBodyWeakling,
1 => _cfgFallbackBodyStandard,
2 => _cfgFallbackBodySpecial,
3 => _cfgFallbackBodyMiniBoss,
4 => _cfgFallbackBodyBoss,
_ => _cfgColorDefault,
});
}
private static Color GetOutlineColor(BlipSlot slot)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected I4, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
if (_cachedStyles.TryGetValue(slot.cachedEnemyName, out var value))
{
if (!value.ShowOutline)
{
return Color.clear;
}
return value.Outline;
}
eEnemyType cachedEnemyType = slot.cachedEnemyType;
switch ((int)cachedEnemyType)
{
case 0:
if (!_cfgFallbackShowOutlineWeakling)
{
return Color.clear;
}
return _cfgFallbackOutlineWeakling;
case 1:
if (!_cfgFallbackShowOutlineStandard)
{
return Color.clear;
}
return _cfgFallbackOutlineStandard;
case 2:
if (!_cfgFallbackShowOutlineSpecial)
{
return Color.clear;
}
return _cfgFallbackOutlineSpecial;
case 3:
if (!_cfgFallbackShowOutlineMiniBoss)
{
return Color.clear;
}
return _cfgFallbackOutlineMiniBoss;
case 4:
if (!_cfgFallbackShowOutlineBoss)
{
return Color.clear;
}
return _cfgFallbackOutlineBoss;
default:
return Color.clear;
}
}
private static int AcquireSlot()
{
int num;
if (_freeIndices.Count > 0)
{
num = _freeIndices.Pop();
}
else
{
BlipSlot blipSlot = new BlipSlot();
blipSlot.go = CreateBlipGO(out var bodySr, out var outlineSr);
blipSlot.sr = bodySr;
blipSlot.outlineGo = ((Component)blipSlot.go.transform.GetChild(0)).gameObject;
blipSlot.outlineSr = outlineSr;
blipSlot.go.SetActive(false);
_pool.Add(blipSlot);
num = _pool.Count - 1;
}
BlipSlot blipSlot2 = _pool[num];
blipSlot2.activeListPos = _activeIndices.Count;
_activeIndices.Add(num);
blipSlot2.untrackedListPos = _untrackedIndices.Count;
_untrackedIndices.Add(num);
blipSlot2.inTaggedList = false;
return num;
}
private static void FreeSlot(int index)
{
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
BlipSlot blipSlot = _pool[index];
List<int> list = (blipSlot.inTaggedList ? _taggedIndices : _untrackedIndices);
int num = (blipSlot.inTaggedList ? blipSlot.taggedListPos : blipSlot.untrackedListPos);
int num2 = list.Count - 1;
if (num != num2)
{
int index2 = (list[num] = list[num2]);
if (blipSlot.inTaggedList)
{
_pool[index2].taggedListPos = num;
}
else
{
_pool[index2].untrackedListPos = num;
}
}
list.RemoveAt(num2);
blipSlot.inTaggedList = false;
if (blipSlot.agentTransformPtr != IntPtr.Zero)
{
_trackedTransformPtrs.Remove(blipSlot.agentTransformPtr);
blipSlot.agentTransformPtr = IntPtr.Zero;
}
blipSlot.agent = null;
if (blipSlot.lastActive && (Object)(object)blipSlot.go != (Object)null && ((Il2CppObjectBase)blipSlot.go).Pointer != IntPtr.Zero)
{
blipSlot.go.SetActive(false);
blipSlot.lastActive = false;
}
blipSlot.lastMapPos = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
_freeIndices.Push(index);
int activeListPos = blipSlot.activeListPos;
int num4 = _activeIndices.Count - 1;
if (activeListPos != num4)
{
int num5 = _activeIndices[num4];
_activeIndices[activeListPos] = num5;
_pool[num5].activeListPos = activeListPos;
}
_activeIndices.RemoveAt(num4);
}
private static void EnsureBlipSprite()
{
if (Time.time < _nextSpritePollTime)
{
return;
}
_nextSpritePollTime = Time.time + 1f;
if ((Object)(object)_blipSprite != (Object)null && ((Il2CppObjectBase)_blipSprite).Pointer != IntPtr.Zero && (Object)(object)_blipSprite.texture != (Object)null && ((Il2CppObjectBase)_blipSprite.texture).Pointer != IntPtr.Zero)
{
return;
}
_blipSprite = CreateBlipSprite(32);
for (int i = 0; i < _pool.Count; i++)
{
BlipSlot blipSlot = _pool[i];
if ((Object)(object)blipSlot.sr != (Object)null && ((Il2CppObjectBase)blipSlot.sr).Pointer != IntPtr.Zero)
{
blipSlot.sr.sprite = _blipSprite;
}
if ((Object)(object)blipSlot.outlineSr != (Object)null && ((Il2CppObjectBase)blipSlot.outlineSr).Pointer != IntPtr.Zero)
{
blipSlot.outlineSr.sprite = _blipSprite;
}
}
Debug.LogWarning(Object.op_Implicit("[BiotrackerMapMarkers] Blip sprite was collected by the asset unloader — recreated and reassigned to all pool slots."));
}
private static GameObject CreateBlipGO(out SpriteRenderer bodySr, out SpriteRenderer outlineSr)
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
int layer = (_wasFullMapOpen ? 5 : (EnemyBlipPlugin.MinimapModInstalled ? 31 : 5));
float num = (_wasFullMapOpen ? _cfgScaleMap : (EnemyBlipPlugin.MinimapModInstalled ? _cfgScaleMinimap : _cfgScaleMap));
GameObject val = new GameObject("EnemyBlipOutline");
Object.DontDestroyOnLoad((Object)(object)val);
val.layer = layer;
outlineSr = ((Il2CppObjectBase)val.AddComponent(Il2CppType.Of<SpriteRenderer>())).Cast<SpriteRenderer>();
outlineSr.sprite = _blipSprite;
outlineSr.color = Color.clear;
((Renderer)outlineSr).sortingOrder = -2;
GameObject val2 = new GameObject("EnemyBlip");
Object.DontDestroyOnLoad((Object)(object)val2);
val2.layer = layer;
val2.transform.SetParent(_mapMoverElements, false);
val2.transform.localScale = Vector3.one * num;
SpriteRenderer val3 = ((Il2CppObjectBase)val2.AddComponent(Il2CppType.Of<SpriteRenderer>())).Cast<SpriteRenderer>();
val3.sprite = _blipSprite;
val3.color = _cfgColorDefault;
((Renderer)val3).sortingOrder = -1;
bodySr = val3;
val.transform.SetParent(val2.transform, false);
val.transform.localPosition = Vector3.zero;
val.transform.localScale = Vector3.one * (1f + _cfgOutlineThickness);
return val2;
}
private static Sprite CreateBlipSprite(int size)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
((Object)val).hideFlags = (HideFlags)32;
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 Vector3 WorldToMapPos(Vector3 worldPos)
{
//IL_0000: 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_001d: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(worldPos.x * 5f, worldPos.z * 5f, 0.05f);
}
private static eDimensionIndex GetLocalPlayerDimension()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
try
{
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
return (eDimensionIndex)(((Object)(object)localPlayerAgent != (Object)null && ((Il2CppObjectBase)localPlayerAgent).Pointer != IntPtr.Zero) ? ((int)((Agent)localPlayerAgent).DimensionIndex) : 0);
}
catch (Exception)
{
return (eDimensionIndex)0;
}
}
private static eEnemyType CacheEnemyType(EnemyAgent agent)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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)
try
{
return (eEnemyType)((agent.EnemyData == null) ? 1 : ((int)agent.EnemyData.EnemyType));
}
catch
{
return (eEnemyType)1;
}
}
private static string CacheEnemyName(EnemyAgent agent)
{
try
{
if (_dataIdToName.TryGetValue(agent.EnemyDataID, out var value))
{
return value;
}
string name = ((Object)((Component)agent).gameObject).name;
return name.EndsWith("_GeneratedPrefab") ? name.Substring(0, name.Length - "_GeneratedPrefab".Length) : name;
}
catch
{
return "";
}
}
private static void DumpEnemyDataBlocks()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
try
{
Dictionary<uint, List<string>> dictionary = new Dictionary<uint, List<string>>();
foreach (EnemyPopulationDataBlock allBlock in GameDataBlockBase<EnemyPopulationDataBlock>.GetAllBlocks())
{
if (allBlock.RoleDatas == null)
{
continue;
}
Enumerator<EnemyRoleData> enumerator2 = allBlock.RoleDatas.GetEnumerator();
while (enumerator2.MoveNext())
{
EnemyRoleData current2 = enumerator2.Current;
if (current2.Enemy != 0)
{
if (!dictionary.ContainsKey(current2.Enemy))
{
dictionary[current2.Enemy] = new List<string>();
}
string item = $"{current2.Role}({current2.Difficulty})";
if (!dictionary[current2.Enemy].Contains(item))
{
dictionary[current2.Enemy].Add(item);
}
}
}
}
Il2CppArrayBase<EnemyDataBlock> allBlocks = GameDataBlockBase<EnemyDataBlock>.GetAllBlocks();
Debug.Log(Object.op_Implicit($"[BiotrackerMapMarkers][EnemyDump] Static catalog: {allBlocks.Count} EnemyDataBlocks"));
foreach (EnemyDataBlock item2 in allBlocks)
{
string value = (dictionary.ContainsKey(((GameDataBlockBase<EnemyDataBlock>)(object)item2).persistentID) ? string.Join(", ", dictionary[((GameDataBlockBase<EnemyDataBlock>)(object)item2).persistentID]) : "(none)");
bool flag = EnemyBlipPlugin.EnemyConfigs.ContainsKey(((GameDataBlockBase<EnemyDataBlock>)(object)item2).name);
Debug.Log(Object.op_Implicit($"[BiotrackerMapMarkers][EnemyDump] ID={((GameDataBlockBase<EnemyDataBlock>)(object)item2).persistentID,-6} | name={((GameDataBlockBase<EnemyDataBlock>)(object)item2).name,-48} | EnemyType={item2.EnemyType,-10} | Roles={value}" + (flag ? "" : " [NO CONFIG — using fallback color]")));
}
Debug.Log(Object.op_Implicit("[BiotrackerMapMarkers][EnemyDump] End of catalog"));
}
catch (Exception ex)
{
Debug.LogWarning(Object.op_Implicit("[BiotrackerMapMarkers] DumpEnemyDataBlocks failed: " + ex.Message));
}
}
private static Color ParseColor(string raw, Color fallback, string name = "")
{
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
try
{
string text = raw.Trim();
if (text.StartsWith("#") && text.Length == 7)
{
int num = Convert.ToInt32(text.Substring(1, 2), 16);
int num2 = Convert.ToInt32(text.Substring(3, 2), 16);
int num3 = Convert.ToInt32(text.Substring(5, 2), 16);
return new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, 1f);
}
string[] array = text.Split(' ');
if (array.Length == 4 && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3) && float.TryParse(array[3], out var result4))
{
return new Color(result, result2, result3, result4);
}
}
catch
{
}
Debug.LogWarning(Object.op_Implicit("[BiotrackerMapMarkers] Color parse failed for '" + name + "' — using fallback."));
return fallback;
}
}
[HarmonyPatch(typeof(CM_PageMap), "Setup")]
public static class Patch_CM_PageMap_Setup
{
private static GameObject _host;
public static void Postfix()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
if ((Object)(object)_host == (Object)null || ((Il2CppObjectBase)_host).Pointer == IntPtr.Zero)
{
_host = new GameObject("EnemyBlipHost");
Object.DontDestroyOnLoad((Object)(object)_host);
((Il2CppObjectBase)_host.AddComponent(Il2CppType.Of<EnemyBlipUpdater>())).Cast<EnemyBlipUpdater>();
Debug.Log(Object.op_Implicit("[BiotrackerMapMarkers] EnemyBlipUpdater created."));
}
EnemyBlipManager.Cleanup();
}
}
[HarmonyPatch(typeof(CM_PageMap), "OnLevelCleanup")]
public static class Patch_CM_PageMap_OnLevelCleanup
{
public static void Postfix()
{
EnemyBlipManager.Cleanup();
}
}
[HarmonyPatch(typeof(EnemyAgent), "SyncPlaceNavMarkerTag")]
public static class Patch_EnemyAgent_SyncPlaceNavMarkerTag
{
public static void Postfix()
{
EnemyBlipManager.SignalTagEvent();
}
}