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 RadiusDetectionPatchForPinAssistant v1.5.0
BepInEx/plugins/PinAssistantRadiusPatch.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using 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 HarmonyLib; using Splatform; using UnityEngine; using WxAxW.PinAssistant.Core; using WxAxW.PinAssistant.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("PinAssistantRadiusPatch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PinAssistantRadiusPatch")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1e2fbbcd-1b9c-4956-8b09-1d343d666154")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace PinAssistantRadiusPatch; [BepInPlugin("Mervil.pinassistantradiuspatch", "PinAssistant Radius Detection Patch", "1.5.0")] public class MervilsRadiusPlugin : BaseUnityPlugin { internal static ConfigEntry<bool> radiusDetectionEnabled; internal static ConfigEntry<float> radiusDetectionInterval; internal static ConfigEntry<bool> useFullExplorationRadius; internal static ConfigEntry<float> radiusDetectionRadius; internal static ConfigEntry<KeyboardShortcut> radiusDetectionToggleKey; internal static ConfigEntry<bool> radiusDebugMode; private void Awake() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown radiusDetectionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RadiusDetectionEnabled", true, "Enable radius-based object detection. If false, only direct visualization detection will be used."); radiusDetectionInterval = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RadiusDetectionInterval", 1f, "Time in seconds between automatic radius detection scans."); useFullExplorationRadius = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UsePlayerExploreRadius", true, "If true, radius detection uses the player's current map exploration radius. If false, it uses the configured RadiusDetectionRadius."); radiusDetectionRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RadiusDetectionRadius", 50f, "The radius around the player to detect pins (in Unity units, ~meters)."); radiusDetectionToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "RadiusDetectionToggleKey", new KeyboardShortcut((KeyCode)292, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "Hotkey to toggle radius detection on/off."); radiusDebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "RadiusDebugMode", false, "Enable debug logging."); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Mervil.pinassistantradiuspatch"); GameObject val = new GameObject("RadiusPinDetector"); val.AddComponent<RadiusPinDetector>(); Object.DontDestroyOnLoad((Object)(object)val); } } public class RadiusPinDetector : MonoBehaviour { private class PinState { public string NormalizedName; public string PrefabName; public ZDOID ZdoID; public bool Mobile; public Vector3 LastPosition; public GameObject PinnedObject; public PinData Pin; public bool WasManuallyRemoved; public bool WasBlackListed; public string MatchedTrackedObjectName; } private struct ExactMatchStatus { public bool Current; public bool Previous; } private struct BlackListData { public string OriginalString; public HashSet<string> ParsedWords; } [CompilerGenerated] private sealed class <RadiusDetectorCoroutine>d__38 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RadiusPinDetector <>4__this; private GameObject[] <allObjects>5__1; private int <currentIndex>5__2; private int <allObjectsLength>5__3; private PlatformUserID <localPlatformID>5__4; private float <batchStartTime>5__5; private int <batchSize>5__6; private Vector3 <playerPos>5__7; private float <scanRadius>5__8; private float <elapsed>5__9; private float <waitTime>5__10; private Dictionary<string, TrieNode<TrackedObject>>.Enumerator <>s__11; private KeyValuePair<string, TrieNode<TrackedObject>> <kvp>5__12; private string <trackedObjectKey>5__13; private TrackedObject <trackedObject>5__14; private string <customName>5__15; private PinType <icon>5__16; private string <trackedObjectGroupKey>5__17; private Exception <ex>5__18; private HashSet<string> <currentAltKeys>5__19; private HashSet<string> <normalizedKeys>5__20; private bool <setHasChanged>5__21; private Dictionary<string, string> <oldGroupKeyToTrackedObject>5__22; private int <preRestorationCount>5__23; private Dictionary<string, TrieNode<TrackedObject>>.Enumerator <>s__24; private KeyValuePair<string, TrieNode<TrackedObject>> <kvp>5__25; private string <key>5__26; private TrackedObject <trackedObject>5__27; private bool <currentExactMatch>5__28; private bool <needsUpdate>5__29; private string <currentBlackListWords>5__30; private bool <needsBlackListUpdate>5__31; private Exception <ex>5__32; private bool <hadPreviousValue>5__33; private bool <previousExactMatch>5__34; private Exception <ex>5__35; private bool <hadPreviousBlackList>5__36; private HashSet<string> <parsedWords>5__37; private string[] <words>5__38; private string[] <>s__39; private int <>s__40; private string <word>5__41; private string <trimmed>5__42; private string <customName>5__43; private PinType <icon>5__44; private string <trackedObjectGroupKey>5__45; private Exception <ex>5__46; private Exception <ex>5__47; private List<PinData> <stampList>5__48; private List<PinData> <pinsList>5__49; private int <stamped>5__50; private List<PinData>.Enumerator <>s__51; private PinData <pin>5__52; private string <trackedObjectGroupKey>5__53; private int <archivedCount>5__54; private Dictionary<string, int> <archivedByType>5__55; private Dictionary<PinData, PinState> <pinToPinState>5__56; private Dictionary<ZDOID, PinState>.Enumerator <>s__57; private KeyValuePair<ZDOID, PinState> <kvp>5__58; private List<PinData>.Enumerator <>s__59; private PinData <pin>5__60; private string <trackedObjectNameToArchiveUnder>5__61; private PinState <existingPinState>5__62; private string <trackedObjectGroupKey>5__63; private PinState <archivedPinState>5__64; private Exception <ex>5__65; private Dictionary<ZDO, ZNetView> <instanceDict>5__66; private Exception <ex>5__67; private Exception <ex>5__68; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RadiusDetectorCoroutine>d__38(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) <allObjects>5__1 = null; <localPlatformID>5__4 = default(PlatformUserID); <>s__11 = default(Dictionary<string, TrieNode<TrackedObject>>.Enumerator); <kvp>5__12 = default(KeyValuePair<string, TrieNode<TrackedObject>>); <trackedObjectKey>5__13 = null; <trackedObject>5__14 = null; <customName>5__15 = null; <trackedObjectGroupKey>5__17 = null; <ex>5__18 = null; <currentAltKeys>5__19 = null; <normalizedKeys>5__20 = null; <oldGroupKeyToTrackedObject>5__22 = null; <>s__24 = default(Dictionary<string, TrieNode<TrackedObject>>.Enumerator); <kvp>5__25 = default(KeyValuePair<string, TrieNode<TrackedObject>>); <key>5__26 = null; <trackedObject>5__27 = null; <currentBlackListWords>5__30 = null; <ex>5__32 = null; <ex>5__35 = null; <parsedWords>5__37 = null; <words>5__38 = null; <>s__39 = null; <word>5__41 = null; <trimmed>5__42 = null; <customName>5__43 = null; <trackedObjectGroupKey>5__45 = null; <ex>5__46 = null; <ex>5__47 = null; <stampList>5__48 = null; <pinsList>5__49 = null; <>s__51 = default(List<PinData>.Enumerator); <pin>5__52 = null; <trackedObjectGroupKey>5__53 = null; <archivedByType>5__55 = null; <pinToPinState>5__56 = null; <>s__57 = default(Dictionary<ZDOID, PinState>.Enumerator); <kvp>5__58 = default(KeyValuePair<ZDOID, PinState>); <>s__59 = default(List<PinData>.Enumerator); <pin>5__60 = null; <trackedObjectNameToArchiveUnder>5__61 = null; <existingPinState>5__62 = null; <trackedObjectGroupKey>5__63 = null; <archivedPinState>5__64 = null; <ex>5__65 = null; <instanceDict>5__66 = null; <ex>5__67 = null; <ex>5__68 = null; <>1__state = -2; } private bool MoveNext() { //IL_167a: Unknown result type (might be due to invalid IL or missing references) //IL_1684: Expected O, but got Unknown //IL_150a: Unknown result type (might be due to invalid IL or missing references) //IL_14f3: Unknown result type (might be due to invalid IL or missing references) //IL_150f: Unknown result type (might be due to invalid IL or missing references) //IL_15b2: Unknown result type (might be due to invalid IL or missing references) //IL_1608: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Expected O, but got Unknown //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Expected O, but got Unknown //IL_0b6a: Unknown result type (might be due to invalid IL or missing references) //IL_0b6f: Unknown result type (might be due to invalid IL or missing references) //IL_0b7c: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0dae: Unknown result type (might be due to invalid IL or missing references) //IL_0db3: Unknown result type (might be due to invalid IL or missing references) //IL_0dd6: Unknown result type (might be due to invalid IL or missing references) //IL_0e08: Unknown result type (might be due to invalid IL or missing references) //IL_0e0d: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_0fab: Unknown result type (might be due to invalid IL or missing references) //IL_0fb0: Unknown result type (might be due to invalid IL or missing references) //IL_1027: Unknown result type (might be due to invalid IL or missing references) //IL_1149: Unknown result type (might be due to invalid IL or missing references) //IL_114e: Unknown result type (might be due to invalid IL or missing references) //IL_1179: Unknown result type (might be due to invalid IL or missing references) //IL_117e: Unknown result type (might be due to invalid IL or missing references) //IL_1133: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_02b9; case 1: <>1__state = -1; goto IL_02b9; case 2: <>1__state = -1; goto IL_1695; case 3: <>1__state = -1; goto IL_1695; case 4: <>1__state = -1; break; case 5: { <>1__state = -1; goto IL_1695; } IL_02b9: if ((Object)(object)<>4__this.m_player == (Object)null || (Object)(object)<>4__this.m_minimap == (Object)null || (Object)(object)<>4__this.znetScene == (Object)null) { if ((Object)(object)<>4__this.m_player == (Object)null && (Object)(object)Player.m_localPlayer != (Object)null) { <>4__this.m_player = Player.m_localPlayer; <>4__this.m_localPlayerID = <>4__this.m_player.GetPlayerID(); <localPlatformID>5__4 = ((IUser)PlatformManager.DistributionPlatform.LocalUser).PlatformUserID; ModAuthorID = new PlatformUserID("PinAssistantRadiusPatch", ((object)(PlatformUserID)(ref <localPlatformID>5__4)).ToString()); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)("[RadiusPinDetector][INIT] Player found: " + ((Object)<>4__this.m_player).name)); Debug.Log((object)$"[RadiusPinDetector][INIT] Initialized ModAuthorID: {ModAuthorID}"); } <localPlatformID>5__4 = default(PlatformUserID); } if ((Object)(object)<>4__this.m_minimap == (Object)null && (Object)(object)Minimap.instance != (Object)null) { <>4__this.m_minimap = Minimap.instance; <>4__this.minimapPinsField = typeof(Minimap).GetField("m_pins", BindingFlags.Instance | BindingFlags.NonPublic); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][INIT] Minimap instance found."); } } if ((Object)(object)<>4__this.znetScene == (Object)null && (Object)(object)ZNetScene.instance != (Object)null) { <>4__this.znetScene = ZNetScene.instance; <>4__this.znetInstancesField = typeof(ZNetScene).GetField("m_instances", BindingFlags.Instance | BindingFlags.NonPublic); <>4__this.locationProxyInstanceField = typeof(LocationProxy).GetField("m_instance", BindingFlags.Instance | BindingFlags.NonPublic); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][INIT] ZNetScene.instance is ready!"); } } if (((Object)(object)<>4__this.m_player == (Object)null || (Object)(object)<>4__this.m_minimap == (Object)null || (Object)(object)<>4__this.znetScene == (Object)null) && MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][WAIT] Waiting for asset initiation..."); } <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; } if (!<>4__this.InitializePinAssistantReferences()) { return false; } <allObjects>5__1 = Array.Empty<GameObject>(); <currentIndex>5__2 = 0; <allObjectsLength>5__3 = 0; goto IL_1695; IL_1695: if (!<>4__this.AreCoreReferencesValid() && !<>4__this.ReInitializeCoreReferences()) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][WAIT] Core references still unavailable, waiting 5 seconds..."); } <>2__current = (object)new WaitForSeconds(5f); <>1__state = 2; return true; } if (!<>4__this.ArePinAssistantReferencesValid()) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][WAIT] PinAssistant references invalid, refreshing..."); } if (!<>4__this.InitializePinAssistantReferences()) { return false; } } <batchStartTime>5__5 = Time.realtimeSinceStartup; if (!MervilsRadiusPlugin.radiusDetectionEnabled.Value) { <>2__current = (object)new WaitForSeconds(MervilsRadiusPlugin.radiusDetectionInterval.Value); <>1__state = 3; return true; } try { PinAssistantReflectionHelper.AltDictionaryInstance = PinAssistantReflectionHelper.AltDictionaryProperty.GetValue(PinAssistantReflectionHelper.TrackedObjectsInstance) as Dictionary<string, TrieNode<TrackedObject>>; if (PinAssistantReflectionHelper.AltDictionaryInstance != null && <>4__this.groupKeyToTrackedObject.Count == 0) { <>s__11 = PinAssistantReflectionHelper.AltDictionaryInstance.GetEnumerator(); try { while (<>s__11.MoveNext()) { <kvp>5__12 = <>s__11.Current; <trackedObjectKey>5__13 = NormalizeName(<kvp>5__12.Key); <trackedObject>5__14 = <kvp>5__12.Value?.Value; if (<trackedObject>5__14 != null) { try { <customName>5__15 = NormalizeName(<trackedObject>5__14.Name); <icon>5__16 = <trackedObject>5__14.Icon; if (<customName>5__15 != null) { <trackedObjectGroupKey>5__17 = GetTrackedObjectGroupKey(<customName>5__15, <icon>5__16); <>4__this.groupKeyToTrackedObject[<trackedObjectGroupKey>5__17] = <trackedObjectKey>5__13; <trackedObjectGroupKey>5__17 = null; } <customName>5__15 = null; } catch (Exception ex) { <ex>5__18 = ex; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)$"[RadiusPinDetector][WARN] Failed to build pin key mapping for '{<trackedObjectKey>5__13}': {<ex>5__18}."); } } } <trackedObjectKey>5__13 = null; <trackedObject>5__14 = null; <kvp>5__12 = default(KeyValuePair<string, TrieNode<TrackedObject>>); } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(Dictionary<string, TrieNode<TrackedObject>>.Enumerator); } if (PinAssistantReflectionHelper.AltDictionaryInstance != null) { <currentAltKeys>5__19 = new HashSet<string>(PinAssistantReflectionHelper.AltDictionaryInstance.Keys, StringComparer.OrdinalIgnoreCase); <normalizedKeys>5__20 = <currentAltKeys>5__19.Select((string k) => NormalizeName(k)).ToHashSet<string>(StringComparer.OrdinalIgnoreCase); <setHasChanged>5__21 = !<normalizedKeys>5__20.SetEquals(<>4__this.allowedNames.Where((string name) => !name.EndsWith("_frac"))); <oldGroupKeyToTrackedObject>5__22 = null; <preRestorationCount>5__23 = 0; if (<setHasChanged>5__21) { <oldGroupKeyToTrackedObject>5__22 = new Dictionary<string, string>(<>4__this.groupKeyToTrackedObject, StringComparer.OrdinalIgnoreCase); <>4__this.allowedNames.Clear(); <>4__this.groupKeyToTrackedObject.Clear(); <preRestorationCount>5__23 = <>4__this.removedPinsForRestoration.Count; } <>s__24 = PinAssistantReflectionHelper.AltDictionaryInstance.GetEnumerator(); try { while (<>s__24.MoveNext()) { <kvp>5__25 = <>s__24.Current; <key>5__26 = NormalizeName(<kvp>5__25.Key); <trackedObject>5__27 = <kvp>5__25.Value?.Value; if (<trackedObject>5__27 != null) { <currentExactMatch>5__28 = true; try { <currentExactMatch>5__28 = <trackedObject>5__27.IsExactMatchOnly; } catch (Exception ex) { <ex>5__32 = ex; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)$"[RadiusPinDetector][WARN] Failed to read IsExactMatchOnly for '{<key>5__26}': {<ex>5__32}. Defaulting to true."); } } <needsUpdate>5__29 = !<>4__this.exactMatchStatus.ContainsKey(<key>5__26) || <>4__this.exactMatchStatus[<key>5__26].Current != <currentExactMatch>5__28; if (<needsUpdate>5__29) { <hadPreviousValue>5__33 = <>4__this.exactMatchStatus.ContainsKey(<key>5__26); <previousExactMatch>5__34 = !<hadPreviousValue>5__33 || <>4__this.exactMatchStatus[<key>5__26].Current; <>4__this.exactMatchStatus[<key>5__26] = new ExactMatchStatus { Current = <currentExactMatch>5__28, Previous = <previousExactMatch>5__34 }; if ((<hadPreviousValue>5__33 & <previousExactMatch>5__34) && !<currentExactMatch>5__28) { <>4__this.RestoreManuallyRemovedPins(<key>5__26); } } <currentBlackListWords>5__30 = string.Empty; try { <currentBlackListWords>5__30 = <trackedObject>5__27.BlackListWords ?? string.Empty; } catch (Exception ex) { <ex>5__35 = ex; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)$"[RadiusPinDetector][WARN] Failed to read BlackListWords for '{<key>5__26}': {<ex>5__35}. Defaulting to empty."); } } <needsBlackListUpdate>5__31 = !<>4__this.blackListWords.ContainsKey(<key>5__26) || <>4__this.blackListWords[<key>5__26].OriginalString != <currentBlackListWords>5__30; if (<needsBlackListUpdate>5__31) { <hadPreviousBlackList>5__36 = <>4__this.blackListWords.ContainsKey(<key>5__26); <parsedWords>5__37 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); if (!string.IsNullOrWhiteSpace(<currentBlackListWords>5__30)) { <words>5__38 = <currentBlackListWords>5__30.Split(new char[1] { ',' }); <>s__39 = <words>5__38; for (<>s__40 = 0; <>s__40 < <>s__39.Length; <>s__40++) { <word>5__41 = <>s__39[<>s__40]; <trimmed>5__42 = <word>5__41.Trim(); if (!string.IsNullOrEmpty(<trimmed>5__42)) { <parsedWords>5__37.Add(<trimmed>5__42.ToLowerInvariant()); } <trimmed>5__42 = null; <word>5__41 = null; } <>s__39 = null; <words>5__38 = null; } <>4__this.blackListWords[<key>5__26] = new BlackListData { OriginalString = <currentBlackListWords>5__30, ParsedWords = <parsedWords>5__37 }; if (<hadPreviousBlackList>5__36) { <>4__this.UpdatePinsForBlackListChange(<key>5__26); } <parsedWords>5__37 = null; } if (<setHasChanged>5__21) { <>4__this.allowedNames.Add(<key>5__26); <>4__this.allowedNames.Add(<key>5__26 + "_frac"); <customName>5__43 = NormalizeName(<trackedObject>5__27.Name); if (<customName>5__43 != null) { try { <icon>5__44 = <trackedObject>5__27.Icon; <trackedObjectGroupKey>5__45 = GetTrackedObjectGroupKey(<customName>5__43, <icon>5__44); <>4__this.groupKeyToTrackedObject[<trackedObjectGroupKey>5__45] = <key>5__26; <trackedObjectGroupKey>5__45 = null; } catch (Exception ex) { <ex>5__46 = ex; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)$"[RadiusPinDetector][WARN] Failed to read Icon for '{<key>5__26}': {<ex>5__46}. Skipping pin key mapping."); } } } if (<>4__this.removedPinsForRestoration.ContainsKey(<key>5__26)) { try { <>4__this.RestoreRemovedPins(<key>5__26); } catch (Exception ex) { <ex>5__47 = ex; Debug.LogError((object)$"[RadiusPinDetector][ERROR] Failed to restore pins for '{<key>5__26}': {<ex>5__47}. Continuing with other objects."); <>4__this.removedPinsForRestoration.Remove(<key>5__26); } } <customName>5__43 = null; } <currentBlackListWords>5__30 = null; } <key>5__26 = null; <trackedObject>5__27 = null; <kvp>5__25 = default(KeyValuePair<string, TrieNode<TrackedObject>>); } } finally { ((IDisposable)<>s__24).Dispose(); } <>s__24 = default(Dictionary<string, TrieNode<TrackedObject>>.Enumerator); if (<setHasChanged>5__21) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)string.Format("[RadiusPinDetector][INFO] AltDictionary contains {0} entries: {1}", PinAssistantReflectionHelper.AltDictionaryInstance.Count, string.Join(", ", PinAssistantReflectionHelper.AltDictionaryInstance.Keys))); Debug.Log((object)$"[RadiusPinDetector][INFO] AllowedNames updated to match. Total entries: {<>4__this.allowedNames.Count}. Pins restored from archive: {<preRestorationCount>5__23 - <>4__this.removedPinsForRestoration.Count}."); } <stampList>5__48 = <>4__this.GetPinsList(); if (<stampList>5__48 != null) { <stamped>5__50 = 0; <>s__51 = <stampList>5__48.GetEnumerator(); try { while (<>s__51.MoveNext()) { <pin>5__52 = <>s__51.Current; if (<pin>5__52.m_author == PlatformUserID.None) { <trackedObjectGroupKey>5__53 = GetTrackedObjectGroupKey(<pin>5__52.m_name, <pin>5__52.m_type); if (<>4__this.groupKeyToTrackedObject.ContainsKey(<trackedObjectGroupKey>5__53)) { <pin>5__52.m_author = ModAuthorID; } <trackedObjectGroupKey>5__53 = null; } <pin>5__52 = null; } } finally { ((IDisposable)<>s__51).Dispose(); } <>s__51 = default(List<PinData>.Enumerator); if (MervilsRadiusPlugin.radiusDebugMode.Value && <stamped>5__50 > 0) { Debug.Log((object)$"[RadiusPinDetector][INIT] Retroactively stamped {<stamped>5__50} existing pins with mod author ID"); } } <pinsList>5__49 = <>4__this.GetPinsList(); if (<pinsList>5__49 != null) { <archivedCount>5__54 = 0; <archivedByType>5__55 = new Dictionary<string, int>(); <pinToPinState>5__56 = new Dictionary<PinData, PinState>(); <>s__57 = <>4__this.alreadyPinned.GetEnumerator(); try { while (<>s__57.MoveNext()) { <kvp>5__58 = <>s__57.Current; if (<kvp>5__58.Value.Pin != null) { <pinToPinState>5__56[<kvp>5__58.Value.Pin] = <kvp>5__58.Value; } <kvp>5__58 = default(KeyValuePair<ZDOID, PinState>); } } finally { ((IDisposable)<>s__57).Dispose(); } <>s__57 = default(Dictionary<ZDOID, PinState>.Enumerator); <>s__59 = <pinsList>5__49.ToList().GetEnumerator(); try { while (<>s__59.MoveNext()) { <pin>5__60 = <>s__59.Current; if (<pin>5__60.m_author == ModAuthorID) { <trackedObjectNameToArchiveUnder>5__61 = null; <existingPinState>5__62 = null; if (<pinToPinState>5__56.TryGetValue(<pin>5__60, out <existingPinState>5__62)) { <trackedObjectNameToArchiveUnder>5__61 = <existingPinState>5__62.MatchedTrackedObjectName; } if (<trackedObjectNameToArchiveUnder>5__61 == null) { <trackedObjectGroupKey>5__63 = GetTrackedObjectGroupKey(<pin>5__60.m_name, <pin>5__60.m_type); if (<>4__this.groupKeyToTrackedObject.ContainsKey(<trackedObjectGroupKey>5__63)) { continue; } if (<oldGroupKeyToTrackedObject>5__22 != null && <oldGroupKeyToTrackedObject>5__22.ContainsKey(<trackedObjectGroupKey>5__63)) { <trackedObjectNameToArchiveUnder>5__61 = <oldGroupKeyToTrackedObject>5__22[<trackedObjectGroupKey>5__63]; } <trackedObjectGroupKey>5__63 = null; } if (<trackedObjectNameToArchiveUnder>5__61 != null && !<>4__this.allowedNames.Contains(<trackedObjectNameToArchiveUnder>5__61)) { if (!<>4__this.removedPinsForRestoration.ContainsKey(<trackedObjectNameToArchiveUnder>5__61)) { <>4__this.removedPinsForRestoration[<trackedObjectNameToArchiveUnder>5__61] = new List<PinState>(); } if (<existingPinState>5__62 != null) { <archivedPinState>5__64 = <existingPinState>5__62; <>4__this.alreadyPinned.Remove(<existingPinState>5__62.ZdoID); } else { <archivedPinState>5__64 = new PinState { ZdoID = ZDOID.None, NormalizedName = <trackedObjectNameToArchiveUnder>5__61, PrefabName = <trackedObjectNameToArchiveUnder>5__61, Mobile = false, LastPosition = <pin>5__60.m_pos, PinnedObject = null, Pin = <pin>5__60, WasManuallyRemoved = false, WasBlackListed = false, MatchedTrackedObjectName = <trackedObjectNameToArchiveUnder>5__61 }; } <>4__this.removedPinsForRestoration[<trackedObjectNameToArchiveUnder>5__61].Add(<archivedPinState>5__64); <archivedCount>5__54++; if (!<archivedByType>5__55.ContainsKey(<trackedObjectNameToArchiveUnder>5__61)) { <archivedByType>5__55[<trackedObjectNameToArchiveUnder>5__61] = 0; } <archivedByType>5__55[<trackedObjectNameToArchiveUnder>5__61]++; Minimap.instance.RemovePin(<pin>5__60); <archivedPinState>5__64 = null; } <trackedObjectNameToArchiveUnder>5__61 = null; <existingPinState>5__62 = null; } <pin>5__60 = null; } } finally { ((IDisposable)<>s__59).Dispose(); } <>s__59 = default(List<PinData>.Enumerator); if (MervilsRadiusPlugin.radiusDebugMode.Value && <archivedCount>5__54 > 0) { Debug.Log((object)string.Format("[RadiusPinDetector][CLEANUP] Archived {0} pins: {1}", <archivedCount>5__54, string.Join(", ", <archivedByType>5__55.Select((KeyValuePair<string, int> kvp) => $"{kvp.Key}({kvp.Value})")))); } <archivedByType>5__55 = null; <pinToPinState>5__56 = null; } <stampList>5__48 = null; <pinsList>5__49 = null; } <currentAltKeys>5__19 = null; <normalizedKeys>5__20 = null; <oldGroupKeyToTrackedObject>5__22 = null; } else if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] AltDictionary is null! PinAssistant's tracked objects cannot be read."); } } catch (Exception ex) { <ex>5__65 = ex; Debug.LogError((object)$"[RadiusPinDetector][ERROR] PinAssistant reflection failed: {<ex>5__65}. Continuing with existing allowedNames."); } try { if ((<allObjects>5__1.Length == 0 || <currentIndex>5__2 >= <allObjectsLength>5__3) && (Object)(object)<>4__this.znetScene != (Object)null && <>4__this.znetInstancesField != null) { <instanceDict>5__66 = <>4__this.znetInstancesField.GetValue(<>4__this.znetScene) as Dictionary<ZDO, ZNetView>; if (<instanceDict>5__66 != null) { <allObjects>5__1 = (from z in <instanceDict>5__66.Values where (Object)(object)z != (Object)null && (Object)(object)((Component)z).gameObject != (Object)null select ((Component)z).gameObject).ToArray(); } <instanceDict>5__66 = null; } } catch (Exception ex) { <ex>5__67 = ex; Debug.LogError((object)$"[RadiusPinDetector][ERROR] ZNetScene object retrieval failed: {<ex>5__67}. Using empty object array for this cycle."); <allObjects>5__1 = Array.Empty<GameObject>(); } <currentIndex>5__2 = 0; <allObjectsLength>5__3 = <allObjects>5__1.Length; <batchSize>5__6 = Mathf.Clamp(<allObjectsLength>5__3 / 60, 50, 200); <playerPos>5__7 = (((Object)(object)<>4__this.m_player != (Object)null) ? ((Component)<>4__this.m_player).transform.position : Vector3.zero); <>4__this.scanCyclePinsCreated = 0; <>4__this.scanCycleObjectsCorrelated = 0; <>4__this.scanCycleObjectsClustered = 0; <>4__this.scanCycleSkippedAlreadyPinned = 0; <>4__this.scanCycleSkippedPreviouslyFound = 0; <>4__this.scanCycleObjectsBlackListed = 0; <>4__this.scanCycleSkippedByType.Clear(); <scanRadius>5__8 = <>4__this.ResolveScanRadius(); <>4__this.UpdateRedundancyDistances(); break; } if (<currentIndex>5__2 < <allObjectsLength>5__3) { <>4__this.ProcessAllObjectsInBatches(<allObjects>5__1, ref <currentIndex>5__2, <batchSize>5__6, <allObjectsLength>5__3, <scanRadius>5__8, <playerPos>5__7, <>4__this.allowedNames); <>2__current = null; <>1__state = 4; return true; } try { <>4__this.CleanUpPinCache(<>4__this.allowedNames, <playerPos>5__7, <scanRadius>5__8); } catch (Exception ex) { <ex>5__68 = ex; Debug.LogError((object)$"[RadiusPinDetector][ERROR] CleanUpPinCache failed: {<ex>5__68}. Continuing to next scan cycle."); } <elapsed>5__9 = Time.realtimeSinceStartup - <batchStartTime>5__5; <waitTime>5__10 = Mathf.Max(0f, MervilsRadiusPlugin.radiusDetectionInterval.Value - <elapsed>5__9); <>2__current = (object)new WaitForSeconds(<waitTime>5__10); <>1__state = 5; return true; } 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 static PlatformUserID ModAuthorID = PlatformUserID.None; private Player m_player; private long m_localPlayerID = 0L; private Minimap m_minimap; private FieldInfo minimapPinsField; private ZNetScene znetScene; private FieldInfo znetInstancesField; private FieldInfo locationProxyInstanceField; private float redundancyDistanceSame = 1f; private float redundancyDistanceAny = 1f; private float lastRedundancyRefreshTime = 0f; private const float redundancyRefreshInterval = 5f; private ConfigEntry<float> cachedSameConfigEntry; private ConfigEntry<float> cachedAnyConfigEntry; private Dictionary<ZDOID, PinState> alreadyPinned = new Dictionary<ZDOID, PinState>(); private Dictionary<ZDOID, PinState> foundAndNotPinned = new Dictionary<ZDOID, PinState>(); private Dictionary<string, bool> prefabMobilityCache = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase); private Dictionary<string, List<PinState>> removedPinsForRestoration = new Dictionary<string, List<PinState>>(StringComparer.OrdinalIgnoreCase); private Dictionary<Vector3, PinData> existingPinsForCorrelation = new Dictionary<Vector3, PinData>(); private Dictionary<Vector3, PinData> nearbyOrphanedPins = new Dictionary<Vector3, PinData>(); private Dictionary<string, string> groupKeyToTrackedObject = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private HashSet<string> allowedNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private Dictionary<string, ExactMatchStatus> exactMatchStatus = new Dictionary<string, ExactMatchStatus>(StringComparer.OrdinalIgnoreCase); private Dictionary<string, BlackListData> blackListWords = new Dictionary<string, BlackListData>(StringComparer.OrdinalIgnoreCase); private int scanCyclePinsCreated = 0; private int scanCycleObjectsCorrelated = 0; private int scanCycleObjectsClustered = 0; private int scanCycleSkippedAlreadyPinned = 0; private int scanCycleSkippedPreviouslyFound = 0; private int scanCycleObjectsBlackListed = 0; private Dictionary<string, int> scanCycleSkippedByType = new Dictionary<string, int>(); private static readonly Type[] MobileTypes = new Type[6] { typeof(Humanoid), typeof(Character), typeof(AnimalAI), typeof(RandomFlyingBird), typeof(Vagon), typeof(Ship) }; private static bool IsMobile(GameObject targetObject) { Type[] mobileTypes = MobileTypes; foreach (Type type in mobileTypes) { if ((Object)(object)targetObject.GetComponent(type) != (Object)null) { return true; } } return false; } private void Start() { ((MonoBehaviour)this).StartCoroutine(RadiusDetectorCoroutine()); } private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (MervilsRadiusPlugin.radiusDetectionToggleKey == null) { return; } KeyboardShortcut value = MervilsRadiusPlugin.radiusDetectionToggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { MervilsRadiusPlugin.radiusDetectionEnabled.Value = !MervilsRadiusPlugin.radiusDetectionEnabled.Value; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][INFO] Radius detection toggled: {MervilsRadiusPlugin.radiusDetectionEnabled.Value}"); } } } [IteratorStateMachine(typeof(<RadiusDetectorCoroutine>d__38))] private IEnumerator RadiusDetectorCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RadiusDetectorCoroutine>d__38(0) { <>4__this = this }; } private bool InitializePinAssistantReferences() { //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) Type type = null; Type type2 = null; Assembly pinAssistantAssembly = PinAssistantReflectionHelper.GetPinAssistantAssembly(); if (pinAssistantAssembly != null) { type = pinAssistantAssembly.GetType("WxAxW.PinAssistant.Core.TrackingHandler"); type2 = pinAssistantAssembly.GetType("WxAxW.PinAssistant.Configuration.ModConfig"); } else { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] PinAssistant assembly not found via helper in Coroutine. Attempting full assembly scan."); } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (type == null) { type = assembly.GetType("WxAxW.PinAssistant.Core.TrackingHandler"); } if (type2 == null) { type2 = assembly.GetType("WxAxW.PinAssistant.Configuration.ModConfig"); } if (type != null && type2 != null) { break; } } } if (type == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] Could not find WxAxW.PinAssistant.Core.TrackingHandler type."); return false; } if (type2 == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] Could not find WxAxW.PinAssistant.Core.ModConfig type."); return false; } PropertyInfo property = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); if (property == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] TrackingHandler.Instance property not found."); return false; } PinAssistantReflectionHelper.TrackingHandlerInstance = property.GetValue(null); if (PinAssistantReflectionHelper.TrackingHandlerInstance == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] TrackingHandler.Instance is null."); return false; } PropertyInfo property2 = type2.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); if (property2 == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] ModConfig.Instance property not found."); return false; } PinAssistantReflectionHelper.ModConfigInstance = property2.GetValue(null); if (PinAssistantReflectionHelper.ModConfigInstance == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] ModConfig.Instance is null."); return false; } PinAssistantReflectionHelper.AddObjAsPinMethod = type.GetMethod("AddObjAsPin", BindingFlags.Instance | BindingFlags.Public); if (PinAssistantReflectionHelper.AddObjAsPinMethod == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] AddObjAsPin method not found on TrackingHandler."); return false; } PinAssistantReflectionHelper.AddObjAsPinDelegate = delegate(string name, GameObject gameObj) { PinAssistantReflectionHelper.AddObjAsPinMethod.Invoke(PinAssistantReflectionHelper.TrackingHandlerInstance, new object[2] { name, gameObj }); }; PinAssistantReflectionHelper.TrackedObjectsField = type.GetField("m_trackedObjects", BindingFlags.Instance | BindingFlags.NonPublic); if (PinAssistantReflectionHelper.TrackedObjectsField == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] m_trackedObjects field not found on TrackingHandler."); return false; } PinAssistantReflectionHelper.TrackedObjectsInstance = PinAssistantReflectionHelper.TrackedObjectsField.GetValue(PinAssistantReflectionHelper.TrackingHandlerInstance); if (PinAssistantReflectionHelper.TrackedObjectsInstance == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] m_trackedObjects from TrackingHandler is null."); } return false; } PinAssistantReflectionHelper.AltDictionaryProperty = PinAssistantReflectionHelper.TrackedObjectsInstance.GetType().GetProperty("AltDictionary", BindingFlags.Instance | BindingFlags.Public); if (PinAssistantReflectionHelper.AltDictionaryProperty == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] AltDictionary property not found on m_trackedObjects object."); return false; } PinAssistantReflectionHelper.AltDictionaryInstance = PinAssistantReflectionHelper.AltDictionaryProperty.GetValue(PinAssistantReflectionHelper.TrackedObjectsInstance) as Dictionary<string, TrieNode<TrackedObject>>; if (PinAssistantReflectionHelper.AltDictionaryInstance == null) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] AltDictionary is null during initialization."); } Type type3 = pinAssistantAssembly?.GetType("WxAxW.PinAssistant.Core.PinHandler"); if (type3 == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] Could not find WxAxW.PinAssistant.Core.PinHandler type."); return false; } PropertyInfo property3 = type3.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); if (property3 == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] PinHandler.Instance property not found."); return false; } PinAssistantReflectionHelper.PinHandlerInstance = property3.GetValue(null); if (PinAssistantReflectionHelper.PinHandlerInstance == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] PinHandler.Instance is null."); return false; } PinAssistantReflectionHelper.M_PinsField = type3.GetField("m_monitoredPins", BindingFlags.Instance | BindingFlags.NonPublic); if (PinAssistantReflectionHelper.M_PinsField == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] Could not find PinHandler.m_monitoredPins field via reflection."); return false; } PinAssistantReflectionHelper.RedundancySameProp = type2.GetProperty("RedundancyDistanceSameConfig", BindingFlags.Instance | BindingFlags.Public); if (PinAssistantReflectionHelper.RedundancySameProp == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] RedundancyDistanceSameConfig property not found on ModConfig."); return false; } PinAssistantReflectionHelper.RedundancyAnyProp = type2.GetProperty("RedundancyDistanceAnyConfig", BindingFlags.Instance | BindingFlags.Public); if (PinAssistantReflectionHelper.RedundancyAnyProp == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] RedundancyDistanceAnyConfig property not found on ModConfig."); return false; } Type type4 = pinAssistantAssembly?.GetType("WxAxW.PinAssistant.Components.TrackObjectUI"); if (type4 == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] Could not find WxAxW.PinAssistant.Components.TrackObjectUI type."); return false; } PinAssistantReflectionHelper.TrackObjectUIInstance = type4.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public)?.GetValue(null); if (PinAssistantReflectionHelper.TrackObjectUIInstance == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] TrackObjectUI.Instance property not found or is null."); return false; } PinAssistantReflectionHelper.TrackObjectUI_m_edittingObject = type4.GetField("m_edittingObject", BindingFlags.Instance | BindingFlags.NonPublic); if (PinAssistantReflectionHelper.TrackObjectUI_m_edittingObject == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] TrackObjectUI.m_edittingObject field not found."); return false; } try { Type type5 = pinAssistantAssembly.GetType("WxAxW.PinAssistant.Patches.MinimapPatches"); if (type5 != null) { EventInfo @event = type5.GetEvent("OnPinAdd", BindingFlags.Static | BindingFlags.Public); if (@event != null) { Delegate handler = Delegate.CreateDelegate(@event.EventHandlerType, this, "OnPinAddedByPinAssistant"); @event.AddEventHandler(null, handler); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][INIT] Subscribed to PinAssistant's OnPinAdd event"); } } else { Debug.LogWarning((object)"[RadiusPinDetector][WARN] Could not find OnPinAdd event in MinimapPatches"); } } } catch (Exception arg) { Debug.LogError((object)$"[RadiusPinDetector][ERROR] Failed to subscribe to OnPinAdd event: {arg}"); } groupKeyToTrackedObject.Clear(); if (PinAssistantReflectionHelper.AltDictionaryInstance != null) { foreach (KeyValuePair<string, TrieNode<TrackedObject>> item in PinAssistantReflectionHelper.AltDictionaryInstance) { string text = NormalizeName(item.Key); TrackedObject val = item.Value?.Value; if (val == null) { continue; } try { string text2 = NormalizeName(val.Name); PinType icon = val.Icon; if (text2 != null) { string trackedObjectGroupKey = GetTrackedObjectGroupKey(text2, icon); groupKeyToTrackedObject[trackedObjectGroupKey] = text; } } catch (Exception arg2) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)$"[RadiusPinDetector][WARN] Failed to build pin key mapping for '{text}': {arg2}."); } } } if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][INIT] Built groupKeyToTrackedObject mapping with {groupKeyToTrackedObject.Count} entries."); } } existingPinsForCorrelation.Clear(); alreadyPinned.Clear(); foundAndNotPinned.Clear(); List<PinData> pinsList = GetPinsList(); if (pinsList != null) { foreach (PinData item2 in pinsList) { if (item2.m_author == ModAuthorID && item2.m_ownerID == 0 && !existingPinsForCorrelation.ContainsKey(item2.m_pos)) { existingPinsForCorrelation[item2.m_pos] = item2; } } if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][INIT] Collected {existingPinsForCorrelation.Count} existing pins for correlation."); } } return true; } private void OnPinAddedByPinAssistant(PinData pin) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!(ModAuthorID == PlatformUserID.None) && pin.m_author == PlatformUserID.None) { string trackedObjectGroupKey = GetTrackedObjectGroupKey(pin.m_name, pin.m_type); if (groupKeyToTrackedObject.ContainsKey(trackedObjectGroupKey)) { pin.m_author = ModAuthorID; } } } private bool ReInitializeCoreReferences() { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][WAIT] Core game references lost, refreshing them..."); } if ((Object)(object)m_player == (Object)null && (Object)(object)Player.m_localPlayer != (Object)null) { m_player = Player.m_localPlayer; m_localPlayerID = m_player.GetPlayerID(); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)("[RadiusPinDetector][INIT] Player reference refreshed: " + ((Object)m_player).name)); } } if ((Object)(object)m_minimap == (Object)null && (Object)(object)Minimap.instance != (Object)null) { m_minimap = Minimap.instance; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][INIT] Minimap reference refreshed."); } } if ((Object)(object)znetScene == (Object)null && (Object)(object)ZNetScene.instance != (Object)null) { znetScene = ZNetScene.instance; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][INIT] ZNetScene reference refreshed."); } } return (Object)(object)m_player != (Object)null && (Object)(object)m_minimap != (Object)null && (Object)(object)znetScene != (Object)null; } private void ProcessAllObjectsInBatches(GameObject[] allObjects, ref int currentIndex, int batchSize, int allObjectsLength, float scanRadius, Vector3 playerPos, HashSet<string> allowedNames) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) if (currentIndex == 0 && existingPinsForCorrelation.Count > 0) { nearbyOrphanedPins = existingPinsForCorrelation.Where(delegate(KeyValuePair<Vector3, PinData> pin) { //IL_0002: 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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Vector3 val6 = pin.Key - playerPos; return ((Vector3)(ref val6)).sqrMagnitude <= scanRadius * scanRadius; }).ToDictionary((KeyValuePair<Vector3, PinData> pin) => pin.Key, (KeyValuePair<Vector3, PinData> pin) => pin.Value); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][SCAN] Found {nearbyOrphanedPins.Count} orphaned pins within scan radius"); } } int num = Math.Min(currentIndex + batchSize, allObjectsLength); for (int i = currentIndex; i < num; i++) { GameObject gameObject = allObjects[i]; if ((Object)(object)gameObject == (Object)null || !gameObject.activeInHierarchy) { continue; } Vector3 val = gameObject.transform.position - playerPos; if (((Vector3)(ref val)).sqrMagnitude > scanRadius * scanRadius) { continue; } ZNetView component = gameObject.GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null) { continue; } LocationProxy component2 = gameObject.GetComponent<LocationProxy>(); if ((Object)(object)component2 != (Object)null && locationProxyInstanceField != null) { object? value = locationProxyInstanceField.GetValue(component2); GameObject val2 = (GameObject)((value is GameObject) ? value : null); if (!((Object)(object)val2 != (Object)null)) { continue; } gameObject = val2; } ZDOID val3 = component.GetZDO()?.m_uid ?? ZDOID.None; if (val3 == ZDOID.None) { continue; } if (alreadyPinned.TryGetValue(val3, out var value2) && !value2.Mobile) { scanCycleSkippedAlreadyPinned++; continue; } if (foundAndNotPinned.TryGetValue(val3, out var value3) && !value3.Mobile) { scanCycleSkippedPreviouslyFound++; string normalizedName = value3.NormalizedName; if (!scanCycleSkippedByType.ContainsKey(normalizedName)) { scanCycleSkippedByType[normalizedName] = 0; } scanCycleSkippedByType[normalizedName]++; continue; } string text; if ((Object)(object)component2 != (Object)null) { text = ((Object)gameObject).name; } else { ZDO zDO = component.GetZDO(); int num2 = ((zDO != null) ? zDO.GetPrefab() : 0); object obj; if (num2 == 0) { obj = null; } else { ZNetScene instance = ZNetScene.instance; obj = ((instance != null) ? instance.GetPrefab(num2) : null); } GameObject val4 = (GameObject)obj; text = ((val4 != null) ? ((Object)val4).name : null) ?? ((Object)gameObject).name; } string text2 = NormalizeName(text); if (text2.EndsWith("_frac")) { string undamagedName = text2.Substring(0, text2.Length - 5); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)("[RadiusPinDetector][DETECT] Found damaged resource node '" + text2 + "', looking for pin from '" + undamagedName + "'")); } KeyValuePair<ZDOID, PinState> keyValuePair = alreadyPinned.FirstOrDefault(delegate(KeyValuePair<ZDOID, PinState> kvp) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) int result; if (kvp.Value.NormalizedName == undamagedName) { Vector3 val5 = kvp.Value.LastPosition - gameObject.transform.position; result = ((((Vector3)(ref val5)).sqrMagnitude < 0.1f) ? 1 : 0); } else { result = 0; } return (byte)result != 0; }); if (keyValuePair.Value != null) { PinState value4 = keyValuePair.Value; alreadyPinned.Remove(keyValuePair.Key); value4.ZdoID = val3; value4.NormalizedName = text2; value4.PinnedObject = gameObject; value4.LastPosition = gameObject.transform.position; alreadyPinned[val3] = value4; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][DETECT] Transferred pin from {undamagedName} to {text2} (ID={val3})"); } continue; } } string matchingTrackedObjectName = GetMatchingTrackedObjectName(text2); if (matchingTrackedObjectName == null) { continue; } bool value5 = false; if (!prefabMobilityCache.TryGetValue(text2, out value5)) { value5 = IsMobile(gameObject); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][DETECT] First '{text2}' found. Is Mobile: {value5}"); } prefabMobilityCache[text2] = value5; } PinState value6 = null; if (alreadyPinned.TryGetValue(val3, out value6)) { if (!value6.Mobile) { continue; } val = gameObject.transform.position - value6.LastPosition; if (!(((Vector3)(ref val)).sqrMagnitude > 1f)) { continue; } value6.LastPosition = gameObject.transform.position; if (value6.Pin != null) { Vector3 position = gameObject.transform.position; value6.Pin.m_pos = new Vector3(position.x, value6.Pin.m_pos.y, position.z); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][SCAN] Mobile object '{text2}' (ID={val3}) moved; pin updated."); } } continue; } if (foundAndNotPinned.TryGetValue(val3, out value6)) { if (value6.WasManuallyRemoved) { if (!(value6.MatchedTrackedObjectName != matchingTrackedObjectName)) { continue; } foundAndNotPinned.Remove(val3); value6 = new PinState { ZdoID = val3, NormalizedName = text2, PrefabName = text, Mobile = value5, LastPosition = gameObject.transform.position, PinnedObject = gameObject, Pin = null, WasManuallyRemoved = false, WasBlackListed = false, MatchedTrackedObjectName = matchingTrackedObjectName }; } else if (!value5) { continue; } } else { value6 = new PinState { ZdoID = val3, NormalizedName = text2, PrefabName = text, Mobile = value5, LastPosition = gameObject.transform.position, PinnedObject = gameObject, Pin = null, WasManuallyRemoved = false, WasBlackListed = false, MatchedTrackedObjectName = matchingTrackedObjectName }; } AttemptToPinObject(gameObject, val3, text2, matchingTrackedObjectName, value5, value6, text); } if (num >= allObjectsLength && MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][SCAN] Scan complete - New Created: {scanCyclePinsCreated}, Correlated: {scanCycleObjectsCorrelated}, Clustered: {scanCycleObjectsClustered}, Blacklisted: {scanCycleObjectsBlackListed}, Already Pinned: {scanCycleSkippedAlreadyPinned}, Skipped: {scanCycleSkippedPreviouslyFound}"); if (scanCycleSkippedByType.Count > 0) { Debug.Log((object)("[RadiusPinDetector][SCAN] Objects skipped (previously found, not pinned): " + string.Join(", ", scanCycleSkippedByType.Select((KeyValuePair<string, int> kvp) => $"{kvp.Key}({kvp.Value})")))); } } currentIndex = num; } private int RemoveSharedPinAtPosition(List<PinData> pinsList, Vector3 position, string trackedObjectName) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if (pinsList == null) { return 0; } long num = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); PinData val = null; foreach (PinData pins in pinsList) { Vector3 val2 = pins.m_pos - position; if (((Vector3)(ref val2)).sqrMagnitude < 0.1f && pins.m_ownerID != 0L && pins.m_ownerID != num && string.Equals(pins.m_name, trackedObjectName, StringComparison.OrdinalIgnoreCase)) { val = pins; break; } } if (val != null) { Minimap.instance.RemovePin(val); pinsList.Remove(val); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][PIN] Removed shared pin '{val.m_name}' at {position} to allow mod pin creation"); } } return pinsList.Count; } private bool AttemptToPinObject(GameObject gameObject, ZDOID objID, string normalizedPrefab, string matchedTrackedObjectName, bool isMobile, PinState pinState, string prefabName) { //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) PinData val = null; if (nearbyOrphanedPins.Count > 0) { Vector3 objectPos = gameObject.transform.position; KeyValuePair<Vector3, PinData> keyValuePair = nearbyOrphanedPins.FirstOrDefault(delegate(KeyValuePair<Vector3, PinData> kvp) { //IL_0002: 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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = kvp.Key - objectPos; return ((Vector3)(ref val2)).sqrMagnitude < 0.1f; }); if (keyValuePair.Value != null) { val = keyValuePair.Value; existingPinsForCorrelation.Remove(keyValuePair.Key); nearbyOrphanedPins.Remove(keyValuePair.Key); scanCycleObjectsCorrelated++; } } if (pinState == null) { pinState = new PinState { ZdoID = objID, NormalizedName = normalizedPrefab, PrefabName = prefabName, Mobile = isMobile, LastPosition = gameObject.transform.position, PinnedObject = gameObject, Pin = val, WasManuallyRemoved = false, WasBlackListed = false, MatchedTrackedObjectName = matchedTrackedObjectName }; } else { pinState.Pin = val; if (string.IsNullOrEmpty(pinState.PrefabName)) { pinState.PrefabName = prefabName; } } if (val == null) { List<PinData> pinsList = GetPinsList(); if (pinsList == null) { alreadyPinned.Remove(objID); foundAndNotPinned.Remove(objID); return false; } int beforeCount = RemoveSharedPinAtPosition(pinsList, gameObject.transform.position, matchedTrackedObjectName); try { string arg = ((Object)gameObject).name; if (normalizedPrefab.EndsWith("_frac")) { arg = prefabName.Replace("_frac", "") + "(clone)"; } PinAssistantReflectionHelper.AddObjAsPinDelegate?.Invoke(arg, gameObject); } catch (Exception arg2) { Debug.LogError((object)$"[RadiusPinDetector][ERROR] AddObjAsPin failed for '{((gameObject != null) ? ((Object)gameObject).name : null)}' (ID={objID}): {arg2}."); alreadyPinned.Remove(objID); foundAndNotPinned.Remove(objID); return false; } try { pinState.Pin = CaptureNewlyCreatedPin(gameObject.transform.position, beforeCount, pinsList); if (pinState.Pin != null) { alreadyPinned[objID] = pinState; foundAndNotPinned.Remove(objID); scanCyclePinsCreated++; return true; } alreadyPinned.Remove(objID); if (!isMobile) { foundAndNotPinned[objID] = pinState; scanCycleObjectsClustered++; } else { foundAndNotPinned.Remove(objID); } return false; } catch (Exception arg3) { alreadyPinned.Remove(objID); foundAndNotPinned.Remove(objID); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)$"[RadiusPinDetector][WARN] Failed to capture PinData for '{((gameObject != null) ? ((Object)gameObject).name : null)}' (ID={objID}): {arg3}"); } return false; } } if (val != null && pinState != null && pinState.Pin != null) { alreadyPinned[objID] = pinState; if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][SCAN] An orphaned pin was correlated to {normalizedPrefab} (ID={objID})"); } return true; } return false; } private void CleanUpPinCache(HashSet<string> allowedNames, Vector3 playerPos, float scanRadius) { //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) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; if ((Object)(object)ZNetScene.instance == (Object)null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][CLEANUP] ZNetScene.instance is null, skipping cleanup."); } return; } HashSet<ZDOID> activeZDOIDs = (from zdo in (znetInstancesField?.GetValue(ZNetScene.instance) as Dictionary<ZDO, ZNetView>)?.Keys where zdo != null select zdo.m_uid).ToHashSet(); List<PinData> pinsList = GetPinsList(); Dictionary<Vector3, List<PinData>> pinsByPosition = new Dictionary<Vector3, List<PinData>>(); if (pinsList != null) { foreach (PinData item in pinsList) { if (!pinsByPosition.ContainsKey(item.m_pos)) { pinsByPosition[item.m_pos] = new List<PinData>(); } pinsByPosition[item.m_pos].Add(item); } } var list = (from item in alreadyPinned.Select(delegate(KeyValuePair<ZDOID, PinState> pair) { //IL_0003: 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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) ZDOID key = pair.Key; PinState value3 = pair.Value; string normalizedName = value3.NormalizedName; if (activeZDOIDs != null && !activeZDOIDs.Contains(key)) { Vector3 val4 = value3.LastPosition - playerPos; if (((Vector3)(ref val4)).sqrMagnitude <= scanRadius * scanRadius) { return new { Key = key, Name = normalizedName, IsDestroyed = true, ShouldRemove = true, PinState = value3, WasManuallyRemoved = false }; } return new { Key = key, Name = normalizedName, IsDestroyed = true, ShouldRemove = false, PinState = value3, WasManuallyRemoved = false }; } ZNetScene instance2 = ZNetScene.instance; GameObject val5 = ((instance2 != null) ? instance2.FindInstance(key) : null); if ((Object)(object)val5 == (Object)null || (Object)(object)val5.gameObject == (Object)null) { if ((value3.MatchedTrackedObjectName == null || !allowedNames.Contains(value3.MatchedTrackedObjectName)) && !allowedNames.Contains(normalizedName)) { return new { Key = key, Name = normalizedName, IsDestroyed = false, ShouldRemove = true, PinState = value3, WasManuallyRemoved = false }; } return new { Key = key, Name = normalizedName, IsDestroyed = false, ShouldRemove = false, PinState = value3, WasManuallyRemoved = false }; } if ((value3.MatchedTrackedObjectName == null || !allowedNames.Contains(value3.MatchedTrackedObjectName)) && !allowedNames.Contains(normalizedName)) { return new { Key = key, Name = normalizedName, IsDestroyed = false, ShouldRemove = true, PinState = value3, WasManuallyRemoved = false }; } return (value3.Pin != null && !pinsByPosition.ContainsKey(value3.Pin.m_pos)) ? new { Key = key, Name = normalizedName, IsDestroyed = false, ShouldRemove = true, PinState = value3, WasManuallyRemoved = true } : new { Key = key, Name = normalizedName, IsDestroyed = false, ShouldRemove = false, PinState = value3, WasManuallyRemoved = false }; }) where item.ShouldRemove select item).ToList(); foreach (var item2 in list) { PinState pinState = item2.PinState; if (item2.WasManuallyRemoved) { pinState.WasManuallyRemoved = true; pinState.Pin = null; foundAndNotPinned[item2.Key] = pinState; alreadyPinned.Remove(item2.Key); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][CLEANUP] Detected manually removed pin for '{item2.Name}' (ID={item2.Key}), moved to foundAndNotPinned"); } continue; } Vector3 removedPosition = Vector3.zero; string text = null; if (item2.IsDestroyed && pinState.Pin != null) { removedPosition = pinState.Pin.m_pos; text = pinState.MatchedTrackedObjectName ?? item2.Name; } if (pinState.Pin != null) { string b = pinState.MatchedTrackedObjectName ?? item2.Name; long num3 = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); if (pinsByPosition.TryGetValue(pinState.Pin.m_pos, out var value)) { foreach (PinData item3 in value.ToList()) { if (item3.m_ownerID != 0L && item3.m_ownerID != num3 && string.Equals(item3.m_name, b, StringComparison.OrdinalIgnoreCase)) { Minimap.instance.RemovePin(item3); pinsList?.Remove(item3); value.Remove(item3); } } } Minimap.instance.RemovePin(pinState.Pin); pinState.Pin = null; num++; } if (item2.IsDestroyed && removedPosition != Vector3.zero) { List<ZDOID> list2 = (from kvp in foundAndNotPinned.Where(delegate(KeyValuePair<ZDOID, PinState> kvp) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) Vector3 val3 = kvp.Value.LastPosition - removedPosition; return ((Vector3)(ref val3)).sqrMagnitude < redundancyDistanceSame * redundancyDistanceSame; }) select kvp.Key).ToList(); foreach (ZDOID item4 in list2) { if (foundAndNotPinned.TryGetValue(item4, out var value2)) { ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.FindInstance(item4) : null); if ((Object)(object)val != (Object)null && (Object)(object)val.gameObject != (Object)null) { AttemptToPinObject(val.gameObject, item4, value2.NormalizedName, value2.MatchedTrackedObjectName, value2.Mobile, value2, value2.PrefabName); } foundAndNotPinned.Remove(item4); num2++; } } } alreadyPinned.Remove(item2.Key); } var list3 = foundAndNotPinned.Select((KeyValuePair<ZDOID, PinState> pair) => new { Key = pair.Key, PinState = pair.Value }).Where(item => { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (item.Key == ZDOID.None) { return true; } if (activeZDOIDs != null && !activeZDOIDs.Contains(item.Key)) { Vector3 val2 = item.PinState.LastPosition - playerPos; if (((Vector3)(ref val2)).sqrMagnitude <= scanRadius * scanRadius) { return true; } return false; } return ((item.PinState.MatchedTrackedObjectName == null || !allowedNames.Contains(item.PinState.MatchedTrackedObjectName)) && !allowedNames.Contains(item.PinState.NormalizedName)) ? true : false; }).ToList(); foreach (var item5 in list3) { if (foundAndNotPinned.Remove(item5.Key)) { num2++; } } if (MervilsRadiusPlugin.radiusDebugMode.Value && (num > 0 || num2 > 0)) { Debug.Log((object)$"[RadiusPinDetector][CLEANUP] Removed {num} pins, cleared {num2} foundAndNotPinned entries"); } if (nearbyOrphanedPins.Count <= 0) { return; } int num4 = 0; foreach (PinData value4 in nearbyOrphanedPins.Values) { if (value4.m_author == ModAuthorID) { Minimap.instance.RemovePin(value4); existingPinsForCorrelation.Remove(value4.m_pos); num4++; } } if (MervilsRadiusPlugin.radiusDebugMode.Value && num4 > 0) { Debug.Log((object)$"[RadiusPinDetector][CLEANUP] Removed {num4} orphaned pins"); } nearbyOrphanedPins.Clear(); } private void RestoreRemovedPins(string trackedObjectName) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) if (!removedPinsForRestoration.TryGetValue(trackedObjectName, out var value)) { return; } if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][RESTORE] Restoring {value.Count} pins for retracked object '{trackedObjectName}'."); } foreach (PinState item in value) { string normalizedName = item.NormalizedName; string matchingTrackedObjectName = GetMatchingTrackedObjectName(normalizedName); if (matchingTrackedObjectName != trackedObjectName) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)("[RadiusPinDetector][RESTORE] Skipping archived pin for '" + normalizedName + "' - no longer matches tracked object '" + trackedObjectName + "' (possibly blacklisted).")); } } else if (item.Pin != null) { try { Minimap.instance.AddPin(item.Pin.m_pos, item.Pin.m_type, item.Pin.m_name, item.Pin.m_save, item.Pin.m_checked, item.Pin.m_ownerID, item.Pin.m_author); } catch (Exception arg) { Debug.LogError((object)$"[RadiusPinDetector][ERROR] Failed to add pin to minimap for '{trackedObjectName}': {arg}. Skipping this pin."); continue; } List<PinData> pinsList = GetPinsList(); int beforeCount = (pinsList?.Count ?? 1) - 1; PinData val = CaptureNewlyCreatedPin(item.Pin.m_pos, beforeCount, pinsList); if (val != null) { item.Pin = val; existingPinsForCorrelation[val.m_pos] = val; } if (item.ZdoID != ZDOID.None) { alreadyPinned[item.ZdoID] = item; } } } removedPinsForRestoration.Remove(trackedObjectName); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)("[RadiusPinDetector][RESTORE] Cleared archived pins for '" + trackedObjectName + "' from restoration cache.")); } } private void RestoreManuallyRemovedPins(string trackedObjectName) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) List<ZDOID> list = new List<ZDOID>(); foreach (KeyValuePair<ZDOID, PinState> item in foundAndNotPinned.ToList()) { ZDOID key = item.Key; PinState value = item.Value; if (value.WasManuallyRemoved && value.MatchedTrackedObjectName == trackedObjectName) { list.Add(key); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][RESTORE] Will restore manually removed pin for '{value.NormalizedName}' (ID={key}) when ExactMatch changed from ON to OFF for '{trackedObjectName}'"); } } } foreach (ZDOID item2 in list) { foundAndNotPinned.Remove(item2); } if (MervilsRadiusPlugin.radiusDebugMode.Value && list.Count > 0) { Debug.Log((object)$"[RadiusPinDetector][RESTORE] Removed {list.Count} manually removed pins from foundAndNotPinned for '{trackedObjectName}' - they will be re-pinned on next scan"); } } private void UpdatePinsForBlackListChange(string trackedObjectName) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; int num3 = 0; List<(ZDOID, PinState)> list = new List<(ZDOID, PinState)>(); foreach (KeyValuePair<ZDOID, PinState> item in alreadyPinned.ToList()) { ZDOID key = item.Key; PinState value = item.Value; if (value.MatchedTrackedObjectName == trackedObjectName && IsBlackListed(value.NormalizedName, trackedObjectName)) { list.Add((key, value)); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][BLACKLIST] Pin for '{value.NormalizedName}' (ID={key}) is now blacklisted for '{trackedObjectName}'"); } } } foreach (var (key2, pinState) in list) { if (alreadyPinned.ContainsKey(key2)) { pinState.WasBlackListed = true; if (!removedPinsForRestoration.ContainsKey(trackedObjectName)) { removedPinsForRestoration[trackedObjectName] = new List<PinState>(); } removedPinsForRestoration[trackedObjectName].Add(pinState); if (pinState.Pin != null) { Minimap.instance.RemovePin(pinState.Pin); pinState.Pin = null; } alreadyPinned.Remove(key2); num++; } } List<ZDOID> list2 = new List<ZDOID>(); foreach (KeyValuePair<ZDOID, PinState> item2 in foundAndNotPinned.ToList()) { ZDOID key3 = item2.Key; PinState value2 = item2.Value; if (value2.MatchedTrackedObjectName == trackedObjectName && IsBlackListed(value2.NormalizedName, trackedObjectName)) { list2.Add(key3); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][BLACKLIST] FoundAndNotPinned entry for '{value2.NormalizedName}' (ID={key3}) is now blacklisted for '{trackedObjectName}'"); } } } foreach (ZDOID item3 in list2) { foundAndNotPinned.Remove(item3); num2++; } List<ZDOID> list3 = new List<ZDOID>(); foreach (KeyValuePair<ZDOID, PinState> item4 in foundAndNotPinned.ToList()) { ZDOID key4 = item4.Key; PinState value3 = item4.Value; if (value3.WasManuallyRemoved && value3.MatchedTrackedObjectName == trackedObjectName && !IsBlackListed(value3.NormalizedName, trackedObjectName)) { list3.Add(key4); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][BLACKLIST] Manually removed pin for '{value3.NormalizedName}' (ID={key4}) now passes blacklist for '{trackedObjectName}', will be re-evaluated"); } } } foreach (ZDOID item5 in list3) { foundAndNotPinned.Remove(item5); num3++; } if (removedPinsForRestoration.ContainsKey(trackedObjectName)) { RestoreRemovedPins(trackedObjectName); } if (MervilsRadiusPlugin.radiusDebugMode.Value && (num > 0 || num2 > 0 || num3 > 0)) { Debug.Log((object)$"[RadiusPinDetector][BLACKLIST] Blacklist change for '{trackedObjectName}': Archived {num} pins, cleared {num2} foundAndNotPinned entries, re-evaluating {num3} manually removed pins"); } } private PinData CaptureNewlyCreatedPin(Vector3 expectedPosition, int beforeCount, List<PinData> pinsList) { //IL_002d: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (pinsList == null) { return null; } float num = 0.1f; float num2 = num * num; for (int i = beforeCount; i < pinsList.Count; i++) { PinData val = pinsList[i]; if (val != null) { Vector3 val2 = val.m_pos - expectedPosition; if (((Vector3)(ref val2)).sqrMagnitude < num2) { return val; } } } return null; } private float ResolveScanRadius() { if (!MervilsRadiusPlugin.useFullExplorationRadius.Value) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][RADIUS] Using configured radius: {MervilsRadiusPlugin.radiusDetectionRadius.Value}"); } return Mathf.Max(1f, MervilsRadiusPlugin.radiusDetectionRadius.Value); } float lastCapturedRadius = PinAssistantPatches.ValheimMinimapPatches.GetLastCapturedRadius(); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][RADIUS] Player's exploration radius is: {lastCapturedRadius}"); } return Mathf.Max(1f, lastCapturedRadius); } private static string NormalizeName(string raw) { if (string.IsNullOrEmpty(raw)) { return string.Empty; } string text = raw.ToLowerInvariant(); return text.Replace("(clone)", "").Trim(); } private static string GetTrackedObjectGroupKey(string pinName, PinType pinType) { return NormalizeName(pinName) + "_" + ((object)(PinType)(ref pinType)).ToString(); } private string GetMatchingTrackedObjectName(string normalizedPrefabName) { if (allowedNames.Contains(normalizedPrefabName)) { if (IsBlackListed(normalizedPrefabName, normalizedPrefabName)) { scanCycleObjectsBlackListed++; return null; } return normalizedPrefabName; } foreach (string allowedName in allowedNames) { if (exactMatchStatus.ContainsKey(allowedName) && !exactMatchStatus[allowedName].Current && normalizedPrefabName.Contains(allowedName)) { if (!IsBlackListed(normalizedPrefabName, allowedName)) { return allowedName; } scanCycleObjectsBlackListed++; } } return null; } private bool IsBlackListed(string normalizedPrefabName, string trackedObjectName) { if (!blackListWords.ContainsKey(trackedObjectName)) { return false; } BlackListData blackListData = blackListWords[trackedObjectName]; if (blackListData.ParsedWords.Count == 0) { return false; } foreach (string parsedWord in blackListData.ParsedWords) { if (normalizedPrefabName.Contains(parsedWord)) { return true; } } return false; } private List<PinData> GetPinsList() { if (minimapPinsField == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] GetPinsList: minimapPinsField is null! Reflection failed during initialization."); return null; } if ((Object)(object)m_minimap == (Object)null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] GetPinsList: m_minimap is null! Minimap instance lost."); return null; } List<PinData> list = minimapPinsField.GetValue(m_minimap) as List<PinData>; if (list == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] GetPinsList: Reflection returned null. Field exists but value is null. This should never happen!"); Debug.LogError((object)("[RadiusPinDetector][ERROR] Raw field value: " + (minimapPinsField.GetValue(m_minimap)?.GetType()?.Name ?? "null"))); } return list; } private void UpdateRedundancyDistances() { if (Time.time - lastRedundancyRefreshTime < 5f) { return; } lastRedundancyRefreshTime = Time.time; if (PinAssistantReflectionHelper.RedundancySameProp == null && PinAssistantReflectionHelper.RedundancyAnyProp == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] Unable to update redundancy distances -- Properties are null."); } return; } float num = redundancyDistanceSame; float num2 = redundancyDistanceAny; if (cachedSameConfigEntry == null && PinAssistantReflectionHelper.RedundancySameProp != null) { cachedSameConfigEntry = PinAssistantReflectionHelper.RedundancySameProp.GetValue(PinAssistantReflectionHelper.ModConfigInstance) as ConfigEntry<float>; } if (cachedAnyConfigEntry == null && PinAssistantReflectionHelper.RedundancyAnyProp != null) { cachedAnyConfigEntry = PinAssistantReflectionHelper.RedundancyAnyProp.GetValue(PinAssistantReflectionHelper.ModConfigInstance) as ConfigEntry<float>; } if (cachedSameConfigEntry != null) { redundancyDistanceSame = cachedSameConfigEntry.Value; } if (cachedAnyConfigEntry != null) { redundancyDistanceAny = cachedAnyConfigEntry.Value; } if (redundancyDistanceSame != num || redundancyDistanceAny != num2) { foundAndNotPinned.Clear(); if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)$"[RadiusPinDetector][SCAN] Redundancy distances changed (old: same={num}, any={num2} | new: same={redundancyDistanceSame}, any={redundancyDistanceAny}). Clearing foundAndNotPinned cache."); } } } private bool AreCoreReferencesValid() { return (Object)(object)m_player != (Object)null && (Object)(object)m_minimap != (Object)null && (Object)(object)znetScene != (Object)null; } private bool ArePinAssistantReferencesValid() { if (PinAssistantReflectionHelper.TrackingHandlerInstance == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][DEBUG] TrackingHandlerInstance is null"); } return false; } if (PinAssistantReflectionHelper.PinHandlerInstance == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][DEBUG] PinHandlerInstance is null"); } return false; } if (PinAssistantReflectionHelper.ModConfigInstance == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][DEBUG] ModConfigInstance is null"); } return false; } if (PinAssistantReflectionHelper.TrackObjectUIInstance == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][DEBUG] TrackObjectUIInstance is null"); } return false; } if (PinAssistantReflectionHelper.TrackedObjectsInstance == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][DEBUG] TrackedObjectsInstance is null"); } return false; } if (PinAssistantReflectionHelper.AltDictionaryInstance == null) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.Log((object)"[RadiusPinDetector][DEBUG] AltDictionaryInstance is null"); } return false; } object trackObjectUIInstance = PinAssistantReflectionHelper.TrackObjectUIInstance; Object val = (Object)((trackObjectUIInstance is Object) ? trackObjectUIInstance : null); if (val != null && val == (Object)null) { return false; } try { int count = PinAssistantReflectionHelper.AltDictionaryInstance.Count; return true; } catch { return false; } } } public static class PinAssistantReflectionHelper { public static MethodInfo AddObjAsPinMethod; public static Action<string, GameObject> AddObjAsPinDelegate; public static FieldInfo M_PinsField; public static FieldInfo TrackedObjectsField; public static FieldInfo TrackObjectUI_m_edittingObject; public static PropertyInfo AltDictionaryProperty; public static PropertyInfo RedundancySameProp; public static PropertyInfo RedundancyAnyProp; public static object TrackingHandlerInstance; public static object PinHandlerInstance; public static object ModConfigInstance; public static object TrackObjectUIInstance; public static object TrackedObjectsInstance; public static Dictionary<string, TrieNode<TrackedObject>> AltDictionaryInstance; private static Assembly s_pinAssistantAssembly; public static Assembly GetPinAssistantAssembly() { if (s_pinAssistantAssembly == null) { s_pinAssistantAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "WxAxW.PinAssistant"); } return s_pinAssistantAssembly; } } public static class PinAssistantPatches { public static class PinHandlerPatches { [HarmonyPatch] public static class CheckPinPositionExist { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return (PinAssistantReflectionHelper.GetPinAssistantAssembly()?.GetType("WxAxW.PinAssistant.Core.PinHandler"))?.GetMethod("CheckPinPositionExist", BindingFlags.Instance | BindingFlags.NonPublic); } [HarmonyPrefix] public static bool Prefix(object __instance, Vector3 pinPos, ref bool __result, ref bool __runOriginal) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if (!MervilsRadiusPlugin.radiusDetectionEnabled.Value) { __runOriginal = true; return true; } long num = 0L; bool flag = false; if ((Object)(object)Player.m_localPlayer != (Object)null) { num = Player.m_localPlayer.GetPlayerID(); flag = true; } if (!flag) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] PatchCheckPinPositionExist: Local player not yet available. Letting original method run for now."); } __runOriginal = true; return true; } if (PinAssistantReflectionHelper.M_PinsField == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] PatchCheckPinPositionExist: PinAssistantReflectionHelper.M_PinsField is null. Letting original method run."); __runOriginal = true; return true; } if (!(PinAssistantReflectionHelper.M_PinsField.GetValue(PinAssistantReflectionHelper.PinHandlerInstance) is Dictionary<Vector3, PinData> dictionary)) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] PatchCheckPinPositionExist: PinHandler's m_monitoredPins dictionary is null. Letting original method run."); } __runOriginal = true; return true; } if (dictionary.TryGetValue(pinPos, out var value)) { if (value.m_ownerID == 0L || value.m_ownerID == num) { __result = true; } else { __result = false; } } else { __result = false; } __runOriginal = false; return false; } } [HarmonyPatch] public static class CheckValidPinPosition { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return (PinAssistantReflectionHelper.GetPinAssistantAssembly()?.GetType("WxAxW.PinAssistant.Core.PinHandler"))?.GetMethod("CheckValidPinPosition", BindingFlags.Instance | BindingFlags.NonPublic); } [HarmonyPrefix] public static bool Prefix(object __instance, Vector3 pinToAdd, string pinName, float redundancyDistance, bool allPins, ref bool __result, ref bool __runOriginal) { //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) if (!MervilsRadiusPlugin.radiusDetectionEnabled.Value) { __runOriginal = true; return true; } long num = 0L; bool flag = false; if ((Object)(object)Player.m_localPlayer != (Object)null) { num = Player.m_localPlayer.GetPlayerID(); flag = true; } if (!flag) { if (MervilsRadiusPlugin.radiusDebugMode.Value) { Debug.LogWarning((object)"[RadiusPinDetector][WARN] PatchCheckValidPinPosition: Local player not yet available. Letting original method run for now."); } __runOriginal = true; return true; } if (PinAssistantReflectionHelper.M_PinsField == null) { Debug.LogError((object)"[RadiusPinDetector][ERROR] PatchCheckValidPinPosition: PinAssistantReflectionHelper.M_PinsField is null. Letting original method run."); __runOr