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 Supermans Ping Markers v1.0.0
SupermansPingMarkers.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [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 PingMarker { internal static class Pinger { private static readonly RaycastHit[] Hits = (RaycastHit[])(object)new RaycastHit[32]; private static readonly Regex RichText = new Regex("<[^>]*>"); internal static void PingLookTarget(Player player) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameCamera.instance == (Object)null) { return; } if (!FindTarget(player, out var point, out var label)) { ((Character)player).Message((MessageType)2, "Nothing to ping", 0, (Sprite)null, false); return; } if (Plugin.SendPing.Value && (Object)(object)Chat.instance != (Object)null) { Chat.instance.SendPing(point); } if (Plugin.AddMarker.Value && (Object)(object)Minimap.instance != (Object)null) { if (HasNearbyMarker(point, label)) { ((Character)player).Message((MessageType)1, "Pinged: " + label + " (already marked)", 0, (Sprite)null, false); return; } Minimap.instance.AddPin(point, Plugin.MarkerIcon.Value, label, true, false, 0L, default(PlatformUserID)); ((Character)player).Message((MessageType)1, "Pinged & marked: " + label, 0, (Sprite)null, false); } else { ((Character)player).Message((MessageType)1, "Pinged: " + label, 0, (Sprite)null, false); } } private static bool FindTarget(Player player, out Vector3 point, out string label) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; label = null; Transform transform = ((Component)GameCamera.instance).transform; int num = Physics.RaycastNonAlloc(transform.position, transform.forward, Hits, Plugin.MaxDistance.Value, player.m_interactMask); Array.Sort(Hits, 0, num, (IComparer<RaycastHit>?)RaycastHitComparer.Instance); for (int i = 0; i < num; i++) { RaycastHit val = Hits[i]; Rigidbody attachedRigidbody = ((RaycastHit)(ref val)).collider.attachedRigidbody; if (!((Object)(object)attachedRigidbody != (Object)null) || !((Object)(object)((Component)attachedRigidbody).gameObject == (Object)(object)((Component)player).gameObject)) { point = ((RaycastHit)(ref val)).point; label = NameOf(((RaycastHit)(ref val)).collider); return !string.IsNullOrEmpty(label); } } return false; } private static string NameOf(Collider collider) { Character componentInParent = ((Component)collider).GetComponentInParent<Character>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)Player.m_localPlayer) { return Clean(componentInParent.GetHoverName()); } ItemDrop componentInParent2 = ((Component)collider).GetComponentInParent<ItemDrop>(); if ((Object)(object)componentInParent2 != (Object)null) { return Clean(componentInParent2.m_itemData.m_shared.m_name); } Hoverable componentInParent3 = ((Component)collider).GetComponentInParent<Hoverable>(); if (componentInParent3 != null) { string text = Clean(componentInParent3.GetHoverName()); if (!string.IsNullOrEmpty(text)) { return text; } } Piece componentInParent4 = ((Component)collider).GetComponentInParent<Piece>(); if ((Object)(object)componentInParent4 != (Object)null) { return Clean(componentInParent4.m_name); } return null; } private static string Clean(string name) { if (string.IsNullOrEmpty(name)) { return null; } if (Localization.instance != null) { name = Localization.instance.Localize(name); } name = RichText.Replace(name, "").Trim(); if (name.Length != 0) { return name; } return null; } private static bool HasNearbyMarker(Vector3 pos, string label) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) float value = Plugin.DuplicateRadius.Value; foreach (PinData pin in Minimap.instance.m_pins) { if (pin.m_save && pin.m_name == label && Utils.DistanceXZ(pos, pin.m_pos) < value) { return true; } } return false; } } [BepInPlugin("supermans.pingmarkers", "Supermans Ping/Markers", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "supermans.pingmarkers"; public const string Name = "Supermans Ping/Markers"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<bool> ModEnabled; internal static ConfigEntry<KeyCode> KeyA; internal static ConfigEntry<KeyCode> KeyB; internal static ConfigEntry<bool> SendPing; internal static ConfigEntry<bool> AddMarker; internal static ConfigEntry<PinType> MarkerIcon; internal static ConfigEntry<float> MaxDistance; internal static ConfigEntry<float> DuplicateRadius; private void Awake() { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Master switch for the whole mod."); KeyA = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("1 - General", "KeyA", (KeyCode)304, "First key of the ping combo. Hold both keys (any order) while looking at something."); KeyB = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("1 - General", "KeyB", (KeyCode)308, "Second key of the ping combo."); SendPing = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "SendPing", true, "Send a normal map ping (visible to everyone on the server, like middle-clicking the map)."); AddMarker = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "AddMarker", true, "Place a saved map marker labeled with the name of what you pinged."); MarkerIcon = ((BaseUnityPlugin)this).Config.Bind<PinType>("2 - Marker", "MarkerIcon", (PinType)3, "Map icon used for the marker. Icon0 = fire, Icon1 = house, Icon2 = hammer, Icon3 = dot, Icon4 = cave."); MaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Marker", "MaxDistance", 100f, new ConfigDescription("How far away (meters) you can ping things.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 500f), Array.Empty<object>())); DuplicateRadius = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Marker", "DuplicateRadius", 5f, "No new marker is added if one with the same label already exists within this many meters (the ping is still sent)."); Log.LogInfo((object)"Supermans Ping/Markers 1.0.0 loaded"); } private void Update() { if (ModEnabled.Value && ZInput.instance != null && !((Object)(object)Player.m_localPlayer == (Object)null) && ComboPressed() && !IsBusy()) { Pinger.PingLookTarget(Player.m_localPlayer); } } private static bool ComboPressed() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) KeyCode value = KeyA.Value; KeyCode value2 = KeyB.Value; if ((int)value == 0 || (int)value2 == 0) { return false; } if (!ZInput.GetKey(value, false) || !ZInput.GetKey(value2, false)) { return false; } if (!ZInput.GetKeyDown(value, false)) { return ZInput.GetKeyDown(value2, false); } return true; } private static bool IsBusy() { if ((!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !TextInput.IsVisible() && !Menu.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Minimap.IsOpen()) { return ((Character)Player.m_localPlayer).IsDead(); } return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }