Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ValynFogReveal v0.1.0
plugins/ValynFogReveal.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyVersion("0.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 ValynMods.FogReveal { [BepInPlugin("valyn.mods.fogreveal", "Valyn Fog Reveal", "0.1.0")] public sealed class FogRevealPlugin : BaseUnityPlugin { internal static ConfigEntry<float> RadiusMultiplier; private Harmony harmony; private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown RadiusMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Exploration", "Reveal radius multiplier", 2f, "Multiplier for the radius revealed as you travel. 1 is the normal Valheim radius; 2 doubles the distance. Values are limited to 1-5."); if (ExploreRadiusPatch.Radius == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find Minimap.m_exploreRadius; fog reveal is unavailable for this game version."); return; } harmony = new Harmony("valyn.mods.fogreveal"); harmony.PatchAll(typeof(FogRevealPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Valyn Fog Reveal loaded; radius multiplier: " + RadiusMultiplier.Value)); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } [HarmonyPatch(typeof(Minimap), "UpdateExplore", new Type[] { typeof(float), typeof(Player) })] internal static class ExploreRadiusPatch { internal static readonly FieldInfo Radius = AccessTools.Field(typeof(Minimap), "m_exploreRadius"); private static void Prefix(Minimap __instance, out float __state) { __state = -1f; float value = FogRevealPlugin.RadiusMultiplier.Value; if (float.IsNaN(value) || float.IsInfinity(value)) { return; } value = Math.Min(5f, Math.Max(1f, value)); if (!(value <= 1f)) { float num = (float)Radius.GetValue(__instance); if (!(num <= 0f)) { __state = num; Radius.SetValue(__instance, num * value); } } } private static void Postfix(Minimap __instance, float __state) { if (__state > 0f) { Radius.SetValue(__instance, __state); } } } }