Decompiled source of DeeperNorth v1.0.1

DeeperNorth.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LocationManager")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LocationManager")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("97f5e8d8-ec46-4196-b942-84d841828d58")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace DeeperNorth
{
	[BepInPlugin("xyz.919lab.mofongolero.DeeperNorth", "DeeperNorth", "1.0.1")]
	public class DeeperNorth : BaseUnityPlugin
	{
		private const string ModName = "DeeperNorth";

		private const string ModVersion = "1.0.1";

		private const string ModGUID = "xyz.919lab.mofongolero.DeeperNorth";

		private Harmony harmony = new Harmony("xyz.919lab.mofongolero.DeeperNorth");

		public void Awake()
		{
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	[HarmonyPatch(typeof(HeightmapBuilder), "Build")]
	public class HeightmapBuilderPatch
	{
		private static void Prefix()
		{
			WorldGeneratorPatch.Disable = true;
		}

		private static void Postfix(HMBuildData data)
		{
			//IL_0008: 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)
			//IL_0044: 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_0056: 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_0092: 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_00bf: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			WorldGeneratorPatch.Disable = false;
			Vector3 val = data.m_center + new Vector3((float)data.m_width * data.m_scale * -0.5f, 0f, (float)data.m_width * data.m_scale * -0.5f);
			if ((int)data.m_cornerBiomes[0] == 4 && WorldGenerator.IsDeepnorth(val.x, val.z))
			{
				data.m_cornerBiomes[0] = (Biome)64;
			}
			if ((int)data.m_cornerBiomes[1] == 4 && WorldGenerator.IsDeepnorth(val.x + (float)data.m_width * data.m_scale, val.z))
			{
				data.m_cornerBiomes[1] = (Biome)64;
			}
			if ((int)data.m_cornerBiomes[2] == 4 && WorldGenerator.IsDeepnorth(val.x, val.z + (float)data.m_width * data.m_scale))
			{
				data.m_cornerBiomes[2] = (Biome)64;
			}
			if ((int)data.m_cornerBiomes[3] == 4 && WorldGenerator.IsDeepnorth(val.x + (float)data.m_width * data.m_scale, val.z + (float)data.m_width * data.m_scale))
			{
				data.m_cornerBiomes[3] = (Biome)64;
			}
		}
	}
	[HarmonyPatch(typeof(WorldGenerator), "GetBiome", new Type[]
	{
		typeof(float),
		typeof(float),
		typeof(float),
		typeof(bool)
	})]
	public static class WorldGeneratorPatch
	{
		public static bool Disable;

		public static void Postfix(ref Biome __result, float wx, float wy)
		{
			if (!Disable && (int)__result == 4 && WorldGenerator.IsDeepnorth(wx, wy))
			{
				__result = (Biome)64;
			}
		}
	}
}