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 Map Expand v1.0.1
MapExpand.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using REPOMod.Config; using REPOMod.Utils; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MapExpand")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod that allows you to see a much larger portion of the map")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b3bbf88df423cdb5b5dde22dd056e6b1626acbbf")] [assembly: AssemblyProduct("MapExpand")] [assembly: AssemblyTitle("MapExpand")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 REPOMod { [BepInPlugin("com.ranily.repo.mapexpand", "Map Expand", "1.0.0")] [BepInProcess("REPO.exe")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private readonly Harmony harmony = new Harmony("com.ranily.repo.mapexpand"); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"[Map Expand] Plugin Map Expand v1.0.0 loaded!"); try { ModConfig.Initialize(((BaseUnityPlugin)this).Config); PluginPersistence.SetupPersistenceMonitor(); Log.LogInfo((object)"[Map Expand] Map expansion mod initialized!"); } catch (Exception ex) { Log.LogError((object)("[Map Expand] ERROR during initialization: " + ex.Message)); Log.LogError((object)("[Map Expand] Stack trace: " + ex.StackTrace)); } } private void OnDestroy() { Log.LogInfo((object)"[Map Expand] Plugin Map Expand unloaded!"); } } internal static class MyPluginInfo { public const string PLUGIN_GUID = "com.ranily.repo.mapexpand"; public const string PLUGIN_NAME = "Map Expand"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace REPOMod.Utils { public static class GameExplorer { public static void LogGameAssemblies() { Plugin.Log.LogInfo((object)"=== Assemblies loded ==="); foreach (Assembly item in from a in AppDomain.CurrentDomain.GetAssemblies() where !a.FullName.StartsWith("System") && !a.FullName.StartsWith("Microsoft") && !a.FullName.StartsWith("mscorlib") && !a.FullName.StartsWith("Unity") select a) { Plugin.Log.LogInfo((object)("Assembly: " + item.FullName)); } } public static void LogGameNamespaces() { Plugin.Log.LogInfo((object)"=== Namespaces ==="); Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "Assembly-CSharp"); if (assembly != null) { foreach (string item in from n in (from t in assembly.GetTypes() select t.Namespace into n where !string.IsNullOrEmpty(n) select n).Distinct() orderby n select n) { Plugin.Log.LogInfo((object)("Namespace: " + item)); } return; } Plugin.Log.LogError((object)"Assembly-CSharp non trouvée!"); } public static void LogMainClasses() { Plugin.Log.LogInfo((object)"=== Classes principales ==="); Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "Assembly-CSharp"); if (!(assembly != null)) { return; } List<string> keywordsList = new List<string> { "Game", "Manager", "Player", "Map", "World", "Controller", "Camera", "UI", "HUD", "Menu", "Save", "Inventory" }; foreach (Type item in from t in assembly.GetTypes() where keywordsList.Any((string k) => t.Name.Contains(k)) orderby t.Name select t) { Plugin.Log.LogInfo((object)("Classe: " + item.FullName)); } } } public static class PluginPersistence { private static GameObject persistentObject; public static void SetupPersistenceMonitor() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown persistentObject = new GameObject("MapExpandBootstrapper"); Object.DontDestroyOnLoad((Object)(object)persistentObject); persistentObject.AddComponent<MapExpandBootstrapper>(); Plugin.Log.LogInfo((object)"[Map Expand] Bootstrapper setup complete"); SceneManager.sceneLoaded += OnSceneLoadedStatic; } private static void OnSceneLoadedStatic(Scene scene, LoadSceneMode mode) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown Plugin.Log.LogInfo((object)("[Map Expand] Static scene load detected: " + ((Scene)(ref scene)).name)); if ((Object)(object)persistentObject == (Object)null) { persistentObject = new GameObject("MapExpandBootstrapper"); Object.DontDestroyOnLoad((Object)(object)persistentObject); persistentObject.AddComponent<MapExpandBootstrapper>(); Plugin.Log.LogInfo((object)"[Map Expand] Recreated bootstrapper after unload"); } if (((Scene)(ref scene)).name == "Main") { persistentObject.AddComponent<DelayedCameraProcessor>().SceneName = ((Scene)(ref scene)).name; } } } public class MapExpandBootstrapper : MonoBehaviour { private void Awake() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Plugin.Log.LogInfo((object)"[Map Expand] Bootstrapper awakened"); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Plugin.Log.LogInfo((object)("[Map Expand] Bootstrapper detected scene: " + ((Scene)(ref scene)).name)); if (((Scene)(ref scene)).name == "Main") { ((MonoBehaviour)this).Invoke("ProcessMapCamera", 2f); } } private void ProcessMapCamera() { try { Plugin.Log.LogInfo((object)"[Map Expand] Attempting to resize map camera..."); Camera[] array = Resources.FindObjectsOfTypeAll<Camera>(); Plugin.Log.LogInfo((object)$"[Map Expand] Found {array.Length} cameras"); Camera[] array2 = array; foreach (Camera val in array2) { if (!((Object)(object)val != (Object)null) || !((Object)((Component)val).gameObject).name.Contains("Dirt Finder Map Camera")) { continue; } float orthographicSize = val.orthographicSize; float orthographicSize2 = 5f; try { if (ModConfig.MapCameraSize != null) { orthographicSize2 = ModConfig.MapCameraSize.Value; } } catch (Exception) { Plugin.Log.LogWarning((object)"[Map Expand] Couldn't access config, using default size 5"); } val.orthographicSize = orthographicSize2; Plugin.Log.LogInfo((object)$"[Map Expand] Modified map camera size from {orthographicSize} to {val.orthographicSize}"); return; } Plugin.Log.LogWarning((object)"[Map Expand] Could not find Dirt Finder Map Camera"); } catch (Exception ex2) { Plugin.Log.LogError((object)("[Map Expand] Error processing camera: " + ex2.Message)); } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; Plugin.Log.LogInfo((object)"[Map Expand] Bootstrapper destroyed"); } } public class DelayedCameraProcessor : MonoBehaviour { public string SceneName; private float timer; private const float DELAY = 2f; private bool processed; private void Update() { if (!processed) { timer += Time.deltaTime; if (timer >= 2f) { processed = true; ProcessMapCamera(); Object.Destroy((Object)(object)this); } } } private void ProcessMapCamera() { try { Plugin.Log.LogInfo((object)("[Map Expand] Processing camera in scene " + SceneName + " after delay")); Camera[] array = Resources.FindObjectsOfTypeAll<Camera>(); foreach (Camera val in array) { if ((Object)(object)val != (Object)null && ((Object)((Component)val).gameObject).name.Contains("Dirt Finder Map Camera")) { float orthographicSize = val.orthographicSize; float orthographicSize2 = 5f; val.orthographicSize = orthographicSize2; Plugin.Log.LogInfo((object)$"[Map Expand] Modified map camera size from {orthographicSize} to {val.orthographicSize}"); return; } } Plugin.Log.LogWarning((object)"[Map Expand] Delayed processor could not find Dirt Finder Map Camera"); } catch (Exception ex) { Plugin.Log.LogError((object)("[Map Expand] Error in delayed processor: " + ex.Message)); } } } } namespace REPOMod.Patches { public static class MapCameraPatch { private static GameObject patchObject; private static CameraResizer resizer; public static void ApplyMapCameraPatches(Harmony harmony) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown patchObject = new GameObject("MapExpand_CameraResizer"); Object.DontDestroyOnLoad((Object)(object)patchObject); resizer = patchObject.AddComponent<CameraResizer>(); Plugin.Log.LogInfo((object)"[Map Expand] Camera patch registered. Ready to expand map view!"); } public static void ForceUpdateCamera() { if ((Object)(object)resizer != (Object)null) { resizer.ResizeCamerasInScene(); } } } public class CameraResizer : MonoBehaviour { [CompilerGenerated] private sealed class <ResizeCamerasAfterDelay>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CameraResizer <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResizeCamerasAfterDelay>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; CameraResizer cameraResizer = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; cameraResizer.ResizeCamerasInScene(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private int processId; private void Awake() { processId = Random.Range(1000, 9999); Plugin.Log.LogInfo((object)$"[Map Expand] Camera resizer {processId} created"); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Plugin.Log.LogInfo((object)("[Map Expand] Scene '" + ((Scene)(ref scene)).name + "' loaded - checking for map camera")); ((MonoBehaviour)this).StartCoroutine(ResizeCamerasAfterDelay()); } [IteratorStateMachine(typeof(<ResizeCamerasAfterDelay>d__3))] private IEnumerator ResizeCamerasAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResizeCamerasAfterDelay>d__3(0) { <>4__this = this }; } public void ResizeCamerasInScene() { Plugin.Log.LogInfo((object)"[Map Expand] Resizing map cameras in current scene"); Camera[] array = Resources.FindObjectsOfTypeAll<Camera>(); bool flag = false; Camera[] array2 = array; foreach (Camera val in array2) { if (((Object)((Component)val).gameObject).name.Contains("Dirt Finder Map Camera")) { flag = true; ResizeCamera(val); } } if (flag) { return; } array2 = array; foreach (Camera val2 in array2) { string text = ((Object)((Component)val2).gameObject).name.ToLower(); if (((text.Contains("map") && (text.Contains("camera") || text.Contains("cam"))) || (text.Contains("dirt") && text.Contains("finder"))) && val2.orthographic) { ResizeCamera(val2); } } } private void ResizeCamera(Camera cam) { if (!((Object)(object)cam == (Object)null)) { float orthographicSize = cam.orthographicSize; float value = ModConfig.MapCameraSize.Value; Plugin.Log.LogInfo((object)$"[Map Expand] Found map camera '{((Object)((Component)cam).gameObject).name}', size: {orthographicSize}, changing to: {value}"); cam.orthographicSize = value; Plugin.Log.LogInfo((object)$"[Map Expand] Camera size now: {cam.orthographicSize}"); } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; Plugin.Log.LogInfo((object)$"[Map Expand] Camera resizer {processId} destroyed"); } } } namespace REPOMod.Config { public static class ModConfig { public static ConfigEntry<float> MapCameraSize; public static void Initialize(ConfigFile config) { MapCameraSize = config.Bind<float>("MapCamera", "Size", 5f, "The size of the map camera. Higher values show more of the map. Game default: ~5"); Plugin.Log.LogInfo((object)$"[Map Expand] Configuration loaded. Camera size set to: {MapCameraSize.Value}"); } } }