Decompiled source of PlatformApi v1.1.13

PlatformApi.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("PlatformApi")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+442a3dfd2890c5436fde9a4d5bd00d2e28219b64")]
[assembly: AssemblyProduct("PlatformApi")]
[assembly: AssemblyTitle("PlatformApi")]
[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 PlatformApi
{
	[BepInPlugin("com.David_Loves_JellyCar_Worlds.PlatformApi", "PlatformApi", "1.1.0")]
	public class PlatformApi : BaseUnityPlugin
	{
		public enum PathType
		{
			None,
			AntiLockPlatform,
			VectorFieldPlatform
		}

		[HarmonyPatch(typeof(StickyRoundedRectangle))]
		public class Patches
		{
			[HarmonyPatch("Awake")]
			[HarmonyPostfix]
			public static void Patch(StickyRoundedRectangle __instance)
			{
				if ((Object)(object)((Component)__instance).gameObject.GetComponent<Boulder>() == (Object)null)
				{
					PlatformList.Add(((Component)__instance).gameObject);
				}
			}
		}

		private static StickyRoundedRectangle platformPrefab;

		public static Object SlimeCamObject;

		public static Material PlatformMat;

		public static Logger logger = new Logger();

		public static AssetBundle MyAssetBundle;

		public static List<GameObject> PlatformList = new List<GameObject>();

		public static ScaleChanger scaleChanger;

		public static bool gameInProgress;

		public static GameSessionHandler GameSessionHandler2;

		public static MachoThrow2 throw2;

		public void Awake()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Expected O, but got Unknown
			SceneManager.sceneLoaded += OnSceneLoaded;
			Debug.Log((object)"Awake");
			Harmony val = new Harmony("com.David_Loves_JellyCar_Worlds.PlatformApi");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"harmany created");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PlatformApi Patch Compleate!");
			GameObject[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[];
			((BaseUnityPlugin)this).Logger.LogInfo((object)"getting platform object");
			GameObject val2 = null;
			int num = 0;
			int num2 = 2;
			GameObject[] array2 = array;
			foreach (GameObject val3 in array2)
			{
				if (((Object)val3).name == "Platform")
				{
					val2 = val3;
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Found the Platform object");
					num++;
					if (num == num2)
					{
						break;
					}
				}
				if (((Object)val3).name == "Throw")
				{
					throw2 = val3.GetComponent<MachoThrow2>();
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Found the MachoThrow2");
					num++;
					if (num == num2)
					{
						break;
					}
				}
				ShootScaleChange[] array3 = Resources.FindObjectsOfTypeAll(typeof(ShootScaleChange)) as ShootScaleChange[];
				Debug.Log((object)"getting platform object");
				ShootScaleChange[] array4 = array3;
				foreach (ShootScaleChange val4 in array4)
				{
					scaleChanger = val4.ScaleChangerPrefab;
				}
			}
			if (Object.op_Implicit((Object)(object)val2))
			{
				Component component = val2.GetComponent(typeof(PlatformTransform));
				PlatformTransform val5 = (PlatformTransform)(object)((component is PlatformTransform) ? component : null);
				platformPrefab = val5.platformPrefab;
			}
			if (!Object.op_Implicit((Object)(object)MyAssetBundle))
			{
				MyAssetBundle = AssetBundle.LoadFromFile(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) + "/assetbundle2");
			}
			string[] allAssetNames = MyAssetBundle.GetAllAssetNames();
			string[] array5 = allAssetNames;
			foreach (string text in array5)
			{
				Debug.Log((object)("asset name is: " + text));
			}
			SlimeCamObject = (Object)(GameObject)MyAssetBundle.LoadAsset("assets/assetbundleswanted/slimetrailcam.prefab");
			MyAssetBundle.Unload(false);
		}

		public void Update()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)GameSessionHandler2))
			{
				gameInProgress = (bool)AccessTools.Field(typeof(GameSessionHandler), "gameInProgress").GetValue(GameSessionHandler2) && Updater.SimTimeSinceLevelLoaded > (Fix)2.5;
			}
			else
			{
				gameInProgress = false;
			}
		}

		public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (!IsLevelName(((Scene)(ref scene)).name))
			{
				return;
			}
			Debug.Log((object)"OnSceneLoaded");
			List<GameObject> list = new List<GameObject>();
			foreach (GameObject platform in PlatformList)
			{
				if ((Object)(object)platform != (Object)null)
				{
					list.Add(platform);
				}
			}
			PlatformList = list;
			GameObject val = GameObject.Find("Level");
			if ((Object)(object)val == (Object)null)
			{
				val = GameObject.Find("Level (1)");
			}
			if (Object.op_Implicit((Object)(object)val))
			{
				Transform child = val.transform.GetChild(0);
				if (Object.op_Implicit((Object)(object)child))
				{
					PlatformMat = ((Renderer)((Component)child).gameObject.GetComponent<SpriteRenderer>()).material;
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Couldnt Find Platfrom to steal Platform Mat from. this can happen if you remove all platforms on scene load. pls manualy steal a platfrom mat and set PlatformApi.PlatformMat to it.");
					Debug.LogWarning((object)"Couldnt Find Platfrom to steal Platform Mat from. this can happen if you remove all platforms on scene load. pls manualy steal a platfrom mat and set PlatformApi.PlatformMat to it.");
				}
				((BaseUnityPlugin)this).Logger.LogInfo((object)"getting GameSessionHandler");
				GameObject val2 = GameObject.Find("PlayerList");
				if ((Object)(object)val2 == (Object)null)
				{
					val2 = GameObject.Find("PlayerList (1)");
				}
				GameSessionHandler2 = val2.GetComponent<GameSessionHandler>();
			}
		}

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

		public static GameObject SpawnPlatform(Fix X, Fix Y, Fix Width, Fix Height, Fix Radius, Fix rotatson, double MassPerArea = 0.05, Vector4[] color = null, PlatformType platformType = 5, bool UseSlimeCam = false, Sprite sprite = null, PathType pathType = PathType.None, double OrbitForce = 1.0, Vec2[] OrbitPath = null, double DelaySeconds = 1.0, double orbitSpeed = 100.0, double expandSpeed = 100.0, Vec2[] centerPoint = null, double normalSpeedFriction = 1.0, double DeadZoneDist = 1.0, double OrbitAccelerationMulitplier = 1.0, double targetRadius = 5.0, double ovalness01 = 1.0)
		{
			//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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//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_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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_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_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: 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_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_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: 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_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_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: 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);
			component.MassPerArea = FloorToThousandnths(MassPerArea);
			SpriteRenderer val2 = (SpriteRenderer)AccessTools.Field(typeof(StickyRoundedRectangle), "spriteRen").GetValue(val);
			if ((Object)(object)sprite != (Object)null)
			{
				val2.sprite = sprite;
				((Renderer)val2).material = PlatformMat;
				Transform transform = ((Component)val).transform;
				((Component)transform).gameObject.tag = "ground";
			}
			if (color != null)
			{
				val2.color = Color.op_Implicit(color[0]);
			}
			val.platformType = platformType;
			if (UseSlimeCam)
			{
				((Renderer)val2).material = PlatformMat;
				Transform transform2 = ((Component)val).transform;
				Object.Instantiate(SlimeCamObject, transform2);
				((Component)transform2).gameObject.tag = "ground";
			}
			ShakablePlatform component2 = ((Component)component).GetComponent<ShakablePlatform>();
			AccessTools.Field(typeof(ShakablePlatform), "originalMaterial").SetValue(component2, ((Renderer)val2).material);
			if (pathType == PathType.AntiLockPlatform)
			{
				Component obj = ((Component)component).gameObject.AddComponent(typeof(AntiLockPlatform));
				AntiLockPlatform val3 = (AntiLockPlatform)(object)((obj is AntiLockPlatform) ? obj : null);
				val3.OrbitForce = FloorToThousandnths(OrbitForce);
				val3.OrbitPath = OrbitPath;
				val3.DelaySeconds = FloorToThousandnths(DelaySeconds);
			}
			if (pathType == PathType.VectorFieldPlatform)
			{
				Vec2 centerPoint2 = Vec2.zero;
				if (centerPoint != null)
				{
					centerPoint2 = centerPoint[0];
				}
				Component obj2 = ((Component)component).gameObject.AddComponent(typeof(VectorFieldPlatform));
				VectorFieldPlatform val4 = (VectorFieldPlatform)(object)((obj2 is VectorFieldPlatform) ? obj2 : null);
				val4.centerPoint = centerPoint2;
				val4.DeadZoneDist = FloorToThousandnths(DeadZoneDist);
				val4.DelaySeconds = FloorToThousandnths(DelaySeconds);
				val4.expandSpeed = FloorToThousandnths(expandSpeed);
				val4.normalSpeedFriction = FloorToThousandnths(normalSpeedFriction);
				val4.OrbitAccelerationMulitplier = FloorToThousandnths(OrbitAccelerationMulitplier);
				val4.orbitSpeed = FloorToThousandnths(orbitSpeed);
				val4.ovalness01 = FloorToThousandnths(ovalness01);
				val4.targetRadius = FloorToThousandnths(targetRadius);
			}
			return ((Component)((Component)val).transform).gameObject;
		}

		internal static Fix FloorToThousandnths(double value)
		{
			//IL_0002: 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_0012: 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_0022: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			return Fix.Floor((Fix)value * (Fix)1000L) / (Fix)1000L;
		}

		internal 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(newHeight, newWidth, newRadius, true);
		}

		public static void ResizePlatform(GameObject platform, Fix newWidth, Fix newHeight, Fix newRadius)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			ResizablePlatform component = platform.GetComponent<ResizablePlatform>();
			component.ResizePlatform(newHeight, newWidth, newRadius, true);
		}

		public static void SetRot(GameObject platform, Fix rot)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			BoplBody component = platform.GetComponent<BoplBody>();
			component.up = new Vec2(rot % Fix.PiTimes2);
		}

		public static Fix GetRot(GameObject platform)
		{
			//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_0013: 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)
			BoplBody component = platform.GetComponent<BoplBody>();
			return Vec2.NormalizedVectorAngle(component.up);
		}

		public static void SetHomeRot(GameObject platform, Fix rot)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			AnimateVelocity component = platform.GetComponent<AnimateVelocity>();
			component.homeRotation = rot % Fix.PiTimes2;
		}

		public static Fix GetHomeRot(GameObject platform)
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			AnimateVelocity component = platform.GetComponent<AnimateVelocity>();
			return component.homeRotation;
		}

		public static bool SetMassPerArea(GameObject platform, Fix MassPerArea)
		{
			//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)
			ResizablePlatform component = platform.GetComponent<ResizablePlatform>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.MassPerArea = MassPerArea;
				return true;
			}
			return false;
		}

		public static bool SetMass(GameObject platform, Fix Mass)
		{
			//IL_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)platform.GetComponent<ResizablePlatform>()))
			{
				BoplBody component = platform.GetComponent<BoplBody>();
				component.InverseMass = Fix.One / Mass;
				return true;
			}
			return false;
		}

		public static Fix GetMass(GameObject platform)
		{
			//IL_0008: 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_0013: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			BoplBody component = platform.GetComponent<BoplBody>();
			return Fix.One / component.InverseMass;
		}

		public static void SetSprite(GameObject platform, Sprite sprite)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			StickyRoundedRectangle component = platform.GetComponent<StickyRoundedRectangle>();
			SpriteRenderer val = (SpriteRenderer)AccessTools.Field(typeof(StickyRoundedRectangle), "spriteRen").GetValue(component);
			val.sprite = sprite;
			((Renderer)val).material = PlatformMat;
			ShakablePlatform component2 = platform.GetComponent<ShakablePlatform>();
			AccessTools.Field(typeof(ShakablePlatform), "originalMaterial").SetValue(component2, ((Renderer)val).material);
		}

		public static void SetColor(GameObject platform, Color color)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			StickyRoundedRectangle component = platform.GetComponent<StickyRoundedRectangle>();
			SpriteRenderer val = (SpriteRenderer)AccessTools.Field(typeof(StickyRoundedRectangle), "spriteRen").GetValue(component);
			val.color = color;
			Transform transform = ((Component)component).transform;
			((Component)transform).gameObject.tag = "ground";
		}

		public static void SetType(GameObject platform, PlatformType platformType)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			StickyRoundedRectangle component = platform.GetComponent<StickyRoundedRectangle>();
			component.platformType = platformType;
		}

		public static void AddAntiLockPlatform(GameObject platform, Fix OrbitForce, Vec2[] OrbitPath, Fix DelaySeconds)
		{
			//IL_005d: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)platform.GetComponent<VectorFieldPlatform>() != (Object)null)
			{
				VectorFieldPlatform component = platform.GetComponent<VectorFieldPlatform>();
				((MonoUpdatable)component).IsDestroyed = true;
				Object.Destroy((Object)(object)component);
			}
			AntiLockPlatform val = (AntiLockPlatform)((!((Object)(object)platform.GetComponent<AntiLockPlatform>() != (Object)null)) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)platform.GetComponent<AntiLockPlatform>()));
			val.OrbitForce = OrbitForce;
			val.OrbitPath = OrbitPath;
			val.DelaySeconds = DelaySeconds;
		}

		public static AntiLockPlatform GetAntiLockPlatform(GameObject platform)
		{
			return platform.GetComponent<AntiLockPlatform>();
		}

		public static void AddVectorFieldPlatform(GameObject platform, Fix DelaySeconds, Fix orbitSpeed, Fix expandSpeed, Vec2 centerPoint, Fix normalSpeedFriction, Fix DeadZoneDist, Fix OrbitAccelerationMulitplier, Fix targetRadius, Fix ovalness01)
		{
			//IL_005d: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_006e: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_008c: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)platform.GetComponent<AntiLockPlatform>() != (Object)null)
			{
				AntiLockPlatform component = platform.GetComponent<AntiLockPlatform>();
				((MonoUpdatable)component).IsDestroyed = true;
				Object.Destroy((Object)(object)component);
			}
			VectorFieldPlatform val = (VectorFieldPlatform)((!((Object)(object)platform.GetComponent<VectorFieldPlatform>() != (Object)null)) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)platform.GetComponent<VectorFieldPlatform>()));
			val.centerPoint = centerPoint;
			val.DeadZoneDist = DeadZoneDist;
			val.DelaySeconds = DelaySeconds;
			val.expandSpeed = expandSpeed;
			val.normalSpeedFriction = normalSpeedFriction;
			val.OrbitAccelerationMulitplier = OrbitAccelerationMulitplier;
			val.orbitSpeed = orbitSpeed;
			val.ovalness01 = ovalness01;
			val.targetRadius = targetRadius;
		}

		public static VectorFieldPlatform GetVectorFieldPlatform(GameObject platform)
		{
			return platform.GetComponent<VectorFieldPlatform>();
		}

		public static void SetMaterial(GameObject platform, Material material)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			StickyRoundedRectangle component = platform.GetComponent<StickyRoundedRectangle>();
			SpriteRenderer val = (SpriteRenderer)AccessTools.Field(typeof(StickyRoundedRectangle), "spriteRen").GetValue(component);
			((Renderer)val).material = material;
			ShakablePlatform component2 = platform.GetComponent<ShakablePlatform>();
			AccessTools.Field(typeof(ShakablePlatform), "originalMaterial").SetValue(component2, ((Renderer)val).material);
		}

		public static void AddForce(GameObject platform, Vec2 f, ForceMode2D forceMode = 0)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			BoplBody component = platform.GetComponent<BoplBody>();
			component.AddForce(f, forceMode);
		}

		public static void AddForceAtPosition(GameObject platform, Vec2 f, Vec2 pos, ForceMode2D forceMode = 0)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			BoplBody component = platform.GetComponent<BoplBody>();
			component.AddForceAtPosition(f, pos, forceMode);
		}

		public static bool RemovePlatformFancy(GameObject platform)
		{
			ResizablePlatform component = platform.GetComponent<ResizablePlatform>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.RemovePlatform();
				return true;
			}
			return false;
		}

		public static void RemovePlatform(GameObject platform)
		{
			Updater.DestroyFix(platform);
		}

		public static Boulder SpawnBoulder(Vec2 Pos, Fix Scale, PlatformType platformType, Color color, Sprite sprite = null)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0026: 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_0044: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected I4, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			Boulder val = (Boulder)AccessTools.Field(typeof(MachoThrow2), "boulderPrefab").GetValue(throw2);
			Boulder val2 = FixTransform.InstantiateFixed<Boulder>(val, Pos);
			DPhysicsRoundedRect hitbox = val2.hitbox;
			hitbox.Scale = Scale;
			hitbox.ManualInit();
			hitbox.Scale = Scale;
			((Component)hitbox).GetComponent<StickyRoundedRectangle>().platformType = platformType;
			SpriteRenderer component = ((Component)hitbox).GetComponent<SpriteRenderer>();
			if ((Object)(object)sprite != (Object)null)
			{
				component.sprite = sprite;
			}
			else
			{
				component.sprite = throw2.boulders.sprites[(int)platformType].sprite;
			}
			component.color = color;
			return val2;
		}

		public static Vec2 GetHome(GameObject platform)
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			AnimateVelocity component = platform.GetComponent<AnimateVelocity>();
			return component.HomePosition;
		}

		public static void SetHome(GameObject platform, Vec2 NewHome)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			AnimateVelocity component = platform.GetComponent<AnimateVelocity>();
			component.HomePosition = NewHome;
		}

		public static Vec2 GetPos(GameObject platform)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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)
			return platform.GetComponent<BoplBody>().position;
		}

		public static void SetPos(GameObject platform, Vec2 NewPos)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			platform.GetComponent<BoplBody>().position = NewPos;
		}

		public static Fix GetScale(GameObject platform)
		{
			//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_0017: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)platform.GetComponent<DPhysicsRoundedRect>()))
			{
				IPhysicsCollider monobehaviourCollider = platform.GetComponent<DPhysicsRoundedRect>().pp.monobehaviourCollider;
				return monobehaviourCollider.Scale;
			}
			return Fix.Zero;
		}

		public static bool SetScale(GameObject platform, Fix NewScale)
		{
			//IL_0017: 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)
			if (Object.op_Implicit((Object)(object)platform.GetComponent<DPhysicsRoundedRect>()))
			{
				IPhysicsCollider monobehaviourCollider = platform.GetComponent<DPhysicsRoundedRect>().pp.monobehaviourCollider;
				monobehaviourCollider.Scale = NewScale;
				return true;
			}
			return false;
		}

		public static ScaleChanger ScaleSmooth(GameObject platform, Fix multiplier)
		{
			//IL_0006: 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_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_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)
			ScaleChanger val = FixTransform.InstantiateFixed<ScaleChanger>(scaleChanger, Vec2.zero);
			IPhysicsCollider monobehaviourCollider = platform.GetComponent<DPhysicsRoundedRect>().pp.monobehaviourCollider;
			val.victim = monobehaviourCollider;
			val.multiplier = multiplier;
			val.smallNonPlayersMultiplier = multiplier;
			return val;
		}

		public static Fix PlatformArea(GameObject platform)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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)
			return platform.GetComponent<DPhysicsRoundedRect>().PlatformArea();
		}

		public static Fix PlatformArea(Fix Width, Fix Height, Fix Radius)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0008: 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_000a: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			DPhysicsRoundedRect val = new DPhysicsRoundedRect();
			return val.PlatformArea(Width, Height, Radius);
		}

		public void AddShake(GameObject platform, Fix duration, Fix shakeAmount, AnimationCurveFixed shakeCurve = null)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ShakablePlatform component = platform.GetComponent<ShakablePlatform>();
			component.AddShake(duration, shakeAmount, 1, (Material)null, shakeCurve);
		}

		public static DPhysicsRoundedRect GetDPhysicsRoundedRect(GameObject platform)
		{
			return platform.GetComponent<DPhysicsRoundedRect>();
		}

		public static ShakablePlatform GetShakablePlatform(GameObject platform)
		{
			return platform.GetComponent<ShakablePlatform>();
		}

		public static StickyRoundedRectangle GetStickyRoundedRectangle(GameObject platform)
		{
			return platform.GetComponent<StickyRoundedRectangle>();
		}

		public static BoplBody GetBoplBody(GameObject platform)
		{
			return platform.GetComponent<BoplBody>();
		}

		public static AnimateVelocity GetAnimateVelocity(GameObject platform)
		{
			return platform.GetComponent<AnimateVelocity>();
		}

		public static FixTransform GetFixTransform(GameObject platform)
		{
			return platform.GetComponent<FixTransform>();
		}

		public static SpriteRenderer GetSpriteRenderer(GameObject platform)
		{
			return platform.GetComponent<SpriteRenderer>();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "PlatformApi";

		public const string PLUGIN_NAME = "PlatformApi";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}