Decompiled source of Map Randomiser v1.0.1

MapRandomiser.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MapRandomiser")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MapRandomiser")]
[assembly: AssemblyTitle("MapRandomiser")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 MapMaker
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MapRandomiser";

		public const string PLUGIN_NAME = "MapRandomiser";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MapRandomiser
{
	[BepInPlugin("com.MLT.MapRandomiser", "MapRandomiser", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static GameObject PlatformAbility;

		public static Transform levelt;

		public static StickyRoundedRectangle platformPrefab;

		public static int CurrentMapId;

		public static Fix[][][] SpaceTakenUp;

		public static ConfigEntry<double> min_dist;

		public static ConfigEntry<int> PlatPlaceAttempts;

		public static ConfigEntry<double> ChanceYouAttemptToPlaceAPlatformAgien;

		public static ConfigEntry<double> CirclePlatformChance;

		public static Fix MinX = (Fix)(-97.27);

		public static Fix MinY = (Fix)(-26L);

		public static Fix MaxX = (Fix)97.6;

		public static Fix MaxY = (Fix)40L;

		public static ConfigEntry<double> MinScaleX;

		public static ConfigEntry<double> MaxScaleX;

		public static ConfigEntry<double> MinScaleY;

		public static ConfigEntry<double> MaxScaleY;

		public static ConfigEntry<double> MinRadius;

		public static ConfigEntry<double> MaxRadius;

		public static ConfigEntry<bool> Rotate;

		public static ConfigEntry<bool> RandomColors;

		public static ConfigEntry<double> OneByOneBlockMass;

		public static ConfigFile config;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MapRandomiser Has been loaded");
			Harmony val = new Harmony("com.MLT.MapRandomiser");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony harmony = new Harmony -- Melon, 2024");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MapRandomiser Patch Compleate!");
			SceneManager.sceneLoaded += OnSceneLoaded;
			config = ((BaseUnityPlugin)this).Config;
			min_dist = config.Bind<double>("Settings", "Minimum distance", 2.0, "the minimum distance betreen platforms allowed in bopl units. below 2 there is a chance you could be squished on spawn.");
			PlatPlaceAttempts = config.Bind<int>("Settings", "Platform Place Attempts", 30, "how many platforms it will attempt to place. if it fails there will be a chance it attempts to place agien.");
			ChanceYouAttemptToPlaceAPlatformAgien = config.Bind<double>("Chances", "Chance It Attempts To Place A Platform Agien", 2.0, "chance of attempting to place a platform agien if it fails. with a 1/x chance where x is this value.");
			CirclePlatformChance = config.Bind<double>("Chances", "Circle Platform Chance", 5.0, "chance a platform is a circle platform as 1/x where x is this value.");
			MinScaleX = config.Bind<double>("Width", "Minimum Width", 0.25, "Minimum Platform Width in bopl units");
			MaxScaleX = config.Bind<double>("Width", "Maximum Width", 5.0, "Maximum Platform Width in bopl units");
			MinScaleY = config.Bind<double>("Height", "Minimum Height", 0.25, "Minimum Platform Height in bopl units");
			MaxScaleY = config.Bind<double>("Height", "Maximum Height", 5.0, "Maximum Platform Height in bopl units");
			MinRadius = config.Bind<double>("Radius", "Minimum Radius", 0.25, "Minimum Platform Radius in bopl units");
			MaxRadius = config.Bind<double>("Radius", "Maximum Radius", 5.0, "Maximum Platform Radius in bopl units");
			Rotate = config.Bind<bool>("Rotate", "Rotate", true, "can platforms spawn rotated.");
			RandomColors = config.Bind<bool>("Colors", "Random Colors", true, "Use Random Colors (note that this is the one value you dont need everyone to have the same value for.)");
			OneByOneBlockMass = config.Bind<double>("Mass", "1 by 1 block mass", 1.0, "the mass of a platform that is 1 by 1 units");
		}

		private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("OnSceneLoaded: " + ((Scene)(ref scene)).name));
			if (!IsLevelName(((Scene)(ref scene)).name))
			{
				return;
			}
			CurrentMapId = GetMapIdFromSceneName(((Scene)(ref scene)).name);
			GameObject[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[];
			Debug.Log((object)"getting platform object");
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if (((Object)val).name == "Platform")
				{
					PlatformAbility = val;
					Debug.Log((object)("Found the object: " + ((Object)val).name));
					break;
				}
			}
			Component component = PlatformAbility.GetComponent(typeof(PlatformTransform));
			PlatformTransform val2 = (PlatformTransform)(object)((component is PlatformTransform) ? component : null);
			platformPrefab = val2.platformPrefab;
			levelt = GameObject.Find("Level").transform;
			foreach (Transform item in levelt)
			{
				Transform val3 = item;
				Updater.DestroyFix(((Component)val3).gameObject);
			}
			SpaceTakenUp = Array.Empty<Fix[][]>();
			GameObject val4 = GameObject.Find("PlayerList");
			if ((Object)(object)val4 == (Object)null)
			{
				val4 = GameObject.Find("PlayerList (1)");
			}
			Vec2[] teamSpawns = val4.GetComponent<GameSessionHandler>().teamSpawns;
			Vec2[] array3 = teamSpawns;
			foreach (Vec2 val5 in array3)
			{
				SpawnPlatform(val5.x, val5.y - (Fix)3L, (Fix)2L, (Fix)2L, (Fix)1L, (Fix)0L);
			}
			for (int k = 0; k < PlatPlaceAttempts.Value; k++)
			{
				AttemptToSpawnRandomPlatform();
			}
		}

		public static void SpawnPlatform(Fix X, Fix Y, Fix Width, Fix Height, Fix Radius, Fix rotatson)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			StickyRoundedRectangle val = FixTransform.InstantiateFixed<StickyRoundedRectangle>(platformPrefab, new Vec2(X, Y));
			val.rr.Scale = Fix.One;
			ResizablePlatform component = ((Component)val).GetComponent<ResizablePlatform>();
			((Component)component).GetComponent<DPhysicsRoundedRect>().ManualInit();
			ResizePlatform(component, Width, Height, Radius);
			val.GetGroundBody().up = new Vec2(rotatson);
			if (RandomColors.Value)
			{
				((Component)val).GetComponent<SpriteRenderer>().color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
			}
			AccessTools.Field(typeof(BoplBody), "mass").SetValue(val.GetGroundBody(), CalculateMassOfPlatform(Width, Height, Radius));
			Debug.Log((object)("Set mass to " + (double)CalculateMassOfPlatform(Width, Height, Radius)));
			string[] obj = new string[10] { "Spawned platform at position (", null, null, null, null, null, null, null, null, null };
			Fix val2 = X;
			obj[1] = ((object)(Fix)(ref val2)).ToString();
			obj[2] = ", ";
			val2 = Y;
			obj[3] = ((object)(Fix)(ref val2)).ToString();
			obj[4] = ") with dimensions (";
			val2 = Width;
			obj[5] = ((object)(Fix)(ref val2)).ToString();
			obj[6] = ", ";
			val2 = Height;
			obj[7] = ((object)(Fix)(ref val2)).ToString();
			obj[8] = ") and radius ";
			val2 = Radius;
			obj[9] = ((object)(Fix)(ref val2)).ToString();
			Debug.Log((object)string.Concat(obj));
			Fix[] array = TrueWidthAndHight(Width, Height, Radius, rotatson);
			Fix val3 = array[0];
			Fix val4 = array[1];
			Fix val5 = X - val3 / (Fix)2L - (Fix)min_dist.Value;
			Fix val6 = Y - val4 / (Fix)2L - (Fix)min_dist.Value;
			Fix val7 = X + val3 / (Fix)2L + (Fix)min_dist.Value;
			Fix val8 = Y + val4 / (Fix)2L + (Fix)min_dist.Value;
			Fix[] array2 = (Fix[])(object)new Fix[2] { val5, val6 };
			Fix[] array3 = (Fix[])(object)new Fix[2] { val7, val8 };
			Fix[][] rect = new Fix[2][] { array2, array3 };
			SpaceTakenUp = AppendRect(rect);
		}

		public static void Update()
		{
		}

		public static void ResizePlatform(ResizablePlatform platform, Fix newWidth, Fix newHeight, Fix newRadius)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			platform.ResizePlatform(newWidth, newHeight, newRadius, true);
		}

		public static bool IsLevelName(string input)
		{
			Regex regex = new Regex("Level[0-9]+", RegexOptions.IgnoreCase);
			return regex.IsMatch(input);
		}

		public static double ConvertToRadians(double angle)
		{
			return Math.PI / 180.0 * angle;
		}

		public static int GetMapIdFromSceneName(string s)
		{
			Regex regex = new Regex("[^\\d]+");
			if (string.IsNullOrEmpty(s))
			{
				return 0;
			}
			string s2 = regex.Replace(s, "");
			return int.Parse(s2) - 1;
		}

		public static Fix[][][] AppendRect(Fix[][] rect)
		{
			Array.Resize(ref SpaceTakenUp, SpaceTakenUp.Length + 1);
			SpaceTakenUp[SpaceTakenUp.Length - 1] = rect;
			return SpaceTakenUp;
		}

		public static Fix[] TrueWidthAndHight(Fix Width, Fix Height, Fix Radius, Fix rotatson)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			double x = (double)Width;
			double num = (double)Height;
			double num2 = (double)rotatson;
			Fix val = (Fix)Math.Max(Math.Abs(Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(num, 2.0)) * Math.Cos(num2 + Math.Atan2(num, x))), Math.Abs(Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(num, 2.0)) * Math.Cos(num2 - Math.Atan2(num, x))));
			Fix val2 = (Fix)Math.Max(Math.Abs(Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(num, 2.0)) * Math.Sin(num2 + Math.Atan2(num, x))), Math.Abs(Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(num, 2.0)) * Math.Sin(num2 - Math.Atan2(num, x))));
			val += Radius;
			val2 += Radius;
			return (Fix[])(object)new Fix[2]
			{
				val * (Fix)2L,
				val2 * (Fix)2L
			};
		}

		public static bool IsValidPlacement(Fix X, Fix Y, Fix Width, Fix Height, Fix Radius, Fix rotatson)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			Fix[] array = TrueWidthAndHight(Width, Height, Radius, rotatson);
			Fix val = array[0];
			Fix val2 = array[1];
			Fix val3 = X - val / (Fix)2L;
			Fix val4 = Y - val2 / (Fix)2L;
			Fix val5 = X + val / (Fix)2L;
			Fix val6 = Y + val2 / (Fix)2L;
			Fix[][][] spaceTakenUp = SpaceTakenUp;
			foreach (Fix[][] array2 in spaceTakenUp)
			{
				Fix val7 = array2[0][0];
				Fix val8 = array2[0][1];
				Fix val9 = array2[1][0];
				Fix val10 = array2[1][1];
				Fix val11 = Fix.Max(val3, val7);
				Fix val12 = Fix.Max(val4, val8);
				Fix val13 = Fix.Min(val5, val9);
				Fix val14 = Fix.Min(val6, val10);
				if (!(val11 > val13) && !(val12 > val14))
				{
					return false;
				}
			}
			return true;
		}

		public static void AttemptToSpawnRandomPlatform()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			Fix x = Updater.RandomFix(MinX, MaxX);
			Fix y = Updater.RandomFix(MinY, MaxY);
			Fix zero = Fix.Zero;
			Fix zero2 = Fix.Zero;
			if (Updater.RandomFix(Fix.Zero, (Fix)CirclePlatformChance.Value) > 1L)
			{
				zero = Updater.RandomFix((Fix)MinScaleX.Value, (Fix)MaxScaleX.Value);
				zero2 = Updater.RandomFix((Fix)MinScaleY.Value, (Fix)MaxScaleY.Value);
			}
			else
			{
				zero = (Fix)0.05;
				zero2 = (Fix)0.05;
			}
			Fix radius = Updater.RandomFix((Fix)MinRadius.Value, (Fix)MaxRadius.Value);
			Fix rotatson = Fix.Zero;
			if (Rotate.Value)
			{
				rotatson = Updater.RandomFix(Fix.Zero, Fix.PiTimes2);
			}
			if (IsValidPlacement(x, y, zero, zero2, radius, rotatson))
			{
				SpawnPlatform(x, y, zero, zero2, radius, rotatson);
			}
			else if (Updater.RandomFix(Fix.Zero, (Fix)ChanceYouAttemptToPlaceAPlatformAgien.Value) < (Fix)1L)
			{
				AttemptToSpawnRandomPlatform();
			}
		}

		public static Fix CalculateMassOfPlatform(Fix Width, Fix Height, Fix Radius)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			Fix val = Width * (Fix)2L + Radius;
			Fix val2 = Height * (Fix)2L + Radius;
			Fix val3 = val * val2;
			if (Width == (Fix)0.05 && Height == (Fix)0.05)
			{
				val3 = Fix.Pi * Radius * Radius;
			}
			return val3 * (Fix)OneByOneBlockMass.Value;
		}
	}
}