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 ShowFullMap v1.0.4
ExploreMap.dll
Decompiled a day agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ExploreMap")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ExploreMap")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("66bc22bc-fa62-4dfb-9413-49f780d331b0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace ExploreMap; [BepInProcess("valheim.exe")] [BepInPlugin("juliandeclercq.ExploreMap", "Explore Map", "1.0.4")] public class ExploreMap : BaseUnityPlugin { [HarmonyPatch(typeof(Minimap), "UpdateMap")] private static class UpdateMapPatch { private static void Postfix(Minimap __instance) { if ((Object)(object)_miniMap == (Object)null) { _miniMap = __instance; } if (_exploreFullMap.Value) { if (string.IsNullOrEmpty(_cachedPath)) { object value = Traverse.Create((object)WorldGenerator.instance).Field("m_world").GetValue(); World val = (World)((value is World) ? value : null); string path = $"{Game.instance.GetPlayerProfile().GetFilename()}_{val.m_uid}_ExploreMapSave.dat"; _cachedPath = Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..\\cache\\"), path); } if (!File.Exists(_cachedPath)) { __instance.SaveMapData(); byte[] mapData = Game.instance.GetPlayerProfile().GetMapData(); File.WriteAllBytes(_cachedPath, mapData); Debug.Log((object)("wrote mapdata to " + _cachedPath)); __instance.ExploreAll(); } } } } [HarmonyPatch(typeof(ZNet), "OnDestroy")] private static class OnDestroyPatch { private static void Postfix(Minimap __instance) { _cachedPath = string.Empty; } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] private static class InputText_Patch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__1_0; internal void <Postfix>b__1_0(ConsoleEventArgs args) { ExploreMapToggle(); ConsolePrint($"toggled explore map ({_exploreFullMap.Value})"); } } private const string command = "toggleFullMap"; private static void Postfix(Terminal __instance) { //IL_0032: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown object obj = <>c.<>9__1_0; if (obj == null) { ConsoleEvent val = delegate { ExploreMapToggle(); ConsolePrint($"toggled explore map ({_exploreFullMap.Value})"); }; <>c.<>9__1_0 = val; obj = (object)val; } new ConsoleCommand("toggleFullMap", "Toggles the full map on or off", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } private static BaseUnityPlugin instance; private static string _cachedPath = string.Empty; public static Minimap _miniMap = null; private static ConfigEntry<bool> _exploreFullMap; private static ConfigEntry<string> _toggleHotkey; private static KeyCode _toggleHotkeyKeyCode; private void Awake() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) instance = (BaseUnityPlugin)(object)this; _exploreFullMap = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Explore full map", true, "explore the full map"); _toggleHotkey = ((BaseUnityPlugin)this).Config.Bind<string>("Hotkeys", "Toggle explore full map hotkey", "F6", "The hotkey that toggles showing the full map, for a full list of available keys visit https://docs.unity3d.com/ScriptReference/KeyCode.html"); _toggleHotkeyKeyCode = (KeyCode)Enum.Parse(typeof(KeyCode), _toggleHotkey.Value); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(_toggleHotkeyKeyCode) && !((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog()) { Chat obj = Chat.instance; if (obj == null || !obj.HasFocus()) { ExploreMapToggle(); } } } private static void LoadOriginalMap() { ((MonoBehaviour)instance).StartCoroutine(LoadOriginalMapCoroutine()); } private static IEnumerator LoadOriginalMapCoroutine() { if (!((Object)(object)_miniMap == (Object)null) && File.Exists(_cachedPath)) { _exploreFullMap.Value = false; byte[] data = File.ReadAllBytes(_cachedPath); yield return (object)new WaitForEndOfFrame(); Traverse.Create((object)_miniMap).Method("SetMapData", new object[1] { data }).GetValue(); File.Delete(_cachedPath); } } private static void ExploreMapToggle() { _exploreFullMap.Value = !_exploreFullMap.Value; if (!_exploreFullMap.Value) { LoadOriginalMap(); } Debug.Log((object)"Explore map toggled"); } private static void ConsolePrint(string line) { Traverse.Create((object)Console.instance).Method("Print", new object[1] { line }).GetValue(); } }