Decompiled source of Scout v1.0.4

Scout.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AskaShared;
using AskaShared.Game;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Fusion;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using SSSGame;
using SandSailorStudio.Inventory;
using SandSailorStudio.WorldGen;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Scout")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3")]
[assembly: AssemblyInformationalVersion("1.0.3+be78dc5a3458f8992af5390a3520fb692313f79d")]
[assembly: AssemblyProduct("Scout")]
[assembly: AssemblyTitle("Scout")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AskaScout
{
	public class AreaScanner : MonoBehaviour
	{
		private const float FallbackBaseRadiusMeters = 100f;

		private const float CaveBaseRadiusMeters = 60f;

		private const float NotificationGraceSeconds = 8f;

		private const int MaxNotificationsPerTick = 4;

		private float _nextScan;

		private float _attachTime;

		private int _notifiedThisTick;

		private WorldDataMap _map;

		private CavesManager _caves;

		private readonly HashSet<int> _revealedCaves = new HashSet<int>();

		private readonly HashSet<int> _processed = new HashSet<int>();

		private void Start()
		{
			_attachTime = Time.time;
		}

		private void Update()
		{
			if (ScoutConfig.Enabled.Value && !(Time.time < _nextScan))
			{
				_nextScan = Time.time + Mathf.Max(0.25f, ScoutConfig.ScanIntervalSeconds.Value);
				Scan();
			}
		}

		private void Scan()
		{
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				WorldDataMap val = ResolveMap();
				if (val == null)
				{
					return;
				}
				Dictionary<int, AreaInstance> areaInstances = val._areaInstances;
				if (areaInstances == null)
				{
					return;
				}
				float value = ScoutConfig.GlobalMultiplier.Value;
				Vector3 position = ((Component)this).transform.position;
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(position.x, position.z);
				_notifiedThisTick = 0;
				Enumerator<int, AreaInstance> enumerator = areaInstances.GetEnumerator();
				while (enumerator.MoveNext())
				{
					KeyValuePair<int, AreaInstance> current = enumerator.Current;
					int key = current.Key;
					if (_processed.Contains(key))
					{
						continue;
					}
					AreaInstance value2 = current.Value;
					if (value2 == null)
					{
						continue;
					}
					if (value2.isExplored)
					{
						_processed.Add(key);
						continue;
					}
					IAreaInstanceMarkerHandler areaInstanceMarkerHandler = value2.areaInstanceMarkerHandler;
					if (areaInstanceMarkerHandler == null)
					{
						continue;
					}
					float num = 100f;
					try
					{
						float discoveryRadius = areaInstanceMarkerHandler.GetDiscoveryRadius();
						if (discoveryRadius > 0f)
						{
							num = discoveryRadius;
						}
					}
					catch
					{
					}
					string markerKey = null;
					try
					{
						ItemInfo markerInfo = areaInstanceMarkerHandler.GetMarkerInfo();
						if ((Object)(object)markerInfo != (Object)null)
						{
							markerKey = ScoutConfig.MarkerKey(((Object)markerInfo).name);
						}
					}
					catch
					{
					}
					float num2 = ScoutConfig.GetMultiplierForMarker(markerKey) * value;
					if (num2 <= 0f)
					{
						continue;
					}
					float num3 = num * num2;
					if (!TryGetWorldXZ(value2, out var xz))
					{
						continue;
					}
					float num4 = Vector2.Distance(val2, xz);
					if (!(num4 > num3))
					{
						string name = null;
						try
						{
							name = value2.name;
						}
						catch
						{
						}
						Discover(value2, areaInstanceMarkerHandler, key, name, num4, num3);
					}
				}
				ScanCaves(val2, value);
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(19, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Scout scan failed: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val3);
			}
		}

		private void ScanCaves(Vector2 playerXZ, float globalMult)
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)_caves == (Object)null)
				{
					_caves = Object.FindObjectOfType<CavesManager>();
				}
				if ((Object)(object)_caves == (Object)null)
				{
					return;
				}
				Dictionary<int, CaveExplorationHandler> explorationHandlers = _caves._explorationHandlers;
				Dictionary<int, CaveEntrance> residentCaves = _caves._residentCaves;
				if (explorationHandlers == null || residentCaves == null)
				{
					return;
				}
				float num = ScoutConfig.Caves.Value * globalMult;
				if (num <= 0f)
				{
					return;
				}
				float num2 = 60f * num;
				Enumerator<int, CaveExplorationHandler> enumerator = explorationHandlers.GetEnumerator();
				while (enumerator.MoveNext())
				{
					KeyValuePair<int, CaveExplorationHandler> current = enumerator.Current;
					int key = current.Key;
					if (_revealedCaves.Contains(key))
					{
						continue;
					}
					CaveExplorationHandler value = current.Value;
					if (value == null || value.data == null)
					{
						continue;
					}
					if (value.data.explored)
					{
						_revealedCaves.Add(key);
						continue;
					}
					CaveEntrance val = null;
					try
					{
						residentCaves.TryGetValue(key, ref val);
					}
					catch
					{
					}
					if (!((Object)(object)val == (Object)null))
					{
						Vector3 position;
						try
						{
							position = ((Component)val).transform.position;
						}
						catch
						{
							continue;
						}
						float num3 = Vector2.Distance(playerXZ, new Vector2(position.x, position.z));
						if (!(num3 > num2))
						{
							RevealCave(key, value, num3, num2);
						}
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Scout cave scan failed: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val2);
			}
		}

		private void RevealCave(int id, CaveExplorationHandler handler, float dist, float threshold)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				handler.data.explored = true;
				handler._OnCaveExplorationChanged(true);
				handler._RefreshMarkerState();
				_revealedCaves.Add(id);
				MaybeNotifyCave();
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(35, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Scout discovered cave ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(id);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" at ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(dist, "F1");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("m (<= ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(threshold, "F1");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("m).");
				}
				log.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(27, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Scout reveal cave ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(id);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" failed: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogWarning(val2);
				_revealedCaves.Add(id);
			}
		}

		private void MaybeNotifyCave()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			try
			{
				if (ScoutConfig.ShowDiscoveryNotifications.Value && !(Time.time < _attachTime + 8f) && _notifiedThisTick < 4)
				{
					string text = "Cave";
					string empty = string.Empty;
					NotificationMenu.DisplayImportant(NotificationMenu.c_CaveDiscoveredNotificationID, ref text, ref empty, (Sprite)null, -1f, (NotificationType)3);
					_notifiedThisTick++;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Scout cave notify failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
		}

		private void Discover(AreaInstance ai, IAreaInstanceMarkerHandler handler, int uid, string name, float dist, float threshold)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				ai.isExplored = true;
				handler.RefreshExploration();
				_processed.Add(uid);
				MaybeNotify(handler, name);
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Scout discovered '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' at ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(dist, "F1");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("m (<= ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(threshold, "F1");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("m).");
				}
				log.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(26, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Scout discover '");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' failed: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogWarning(val2);
				_processed.Add(uid);
			}
		}

		private void MaybeNotify(IAreaInstanceMarkerHandler handler, string name)
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			bool flag3 = default(bool);
			try
			{
				if (!ScoutConfig.ShowDiscoveryNotifications.Value || Time.time < _attachTime + 8f || _notifiedThisTick >= 4)
				{
					return;
				}
				bool flag;
				try
				{
					flag = handler.ShowDiscoverNotification();
				}
				catch
				{
					flag = true;
				}
				if (!flag)
				{
					return;
				}
				bool flag2 = true;
				try
				{
					AreaInstanceMarkerHandler val = ((Il2CppObjectBase)handler).TryCast<AreaInstanceMarkerHandler>();
					if (val != null)
					{
						flag2 = val._CheckMarkerDisplayCondition();
					}
				}
				catch
				{
					flag2 = true;
				}
				if (!flag2)
				{
					ManualLogSource log = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(55, 1, ref flag3);
					if (flag3)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Scout suppressed toast for '");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(name);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' (marker not displayable).");
					}
					log.LogInfo(val2);
					return;
				}
				string value = null;
				Sprite val3 = null;
				ItemInfo markerInfo = handler.GetMarkerInfo();
				if ((Object)(object)markerInfo != (Object)null)
				{
					try
					{
						value = markerInfo.Name;
					}
					catch
					{
					}
					try
					{
						val3 = markerInfo.icon;
					}
					catch
					{
					}
				}
				if (string.IsNullOrEmpty(value))
				{
					value = name ?? "Area";
				}
				string empty = string.Empty;
				NotificationMenu.DisplayImportant(NotificationMenu.c_DiscoveryNotificationID, ref value, ref empty, val3, -1f, (NotificationType)3);
				_notifiedThisTick++;
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(21, 1, ref flag3);
				if (flag3)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Scout notify failed: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
				}
				log2.LogWarning(val4);
			}
		}

		private WorldDataMap ResolveMap()
		{
			if (_map != null)
			{
				return _map;
			}
			_map = MapAccess.Resolve(out var _);
			return _map;
		}

		private static bool TryGetWorldXZ(AreaInstance ai, out Vector2 xz)
		{
			//IL_0001: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			xz = default(Vector2);
			try
			{
				Vector2Int position = ai.position;
				xz = new Vector2((float)((Vector2Int)(ref position)).x, (float)((Vector2Int)(ref position)).y);
				return true;
			}
			catch
			{
				return false;
			}
		}
	}
	[HarmonyPatch(typeof(Character))]
	public static class CharacterSpawnPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Spawned")]
		public static void Spawned(Character __instance)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			LocalPlayerTool.AttachOnSpawn(__instance, Plugin.Log, "AskaScout_Scanner", Vector3.zero, typeof(AreaScanner));
		}
	}
	internal static class MapAccess
	{
		public static WorldDataMap Resolve(out string source)
		{
			WorldDataMap val = FromGenerator(Object.FindObjectOfType<WorldGenerator>());
			if (val != null)
			{
				source = "WorldGenerator.GetDataMap";
				return val;
			}
			WorldHorizonController val2 = Object.FindObjectOfType<WorldHorizonController>();
			if ((Object)(object)val2 != (Object)null)
			{
				try
				{
					val = val2._worldMap;
				}
				catch
				{
					val = null;
				}
				if (val != null)
				{
					source = "WorldHorizonController._worldMap";
					return val;
				}
			}
			try
			{
				Il2CppArrayBase<WorldGenerator> val3 = Resources.FindObjectsOfTypeAll<WorldGenerator>();
				for (int i = 0; i < val3.Length; i++)
				{
					val = FromGenerator(val3[i]);
					if (val != null)
					{
						source = "WorldGenerator(all)";
						return val;
					}
				}
			}
			catch
			{
			}
			source = "none";
			return null;
		}

		private static WorldDataMap FromGenerator(WorldGenerator gen)
		{
			if ((Object)(object)gen == (Object)null)
			{
				return null;
			}
			WorldDataMap val = null;
			try
			{
				val = gen.GetDataMap();
			}
			catch
			{
			}
			if (val == null)
			{
				try
				{
					val = gen._worldDataMap;
				}
				catch
				{
				}
			}
			return val;
		}
	}
	[BepInPlugin("mugsy33.scout", "Scout", "1.0.4")]
	public class Plugin : BasePlugin
	{
		public const string PluginGuid = "mugsy33.scout";

		public const string PluginName = "Scout";

		public const string PluginVersion = "1.0.4";

		internal static ManualLogSource Log;

		public override void Load()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ConfigMigration.Run(((BasePlugin)this).Config, Log);
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Scout");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.4");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loading");
			}
			log.LogInfo(val);
			ScoutConfig.Init(((BasePlugin)this).Config);
			ClassInjector.RegisterTypeInIl2Cpp<AreaScanner>();
			new Harmony("mugsy33.scout").PatchAll(typeof(CharacterSpawnPatch));
			ManualLogSource log2 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(21, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Scout");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.4");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded (Enabled=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(ScoutConfig.Enabled.Value);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
			}
			log2.LogInfo(val);
		}
	}
	internal static class ScoutConfig
	{
		public enum Category
		{
			Threats,
			Resources,
			Landmarks,
			Islands
		}

		public const string SectionDiscovery = "Discovery";

		public const string SectionCategories = "Categories";

		public static ConfigEntry<bool> Enabled;

		public static ConfigEntry<float> GlobalMultiplier;

		public static ConfigEntry<float> ScanIntervalSeconds;

		public static ConfigEntry<bool> ShowDiscoveryNotifications;

		public static ConfigEntry<float> Threats;

		public static ConfigEntry<float> Resources;

		public static ConfigEntry<float> Landmarks;

		public static ConfigEntry<float> Islands;

		public static ConfigEntry<float> Caves;

		public static ConfigEntry<float> UnmappedFallback;

		private static readonly Dictionary<string, Category> _markerCategory = new Dictionary<string, Category>
		{
			{
				"WolfDen",
				Category.Threats
			},
			{
				"DraugarField",
				Category.Threats
			},
			{
				"Bear",
				Category.Threats
			},
			{
				"CemeterySmall",
				Category.Threats
			},
			{
				"CemeteryLarge",
				Category.Threats
			},
			{
				"RuinsHeads",
				Category.Threats
			},
			{
				"WightShipwreck",
				Category.Threats
			},
			{
				"Spire",
				Category.Threats
			},
			{
				"MiniSpire",
				Category.Threats
			},
			{
				"HostileCamp",
				Category.Threats
			},
			{
				"HostileSettlement",
				Category.Threats
			},
			{
				"HostileStronghold",
				Category.Threats
			},
			{
				"StoneJotunArena",
				Category.Threats
			},
			{
				"MarshBoss",
				Category.Threats
			},
			{
				"Whaleslug",
				Category.Threats
			},
			{
				"FishingGroundCod",
				Category.Resources
			},
			{
				"FishingGroundSalmon",
				Category.Resources
			},
			{
				"FishingGroundSturgeon",
				Category.Resources
			},
			{
				"FishingGroundMackerel",
				Category.Resources
			},
			{
				"FishingGroundWolffish",
				Category.Resources
			},
			{
				"NidhoggNest",
				Category.Resources
			},
			{
				"KycklingNest",
				Category.Resources
			},
			{
				"Shipwreck",
				Category.Landmarks
			},
			{
				"ExplorationTower",
				Category.Landmarks
			},
			{
				"LakeBig",
				Category.Landmarks
			},
			{
				"LakeSmall",
				Category.Landmarks
			},
			{
				"Oak",
				Category.Landmarks
			},
			{
				"UnexploredIsland",
				Category.Islands
			}
		};

		private static readonly HashSet<string> _loggedUnmapped = new HashSet<string>();

		public static void Init(ConfigFile cfg)
		{
			Enabled = cfg.Bind<bool>("Discovery", "Enabled", true, "Master on/off for the discovery-distance scanner.");
			GlobalMultiplier = cfg.Bind<float>("Discovery", "GlobalMultiplier", 1f, "Multiplier applied on top of every category multiplier. 1.0 = categories as written; 2.0 = twice as far for everything.");
			ScanIntervalSeconds = cfg.Bind<float>("Discovery", "ScanIntervalSeconds", 2f, "How often (seconds) the scanner checks AOI distances. Lower = more responsive, slightly more CPU. Floored at 0.25s.");
			ShowDiscoveryNotifications = cfg.Bind<bool>("Discovery", "ShowDiscoveryNotifications", true, "Let the game show its normal 'area discovered' feedback when this mod reveals an AOI.");
			Threats = cfg.Bind<float>("Categories", "Threats", 2f, "Distance multiplier for hostile sites/lairs and field bosses (wolf dens, cemeteries, draugr, hostile camps/settlements/strongholds, spires, bears, Jotun/Marsh/Whaleslug bosses).");
			Resources = cfg.Bind<float>("Categories", "Resources", 2.5f, "Distance multiplier for gatherable sites (fishing grounds, Nidhogg/Kyckling nests).");
			Landmarks = cfg.Bind<float>("Categories", "Landmarks", 2f, "Distance multiplier for non-combat points of interest (shipwrecks, exploration towers, lakes, landmark oaks).");
			Islands = cfg.Bind<float>("Categories", "Islands", 2f, "Distance multiplier for islands (their vanilla radius is already large, 108-720m).");
			Caves = cfg.Bind<float>("Categories", "Caves", 2.5f, "Distance multiplier for cave entrances. Caves have no vanilla discovery radius, so this scales a fixed ~60m base (default 2.5 = ~150m).");
			UnmappedFallback = cfg.Bind<float>("Categories", "UnmappedFallback", 1f, "Distance multiplier for any AOI marker not in the four categories above. 1.0 = vanilla. Unmapped markers are logged once so they can be categorised.");
		}

		public static string MarkerKey(string markerAssetName)
		{
			if (string.IsNullOrEmpty(markerAssetName))
			{
				return null;
			}
			if (markerAssetName.StartsWith("Item_Misc_BiomeMarker"))
			{
				return markerAssetName.Substring("Item_Misc_BiomeMarker".Length);
			}
			if (markerAssetName.StartsWith("Item_Misc_Marker"))
			{
				return markerAssetName.Substring("Item_Misc_Marker".Length);
			}
			return markerAssetName;
		}

		public static float GetMultiplierForMarker(string markerKey)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			if (markerKey != null && _markerCategory.TryGetValue(markerKey, out var value))
			{
				switch (value)
				{
				case Category.Threats:
					return Threats.Value;
				case Category.Resources:
					return Resources.Value;
				case Category.Landmarks:
					return Landmarks.Value;
				case Category.Islands:
					return Islands.Value;
				}
			}
			if (_loggedUnmapped.Add(markerKey ?? "<null>"))
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(50, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[scout] unmapped marker '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(markerKey ?? "<null>");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' -> UnmappedFallback (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(UnmappedFallback.Value);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
				}
				log.LogInfo(val);
			}
			return UnmappedFallback.Value;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Scout";

		public const string PLUGIN_NAME = "Scout";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}
namespace AskaShared.Game
{
	public static class LocalPlayerTool
	{
		private static bool _failureLogged;

		public static Character LocalCharacter { get; private set; }

		public static GameObject AttachOnSpawn(Character character, ManualLogSource log, string objectName, Vector3 localPosition, params Type[] components)
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				if ((Object)(object)character == (Object)null)
				{
					return null;
				}
				if (!character.IsPlayer() || ((NetworkBehaviour)character).GetLocalAuthorityMask() != 1)
				{
					return null;
				}
				LocalCharacter = character;
				if (string.IsNullOrEmpty(objectName))
				{
					throw new ArgumentException("objectName is required and must be unique to this mod.", "objectName");
				}
				Transform transform = ((Component)character).gameObject.transform;
				if ((Object)(object)transform.Find(objectName) != (Object)null)
				{
					return null;
				}
				GameObject val = new GameObject(objectName);
				val.transform.SetParent(transform, false);
				val.transform.localPosition = localPosition;
				if (components != null)
				{
					foreach (Type type in components)
					{
						if (type != null)
						{
							val.AddComponent(Il2CppType.From(type));
						}
					}
				}
				ManualLogSource val2 = log;
				if (val2 != null)
				{
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(29, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(objectName);
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" attached to local player '");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)((Component)character).gameObject).name);
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'.");
					}
					val2.LogInfo(val3);
				}
				return val;
			}
			catch (Exception ex)
			{
				if (!_failureLogged)
				{
					_failureLogged = true;
					ManualLogSource val2 = log;
					if (val2 != null)
					{
						BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(121, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(objectName);
							((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(": attaching to the local player threw - this mod will do nothing this session, reported once rather than once per spawn: ");
							((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex);
						}
						val2.LogError(val4);
					}
				}
				return null;
			}
		}
	}
}

AskaShared.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Mugsy33")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Ship-in-Release infrastructure shared by ASKA BepInEx mods (config GUID migration).")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AskaShared")]
[assembly: AssemblyTitle("AskaShared")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AskaShared
{
	public static class ConfigMigration
	{
		private const string NewPrefix = "mugsy33.";

		private const string OldPrefix = "smithio.aska.";

		public static void Run(ConfigFile config, ManualLogSource log)
		{
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			bool flag = false;
			string text = null;
			bool flag2 = default(bool);
			try
			{
				string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(config.ConfigFilePath);
				if (!fileNameWithoutExtension.StartsWith("mugsy33.", StringComparison.Ordinal))
				{
					return;
				}
				string text2 = "smithio.aska." + fileNameWithoutExtension.Substring("mugsy33.".Length);
				text = Path.Combine(Paths.ConfigPath, fileNameWithoutExtension + ".cfg");
				string text3 = Path.Combine(Paths.ConfigPath, text2 + ".cfg");
				string text4 = Path.Combine(Paths.ConfigPath, text2 + ".cfg.migrated");
				if (File.Exists(text))
				{
					if (File.Exists(text4))
					{
						File.Delete(text4);
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 1, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Deleted migrated legacy configuration: ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text4);
						}
						log.LogInfo(val);
					}
					else if (File.Exists(text3))
					{
						File.Move(text3, text4, overwrite: true);
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Legacy configuration renamed to ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text4);
						}
						log.LogInfo(val);
					}
				}
				else if (File.Exists(text3))
				{
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Legacy configuration detected: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text3);
					}
					log.LogInfo(val);
					string text5 = text + ".tmp";
					File.Copy(text3, text5, overwrite: true);
					File.Move(text5, text, overwrite: true);
					flag = true;
					val = new BepInExInfoLogInterpolatedStringHandler(33, 1, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Migrated legacy configuration to ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
					}
					log.LogInfo(val);
					config.Reload();
					File.Move(text3, text4, overwrite: true);
					val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Legacy configuration renamed to ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text4);
					}
					log.LogInfo(val);
				}
			}
			catch (Exception ex)
			{
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(62, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Configuration migration failed; using existing configuration. ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				log.LogWarning(val2);
				if (flag && text != null)
				{
					try
					{
						File.Delete(text);
						return;
					}
					catch
					{
						return;
					}
				}
			}
		}
	}
}