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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Fusion;
using HarmonyLib;
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("AskaScout")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.1+8edde25dd5244eb2a60169a7a69309ac44f0660f")]
[assembly: AssemblyProduct("Aska Scout")]
[assembly: AssemblyTitle("AskaScout")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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(23, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AskaScout 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(28, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AskaScout 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(39, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AskaScout 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(31, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AskaScout 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(30, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AskaScout 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(36, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AskaScout 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(30, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AskaScout 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(59, 1, ref flag3);
if (flag3)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AskaScout 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(25, 1, ref flag3);
if (flag3)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("AskaScout 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_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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (__instance.IsPlayer() && ((NetworkBehaviour)__instance).GetLocalAuthorityMask() == 1 && !((Object)(object)((Component)__instance).GetComponentInChildren<AreaScanner>() != (Object)null))
{
GameObject val = new GameObject("AskaScout_Scanner");
val.transform.SetParent(((Component)__instance).gameObject.transform, false);
val.transform.localPosition = Vector3.zero;
val.AddComponent<AreaScanner>();
Plugin.Log.LogInfo((object)"AskaScout scanner attached to local player.");
}
}
}
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("smithio.aska.scout", "Aska Scout", "1.0.1")]
public class Plugin : BasePlugin
{
public const string PluginGuid = "smithio.aska.scout";
public const string PluginName = "Aska Scout";
public const string PluginVersion = "1.0.1";
internal static ManualLogSource Log;
public override void Load()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Aska Scout");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.1");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loading");
}
log.LogInfo(val);
ScoutConfig.Init(((BasePlugin)this).Config);
ClassInjector.RegisterTypeInIl2Cpp<AreaScanner>();
new Harmony("smithio.aska.scout").PatchAll(typeof(CharacterSpawnPatch));
ManualLogSource log2 = Log;
val = new BepInExInfoLogInterpolatedStringHandler(21, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Aska Scout");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.1");
((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
},
{
"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).");
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 = "AskaScout";
public const string PLUGIN_NAME = "Aska Scout";
public const string PLUGIN_VERSION = "1.0.1";
}
}