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 Dead Map Access v1.0.4
plugins/DeadMapAccess.dll
Decompiled a year agousing System; using System.Collections; using System.Diagnostics; 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 Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("SaturnKai")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4+a79dee4aa0fca7a6cd5ff757e184d547a209136b")] [assembly: AssemblyProduct("DeadMapAccess")] [assembly: AssemblyTitle("DeadMapAccess")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 DeadMapAccess { internal static class Configuration { internal static Color borderColor = Color32.op_Implicit(new Color32((byte)19, (byte)19, (byte)19, byte.MaxValue)); internal static ConfigEntry<float> width = null; internal static ConfigEntry<float> height = null; internal static ConfigEntry<int> borderSize = null; internal static ConfigEntry<bool> toggle = null; internal static ConfigEntry<bool> showUpgrades = null; internal static ConfigEntry<bool> hideValuables = null; internal static void Init(ConfigFile config) { width = config.Bind<float>("General", "Width", 600f, "The width of the map."); height = config.Bind<float>("General", "Height", 600f, "The height of the map."); borderSize = config.Bind<int>("General", "Border", 6, "The size of the map border."); toggle = config.Bind<bool>("General", "Toggle", false, "Set the map to toggle instead of hold."); showUpgrades = config.Bind<bool>("General", "ShowUpgrades", true, "Show upgrades while the map is shown."); hideValuables = config.Bind<bool>("Host", "HideValuables", false, "Force hide valuables on the map for all spectating players (only works when you are host)."); } } [BepInPlugin("dev.saturnkai.deadmapaccess", "DeadMapAccess", "1.0.4")] public class DeadMap : BaseUnityPlugin { internal static RenderTexture? renderTexture = null; internal static Camera? camera = null; internal static float cameraOrthographicDefault = 2.5f; internal static bool spectating = false; internal static bool hideValuables = false; private bool active; private bool activePrev; private readonly float scaleSpeed = 5f; private float scale = 0.5f; private float targetScale = 1f; private readonly float zoomSpeed = 0.2f; private readonly float zoomMin = 1f; private readonly float zoomMax = 20f; internal static DeadMap Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; internal Harmony? Harmony { get; set; } private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0054: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Configuration.Init(((BaseUnityPlugin)this).Config); if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (Configuration.toggle.Value && spectating) { if (SemiFunc.InputDown((InputKey)8)) { active = !active; } } else if (spectating) { active = SemiFunc.InputHold((InputKey)8); } targetScale = (active ? 1f : 0.5f); scale = Mathf.Lerp(scale, targetScale, Time.deltaTime * scaleSpeed); if (!spectating || !((Object)(object)SpectateCamera.instance != (Object)null) || (int)SpectateCamera.instance.currentState != 1) { return; } Transform transform = ((Component)SpectateCamera.instance).transform; if ((Object)(object)DirtFinderMapPlayer.Instance.PlayerTransform == (Object)null) { Logger.LogWarning((object)"DirtFinderMapPlayer transform null."); DirtFinderMapPlayer.Instance.PlayerTransform = new GameObject().transform; } DirtFinderMapPlayer.Instance.PlayerTransform.position = transform.position; Transform playerTransform = DirtFinderMapPlayer.Instance.PlayerTransform; Quaternion rotation = transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = transform.rotation; playerTransform.rotation = Quaternion.Euler(0f, y, ((Quaternion)(ref rotation)).eulerAngles.z); PlayerController.instance.playerAvatarScript.LastNavmeshPosition = SpectateCamera.instance.player.LastNavmeshPosition; if (active && Configuration.showUpgrades.Value) { ((SemiUI)StatsUI.instance).Show(); } if (active) { float num = SemiFunc.InputScrollY() * 0.01f; if (num != 0f && (Object)(object)camera != (Object)null) { Camera? obj = camera; obj.orthographicSize -= num * zoomSpeed; camera.orthographicSize = Mathf.Clamp(camera.orthographicSize, zoomMin, zoomMax); } } } private void OnGUI() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!spectating) { return; } if (active != activePrev) { activePrev = active; Sound val = (activePrev ? PlayerAvatar.instance.mapToolController.SoundStart : PlayerAvatar.instance.mapToolController.SoundStop); if ((Object)(object)SpectateCamera.instance != (Object)null) { val.Play(((Component)SpectateCamera.instance).transform.position, 1f, 1f, 1f, 1f); } } Map.Instance.Active = active; if (!active) { targetScale = 0.5f; return; } CameraTopFade.Instance.Set(0.5f, 0.1f); float num = Configuration.width.Value * scale; float num2 = Configuration.height.Value * scale; float num3 = ((float)Screen.width - num) / 2f; float num4 = ((float)Screen.height - num2) / 2f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num3 - (float)Configuration.borderSize.Value, num4 - (float)Configuration.borderSize.Value, num + (float)(Configuration.borderSize.Value * 2), num2 + (float)(Configuration.borderSize.Value * 2)); GUI.color = Configuration.borderColor; GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)renderTexture, (ScaleMode)0, false); } internal static void SetSpectating(bool isSpectating) { spectating = isSpectating; if ((Object)(object)camera != (Object)null) { camera.orthographicSize = cameraOrthographicDefault; } if (hideValuables) { MapValuable[] componentsInChildren = ((Component)Map.Instance.OverLayerParent).GetComponentsInChildren<MapValuable>(true); MapValuable[] array = componentsInChildren; foreach (MapValuable val in array) { ((Component)val).gameObject.SetActive(!spectating); } } } } internal class NetworkController : MonoBehaviourPun { [PunRPC] internal void HideValuables() { if (!DeadMap.hideValuables) { DeadMap.hideValuables = true; DeadMap.Logger.LogInfo((object)"Valuables set to hidden."); } } } } namespace DeadMapAccess.patches { [HarmonyPatch(typeof(DirtFinderMapPlayer))] internal static class DirtFinderMapPlayerPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(DirtFinderMapPlayer __instance) { Camera componentInChildren = ((Component)__instance).GetComponentInChildren<Camera>(); if (((Object)componentInChildren).name != "Dirt Finder Map Camera") { DeadMap.Logger.LogWarning((object)"Dirt Finder Map Camera not found in map children."); } else if ((Object)(object)DeadMap.camera == (Object)null) { DeadMap.camera = componentInChildren; DeadMap.cameraOrthographicDefault = componentInChildren.orthographicSize; } } } [HarmonyPatch(typeof(GameDirector))] internal static class GameDirectorPatch { [HarmonyPrefix] [HarmonyPatch("Revive")] private static void Revive_Prefix() { if (DeadMap.spectating) { DeadMap.SetSpectating(isSpectating: false); } } [HarmonyPrefix] [HarmonyPatch("gameStateStart")] private static void GameStateStart_Prefix() { if (SemiFunc.IsMasterClient() && Configuration.hideValuables.Value) { NetworkController component = ((Component)Map.Instance).gameObject.GetComponent<NetworkController>(); if ((Object)(object)component == (Object)null) { DeadMap.Logger.LogWarning((object)"Failed to send hide valuables event: Network controller is null."); return; } ((MonoBehaviourPun)component).photonView.RPC("HideValuables", (RpcTarget)0, new object[0]); } if (DeadMap.spectating) { DeadMap.SetSpectating(isSpectating: false); } } } [HarmonyPatch(typeof(Map))] internal static class MapPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(Map __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent<NetworkController>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<NetworkController>(); } } [HarmonyPostfix] [HarmonyPatch("AddValuable")] private static void AddValuable_Postfix(Map __instance) { if (DeadMap.spectating && DeadMap.hideValuables) { MapValuable[] componentsInChildren = ((Component)__instance.OverLayerParent).GetComponentsInChildren<MapValuable>(); MapValuable[] array = componentsInChildren; foreach (MapValuable val in array) { ((Component)val).gameObject.SetActive(false); } } } } [HarmonyPatch(typeof(PlayerAvatar))] internal static class PlayerAvatarPatch { [HarmonyPrefix] [HarmonyPatch("SetSpectate")] private static void SetSpectate_Prefix() { Map.Instance.ActiveParent.SetActive(true); if ((Object)(object)DeadMap.camera != (Object)null) { ((MonoBehaviour)Map.Instance).StartCoroutine(LoadRenderTexture(DeadMap.camera)); } } private static IEnumerator LoadRenderTexture(Camera camera) { RenderTexture activeTexture = camera.activeTexture; while ((Object)(object)activeTexture == (Object)null) { yield return null; activeTexture = camera.activeTexture; } DeadMap.renderTexture = activeTexture; DeadMap.Logger.LogInfo((object)"Loaded map render texture."); } } [HarmonyPatch(typeof(RoundDirector))] internal static class RoundDirectorPatch { [HarmonyPostfix] [HarmonyPatch("StartRound")] private static void StartRound_Postfix() { DeadMap.hideValuables = false; } } [HarmonyPatch(typeof(SpectateCamera))] internal static class SpectateCameraPatch { [HarmonyPrefix] [HarmonyPatch("StateNormal")] private static void StateNormal_Prefix() { if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && !DeadMap.spectating && (Object)(object)SpectateCamera.instance.player != (Object)null) { DeadMap.SetSpectating(isSpectating: true); } } } }