Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BlindCartographer v1.0.3
plugins/BlindCartographer/BlindCartographer.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using BepInEx.Configuration; using BlindCartographer.Loader; using BlindCartographer.Modifier; using BlindCartographer.Ui; using HarmonyLib; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BlindCartographer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BlindCartographer")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2DA6F5A0-E14F-4334-A8B7-A2D9040E3BFC")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: AssemblyVersion("1.0.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BlindCartographer { [BepInPlugin("nightkosh.BlindCartographer", "BlindCartographer", "1.0.2")] public class BlindCartographer : BaseUnityPlugin { private const string PluginGuid = "nightkosh.BlindCartographer"; private const string PluginName = "BlindCartographer"; private const string PluginVersion = "1.0.2"; public static ConfigEntry<KeyCode> ConfigPinKey; private static ConfigEntry<bool> _modEnabled; public static ConfigEntry<bool> _enableCartographyTableInNoMapMode; public static ConfigEntry<bool> _enableHotKey; public static ConfigEntry<bool> _showHotKeyText; public static Harmony Harmony; private GameObject _lastHoveredObject; private string _lastObjectName; private bool _showPopup; private string _textInput = ""; public void Awake() { _modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ModEnabled", true, "Enable or disable the mod."); _enableCartographyTableInNoMapMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Map", "EnableCartographyTableInNoMapMode", true, "Enable cartography table in no map mode."); _enableHotKey = ((BaseUnityPlugin)this).Config.Bind<bool>("Hotkeys", "EnableHotKey", true, "Enable hot key."); _showHotKeyText = ((BaseUnityPlugin)this).Config.Bind<bool>("Hotkeys", "ShowHotKeyText", true, "Show hot key text."); ConfigPinKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "HotKey", (KeyCode)121, "Key to press with LEFT ALT to pin hovered object to the map"); if (_modEnabled.Value) { Harmony = Harmony.CreateAndPatchAll(typeof(BlindCartographer).Assembly, "nightkosh.BlindCartographer"); HoverTextPatchLoader.ApplyPatches(); } } private void Update() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (_modEnabled.Value && !IsAnyGameUIOpen() && _enableHotKey.Value && Input.GetKeyDown(ConfigPinKey.Value) && Input.GetKey((KeyCode)308)) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { GetHoverObject(localPlayer); TextInput.instance.RequestText((TextReceiver)(object)new PinTextReceiver(_lastObjectName, AddToMap), "Enter pin name", 255); } } } private bool IsAnyGameUIOpen() { if (!InventoryGui.IsVisible() && !Minimap.IsOpen() && !TextInput.IsVisible() && !StoreGui.IsVisible()) { Chat instance = Chat.instance; if ((instance == null || !instance.HasFocus()) && !Console.IsVisible()) { return Menu.IsVisible(); } } return true; } private void GetHoverObject(Player player) { _lastHoveredObject = null; _lastObjectName = ""; GameObject hoverObject = ((Humanoid)player).GetHoverObject(); if (!((Object)(object)hoverObject != (Object)null)) { return; } Hoverable componentInParent = hoverObject.GetComponentInParent<Hoverable>(); if (componentInParent == null) { return; } _lastHoveredObject = hoverObject; string hoverText = componentInParent.GetHoverText(); if (!string.IsNullOrEmpty(hoverText)) { string[] array = hoverText.Split('\n'); if (array.Length > 1) { _lastObjectName = array[0]; } } } private void AddToMap(string pinName) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_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) Minimap instance = Minimap.instance; if (!((Object)(object)instance == (Object)null)) { Vector3 val = (((Object)(object)_lastHoveredObject == (Object)null) ? ((Component)Player.m_localPlayer).transform.position : _lastHoveredObject.transform.position); instance.AddPin(val, (PinType)3, pinName, true, false, 0L, default(PlatformUserID)); Player localPlayer = Player.m_localPlayer; if (localPlayer != null) { ((Character)localPlayer).Message((MessageType)1, "Pin `" + pinName + "` added!", 0, (Sprite)null, false); } } } } } namespace BlindCartographer.Modifier { public static class HoverTextModifier { public static void AddHoverText<T>(T __instance, ref string __result) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (BlindCartographer._enableHotKey.Value && BlindCartographer._showHotKeyText.Value && __instance != null) { __result += $"\n[<color=yellow>LEFT ALT + {BlindCartographer.ConfigPinKey.Value}</color>] Pin to the map"; } } } } namespace BlindCartographer.Loader { public static class HoverTextPatchLoader { public static void ApplyPatches() { foreach (Type item in (from t in typeof(Hoverable).Assembly.GetTypes() where typeof(Hoverable).IsAssignableFrom(t) select t).Where(delegate(Type t) { MethodInfo method = t.GetMethod("GetHoverText", BindingFlags.Instance | BindingFlags.Public); return method != null && method.GetMethodBody() != null && !typeof(Character).IsAssignableFrom(t); })) { PatchHoverText(item); } } private static void PatchHoverText(Type type) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(type, "GetHoverText", (Type[])null, (Type[])null); if (methodInfo == null) { Debug.LogWarning((object)("[HoverTextPatch] Can't find GetHoverText of " + type.Name)); return; } HarmonyMethod val = new HarmonyMethod(typeof(HoverTextModifier).GetMethod("AddHoverText")?.MakeGenericMethod(type)); BlindCartographer.Harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } namespace BlindCartographer.Patches { [HarmonyPatch(typeof(MapTable), "OnRead", new Type[] { typeof(Switch), typeof(Humanoid), typeof(ItemData), typeof(bool) })] public static class MapTableOnReadPatch { public static void Postfix() { if (BlindCartographer._enableCartographyTableInNoMapMode.Value && Game.m_noMap) { Game.m_noMap = false; Minimap.instance.SetMapMode((MapMode)2); Game.m_noMap = true; } } } } namespace BlindCartographer.Ui { public class PinTextReceiver : TextReceiver { private readonly string _initial; private readonly Action<string> _onSubmit; public PinTextReceiver(string initial, Action<string> onSubmit) { _initial = initial; _onSubmit = onSubmit; } public string GetText() { return _initial; } public void SetText(string text) { _onSubmit?.Invoke(text); } } }