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 ValheimHeightUnlocked v1.0.0
ValheimHeightUnlocked.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("ValheimHeightUnlocked")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ValheimHeightUnlocked")] [assembly: AssemblyTitle("ValheimHeightUnlocked")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 ValheimHeightUnlocked { [BepInPlugin("mod.valheim.heightunlocked", "ValheimHeightUnlocked", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGUID = "mod.valheim.heightunlocked"; public const string PluginName = "ValheimHeightUnlocked"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<float> MaxHeight; public static ConfigEntry<float> MinHeight; private Harmony _harmony; public static float Max() { return MaxHeight.Value; } public static float Min() { return MinHeight.Value; } public static float MinAbs() { return Math.Abs(MinHeight.Value); } private void Awake() { MaxHeight = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Height", 200f, "Hauteur max du terrain (vanilla = 8)"); MinHeight = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Min Height", -200f, "Profondeur max du terrain (vanilla = -8)"); _harmony = Harmony.CreateAndPatchAll(typeof(Plugin).Assembly, "mod.valheim.heightunlocked"); ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} v{1} charge ! Max={2}m Min={3}m", "ValheimHeightUnlocked", "1.0.0", MaxHeight.Value, MinHeight.Value)); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(TerrainComp))] public class Heightmap_Patches { [CompilerGenerated] private sealed class <ApplyToHeightmapTranspiler>d__2 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private int <i>5__2; private IEnumerator<CodeInstruction> <>7__wrap2; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyToHeightmapTranspiler>d__2(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 3u) { try { } finally { <>m__Finally1(); } } <>7__wrap2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__2 = 0; <>7__wrap2 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; case 2: <>1__state = -3; goto IL_0151; case 3: <>1__state = -3; goto IL_0151; case 4: { <>1__state = -3; break; } IL_0151: <i>5__2++; break; } if (<>7__wrap2.MoveNext()) { CodeInstruction current = <>7__wrap2.Current; if (CodeInstructionExtensions.Is(current, OpCodes.Ldc_R4, (object)(-8f))) { <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "Min", (Type[])null, (Type[])null)); <>1__state = 1; return true; } if (CodeInstructionExtensions.Is(current, OpCodes.Ldc_R4, (object)8f)) { if (<i>5__2 == 0) { <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "MinAbs", (Type[])null, (Type[])null)); <>1__state = 2; return true; } <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "Max", (Type[])null, (Type[])null)); <>1__state = 3; return true; } <>2__current = current; <>1__state = 4; return true; } <>m__Finally1(); <>7__wrap2 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <ApplyToHeightmapTranspiler>d__2 <ApplyToHeightmapTranspiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <ApplyToHeightmapTranspiler>d__ = this; } else { <ApplyToHeightmapTranspiler>d__ = new <ApplyToHeightmapTranspiler>d__2(0); } <ApplyToHeightmapTranspiler>d__.instructions = <>3__instructions; return <ApplyToHeightmapTranspiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <LevelTerrainTranspiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private IEnumerator<CodeInstruction> <>7__wrap1; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LevelTerrainTranspiler>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 2u) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; case 2: <>1__state = -3; break; case 3: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { CodeInstruction current = <>7__wrap1.Current; if (CodeInstructionExtensions.Is(current, OpCodes.Ldc_R4, (object)(-8f))) { <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "Min", (Type[])null, (Type[])null)); <>1__state = 1; return true; } if (CodeInstructionExtensions.Is(current, OpCodes.Ldc_R4, (object)8f)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "Max", (Type[])null, (Type[])null)); <>1__state = 2; return true; } <>2__current = current; <>1__state = 3; return true; } <>m__Finally1(); <>7__wrap1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <LevelTerrainTranspiler>d__0 <LevelTerrainTranspiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <LevelTerrainTranspiler>d__ = this; } else { <LevelTerrainTranspiler>d__ = new <LevelTerrainTranspiler>d__0(0); } <LevelTerrainTranspiler>d__.instructions = <>3__instructions; return <LevelTerrainTranspiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <RaiseTerrainTranspiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private IEnumerator<CodeInstruction> <>7__wrap1; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RaiseTerrainTranspiler>d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 2u) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; case 2: <>1__state = -3; break; case 3: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { CodeInstruction current = <>7__wrap1.Current; if (CodeInstructionExtensions.Is(current, OpCodes.Ldc_R4, (object)(-8f))) { <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "Min", (Type[])null, (Type[])null)); <>1__state = 1; return true; } if (CodeInstructionExtensions.Is(current, OpCodes.Ldc_R4, (object)8f)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "Max", (Type[])null, (Type[])null)); <>1__state = 2; return true; } <>2__current = current; <>1__state = 3; return true; } <>m__Finally1(); <>7__wrap1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <RaiseTerrainTranspiler>d__1 <RaiseTerrainTranspiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <RaiseTerrainTranspiler>d__ = this; } else { <RaiseTerrainTranspiler>d__ = new <RaiseTerrainTranspiler>d__1(0); } <RaiseTerrainTranspiler>d__.instructions = <>3__instructions; return <RaiseTerrainTranspiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<LevelTerrainTranspiler>d__0))] [HarmonyTranspiler] [HarmonyPatch("LevelTerrain")] public static IEnumerable<CodeInstruction> LevelTerrainTranspiler(IEnumerable<CodeInstruction> instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LevelTerrainTranspiler>d__0(-2) { <>3__instructions = instructions }; } [IteratorStateMachine(typeof(<RaiseTerrainTranspiler>d__1))] [HarmonyTranspiler] [HarmonyPatch("RaiseTerrain")] public static IEnumerable<CodeInstruction> RaiseTerrainTranspiler(IEnumerable<CodeInstruction> instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RaiseTerrainTranspiler>d__1(-2) { <>3__instructions = instructions }; } [IteratorStateMachine(typeof(<ApplyToHeightmapTranspiler>d__2))] [HarmonyTranspiler] [HarmonyPatch("ApplyToHeightmap")] public static IEnumerable<CodeInstruction> ApplyToHeightmapTranspiler(IEnumerable<CodeInstruction> instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyToHeightmapTranspiler>d__2(-2) { <>3__instructions = instructions }; } } }