Please disclose if your mod was created primarily 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 DungeonFinder v1.0.0
DungeonFinder.dll
Decompiled 5 hours agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Splatform; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("DungeonFinder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DungeonFinder")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f28048ab-6a92-4efe-be3c-86f41e711226")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DungeonFinder; [BepInPlugin("com.Horhpeus.dungeonfinder", "Dungeon Finder", "1.0.0")] public class DungeonFinderPlugin : BaseUnityPlugin { public const string PluginGUID = "com.Horhpeus.dungeonfinder"; public const string PluginName = "Dungeon Finder"; public const string PluginVersion = "1.0.0"; private Harmony _harmony; internal static ManualLogSource Log; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; DungeonFinderConfig.Log = Log; _harmony = new Harmony("com.Horhpeus.dungeonfinder"); _harmony.PatchAll(); Log.LogInfo((object)"Dungeon Finder loaded"); DungeonFinderConfig.Init(((BaseUnityPlugin)this).Config); DungeonFinderConfig.InitLocationSets(); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(ZoneSystem), "SpawnLocation")] public static class ZoneSystem_SpawnLocation_Patch { private static void Postfix(ZoneLocation location, GameObject __result) { if (!((Object)(object)__result == (Object)null)) { string prefabName = location.m_prefabName; if (DungeonFinderConfig.locationNamesToScan.Contains(prefabName)) { AddTrigger(__result, prefabName); } } } private static void AddTrigger(GameObject obj, string name) { SphereCollider val = obj.AddComponent<SphereCollider>(); ((Collider)val).isTrigger = true; val.radius = DungeonFinderConfig.SearchDistance.Value; DungeonTrigger dungeonTrigger = obj.AddComponent<DungeonTrigger>(); dungeonTrigger.locationName = name; } } public class DungeonTrigger : MonoBehaviour { public string locationName; private bool triggered; private void OnTriggerEnter(Collider other) { if (!triggered && (Object)(object)((Component)other).GetComponent<Player>() != (Object)null) { triggered = true; DungeonFinderPlugin.Log.LogInfo((object)("Player entered: " + locationName)); AddMinimapIcon(); } } private void AddMinimapIcon() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) if (!((Object)(object)Minimap.instance == (Object)null) && !IsIconAlreadyPlaced(((Component)this).transform.position)) { Minimap.instance.AddPin(((Component)this).transform.position, (PinType)2, "Dungeon", true, false, 0L, default(PlatformUserID)); } } private bool IsIconAlreadyPlaced(Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Minimap.instance == (Object)null) { return false; } List<PinData> pins = GetPins(); return pins.Any((PinData pin) => Vector3.Distance(pin.m_pos, position) < 1f); } public static List<PinData> GetPins() { FieldInfo field = typeof(Minimap).GetField("m_pins", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { return null; } return (List<PinData>)field.GetValue(Minimap.instance); } } public class DungeonFinderConfig { internal static ManualLogSource Log; public static HashSet<string> locationNamesToScan = new HashSet<string>(); public static ConfigEntry<bool> EnableDungeonFinder { get; private set; } public static ConfigEntry<float> SearchDistance { get; private set; } public static ConfigEntry<bool> SearchForCrypts { get; private set; } public static ConfigEntry<bool> SearchForTroll { get; private set; } public static ConfigEntry<bool> SearchForSunkenCrypt { get; private set; } public static ConfigEntry<bool> SearchForMountainCave { get; private set; } public static ConfigEntry<bool> SearchForInfestedMine { get; private set; } public static ConfigEntry<bool> SearchForMorgenHole { get; private set; } public static ConfigEntry<bool> SearchForHildirDungeons { get; private set; } public static ConfigEntry<bool> SearchForPlaceOfMystery { get; private set; } public static void Init(ConfigFile config) { EnableDungeonFinder = config.Bind<bool>("General", "EnableDungeonFinder", true, "Enable or disable the dungeon Finder feature."); SearchDistance = config.Bind<float>("General", "SearchDistance", 75f, "The search diameter for locations around the player."); SearchForCrypts = config.Bind<bool>("General", "Crypts", true, "Enable search for crypt locations."); SearchForTroll = config.Bind<bool>("General", "Troll", true, "Enable search for troll locations."); SearchForSunkenCrypt = config.Bind<bool>("General", "SunkenCrypt", true, "Enable search for sunken crypt locations."); SearchForMountainCave = config.Bind<bool>("General", "MountainCave", true, "Enable search for mountain cave locations."); SearchForInfestedMine = config.Bind<bool>("General", "InfestedMine", true, "Enable search for infested mine locations."); SearchForMorgenHole = config.Bind<bool>("General", "MorgenHole", true, "Enable search for morgen hole locations."); SearchForHildirDungeons = config.Bind<bool>("General", "HildirDungeons", false, "Enable search for hildir dungeons locations."); SearchForPlaceOfMystery = config.Bind<bool>("General", "PlaceOfMystery", false, "Enable search for place of mystery locations."); } public static void InitLocationSets() { if (SearchForCrypts != null && SearchForCrypts.Value) { locationNamesToScan.Add("Crypt2"); locationNamesToScan.Add("Crypt3"); locationNamesToScan.Add("Crypt4"); } if (SearchForTroll != null && SearchForTroll.Value) { locationNamesToScan.Add("TrollCave02"); } if (SearchForSunkenCrypt != null && SearchForSunkenCrypt.Value) { locationNamesToScan.Add("SunkenCrypt4"); } if (SearchForMountainCave != null && SearchForMountainCave.Value) { locationNamesToScan.Add("MountainCave02"); } if (SearchForInfestedMine != null && SearchForInfestedMine.Value) { locationNamesToScan.Add("Mistlands_DvergrBossEntrance1"); locationNamesToScan.Add("Mistlands_DvergrTownEntrance1"); locationNamesToScan.Add("Mistlands_DvergrTownEntrance2"); } if (SearchForMorgenHole != null && SearchForMorgenHole.Value) { locationNamesToScan.Add("MorgenHole1"); locationNamesToScan.Add("MorgenHole2"); locationNamesToScan.Add("MorgenHole3"); } if (SearchForHildirDungeons != null && SearchForHildirDungeons.Value) { locationNamesToScan.Add("Hildir_cave"); locationNamesToScan.Add("Hildir_crypt"); locationNamesToScan.Add("Hildir_plainsfortress"); } if (SearchForPlaceOfMystery != null && SearchForPlaceOfMystery.Value) { locationNamesToScan.Add("PlaceofMystery3"); } } }