Decompiled source of Acolyte Nanachi v1.2.10

plugins/AcolyteNanachi.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AcolyteNanachi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.10.0")]
[assembly: AssemblyInformationalVersion("1.2.10")]
[assembly: AssemblyProduct("AcolyteNanachi")]
[assembly: AssemblyTitle("AcolyteNanachi")]
[assembly: AssemblyVersion("1.2.10.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
	[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 AcolyteNanachi
{
	internal sealed class NanachiAsset
	{
		internal sealed class Bone
		{
			internal int Parent;

			internal string Name = string.Empty;

			internal Vector3 Position;

			internal Quaternion Rotation;

			internal Quaternion RestRotation;
		}

		internal sealed class Part
		{
			internal Mesh Mesh;

			internal Material[] Materials = Array.Empty<Material>();
		}

		internal Bone[] Bones { get; private set; } = Array.Empty<Bone>();

		internal Part[] Parts { get; private set; } = Array.Empty<Part>();

		internal Bounds Bounds { get; private set; }

		internal static NanachiAsset Load(string directory)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			List<Object> list = new List<Object>();
			try
			{
				using BinaryReader binaryReader = new BinaryReader(File.OpenRead(Path.Combine(directory, "nanachi.bin")));
				if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "NCHI" || binaryReader.ReadInt32() != 1)
				{
					throw new InvalidDataException("Unsupported Nanachi model format.");
				}
				NanachiAsset nanachiAsset = new NanachiAsset
				{
					Bones = new Bone[Count(binaryReader, 1, 256)]
				};
				int count = Count(binaryReader, 1, 64);
				nanachiAsset.Parts = new Part[Count(binaryReader, 1, 32)];
				Matrix4x4[] bind = nanachiAsset.ReadBones(binaryReader);
				Material[] materials = ReadMaterials(binaryReader, count, directory, list);
				for (int i = 0; i < nanachiAsset.Parts.Length; i++)
				{
					Part part = ReadMesh(binaryReader, bind, materials, list);
					nanachiAsset.Parts[i] = part;
					if (i == 0)
					{
						nanachiAsset.Bounds = part.Mesh.bounds;
						continue;
					}
					Bounds bounds = nanachiAsset.Bounds;
					((Bounds)(ref bounds)).Encapsulate(part.Mesh.bounds);
					nanachiAsset.Bounds = bounds;
				}
				if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length)
				{
					throw new InvalidDataException("Unexpected data after the Nanachi meshes.");
				}
				return nanachiAsset;
			}
			catch
			{
				foreach (Object item in list)
				{
					Object.Destroy(item);
				}
				throw;
			}
		}

		private Matrix4x4[] ReadBones(BinaryReader reader)
		{
			//IL_0042: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4[] array = (Matrix4x4[])(object)new Matrix4x4[Bones.Length];
			Matrix4x4[] array2 = (Matrix4x4[])(object)new Matrix4x4[Bones.Length];
			int num = 0;
			while (num < Bones.Length)
			{
				Bone bone = new Bone
				{
					Parent = reader.ReadInt32(),
					Name = ReadString(reader),
					Position = ReadVector(reader),
					Rotation = new Quaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle())
				};
				bool num2;
				if (num != 0)
				{
					if (bone.Parent < 0)
					{
						goto IL_009b;
					}
					num2 = bone.Parent >= num;
				}
				else
				{
					num2 = bone.Parent != -1;
				}
				if (!num2)
				{
					Matrix4x4 val = Matrix4x4.TRS(bone.Position, bone.Rotation, Vector3.one);
					array[num] = ((bone.Parent < 0) ? val : (array[bone.Parent] * val));
					bone.RestRotation = ((Matrix4x4)(ref array[num])).rotation;
					array2[num] = ((Matrix4x4)(ref array[num])).inverse;
					Bones[num] = bone;
					num++;
					continue;
				}
				goto IL_009b;
				IL_009b:
				throw new InvalidDataException("Invalid Nanachi bone hierarchy.");
			}
			return array2;
		}

		private static Material[] ReadMaterials(BinaryReader reader, int count, string directory, List<Object> created)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			Shader val = Shader.Find("Hopoo Games/Deferred/Standard") ?? Shader.Find("Standard") ?? Shader.Find("Unlit/Texture");
			if (!Object.op_Implicit((Object)(object)val))
			{
				throw new InvalidOperationException("No supported shader for Nanachi was loaded.");
			}
			Dictionary<(string, bool), Texture2D> textures = new Dictionary<(string, bool), Texture2D>();
			Material[] array = (Material[])(object)new Material[count];
			for (int i = 0; i < count; i++)
			{
				Material val2 = new Material(val)
				{
					name = "Nanachi " + ReadString(reader)
				};
				created.Add((Object)(object)val2);
				Texture2D mainTexture = ReadTexture(ReadString(reader), linear: false);
				Texture2D val3 = ReadTexture(ReadString(reader), linear: true);
				val2.mainTexture = (Texture)(object)mainTexture;
				if (val2.HasProperty("_Color"))
				{
					val2.SetColor("_Color", Color.white);
				}
				if (val2.HasProperty("_Cull"))
				{
					val2.SetFloat("_Cull", 0f);
				}
				if (val2.HasProperty("_Glossiness"))
				{
					val2.SetFloat("_Glossiness", 0.12f);
				}
				if (Object.op_Implicit((Object)(object)val3) && val2.HasProperty("_BumpMap"))
				{
					val2.SetTexture("_BumpMap", (Texture)(object)val3);
					val2.EnableKeyword("_NORMALMAP");
				}
				if (Object.op_Implicit((Object)(object)val3) && val2.HasProperty("_NormalTex"))
				{
					val2.SetTexture("_NormalTex", (Texture)(object)val3);
					if (val2.HasProperty("_NormalStrength"))
					{
						val2.SetFloat("_NormalStrength", 0.75f);
					}
				}
				array[i] = val2;
			}
			return array;
			Texture2D? ReadTexture(string name, bool linear)
			{
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Expected O, but got Unknown
				if (name.Length == 0)
				{
					return null;
				}
				if (Path.GetFileName(name) != name || !name.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
				{
					throw new InvalidDataException("Unexpected texture name in the Nanachi model.");
				}
				if (textures.TryGetValue((name, linear), out Texture2D value))
				{
					return value;
				}
				value = new Texture2D(2, 2, (TextureFormat)4, true, linear)
				{
					name = name,
					anisoLevel = 4
				};
				created.Add((Object)(object)value);
				if (!ImageConversion.LoadImage(value, File.ReadAllBytes(Path.Combine(directory, name)), true))
				{
					throw new InvalidDataException("Unreadable Nanachi texture: " + name);
				}
				textures.Add((name, linear), value);
				return value;
			}
		}

		private static Part ReadMesh(BinaryReader reader, Matrix4x4[] bind, Material[] materials, List<Object> created)
		{
			//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_0059: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0109: 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_011e: 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_0136: Expected O, but got Unknown
			string text = ReadString(reader);
			int num = Count(reader, 3, 65535);
			int num2 = Count(reader, 1, materials.Length);
			Vector3[] array = (Vector3[])(object)new Vector3[num];
			Vector3[] array2 = (Vector3[])(object)new Vector3[num];
			Vector2[] array3 = (Vector2[])(object)new Vector2[num];
			BoneWeight[] array4 = (BoneWeight[])(object)new BoneWeight[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = ReadVector(reader);
				array2[i] = ReadVector(reader);
				array3[i] = new Vector2(reader.ReadSingle(), reader.ReadSingle());
				int num3 = i;
				BoneWeight val = default(BoneWeight);
				((BoneWeight)(ref val)).boneIndex0 = Count(reader, 0, bind.Length - 1);
				((BoneWeight)(ref val)).boneIndex1 = Count(reader, 0, bind.Length - 1);
				((BoneWeight)(ref val)).boneIndex2 = Count(reader, 0, bind.Length - 1);
				((BoneWeight)(ref val)).boneIndex3 = Count(reader, 0, bind.Length - 1);
				((BoneWeight)(ref val)).weight0 = reader.ReadSingle();
				((BoneWeight)(ref val)).weight1 = reader.ReadSingle();
				((BoneWeight)(ref val)).weight2 = reader.ReadSingle();
				((BoneWeight)(ref val)).weight3 = reader.ReadSingle();
				array4[num3] = val;
			}
			Mesh val2 = new Mesh
			{
				name = "Nanachi " + text
			};
			created.Add((Object)(object)val2);
			val2.vertices = array;
			val2.normals = array2;
			val2.uv = array3;
			val2.bindposes = bind;
			val2.boneWeights = array4;
			val2.subMeshCount = num2;
			Part part = new Part
			{
				Mesh = val2,
				Materials = (Material[])(object)new Material[num2]
			};
			for (int j = 0; j < num2; j++)
			{
				part.Materials[j] = materials[Count(reader, 0, materials.Length - 1)];
				int[] array5 = new int[Count(reader, 3, 300000)];
				for (int k = 0; k < array5.Length; k++)
				{
					array5[k] = Count(reader, 0, num - 1);
				}
				val2.SetTriangles(array5, j, false);
			}
			val2.RecalculateBounds();
			val2.RecalculateTangents();
			return part;
		}

		private static int Count(BinaryReader reader, int min, int max)
		{
			int num = reader.ReadInt32();
			if (num < min || num > max)
			{
				throw new InvalidDataException("Invalid index or size in the Nanachi model.");
			}
			return num;
		}

		private static string ReadString(BinaryReader reader)
		{
			int num = Count(reader, 0, 1024);
			byte[] array = reader.ReadBytes(num);
			if (array.Length != num)
			{
				throw new EndOfStreamException();
			}
			return Encoding.UTF8.GetString(array);
		}

		private static Vector3 ReadVector(BinaryReader reader)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
		}
	}
	internal sealed class NanachiCape
	{
		private readonly struct Influence
		{
			internal readonly int Joint;

			internal readonly Vector3 Offset;

			internal readonly float Weight;

			internal Influence(int joint, Vector3 offset, float weight)
			{
				//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)
				Joint = joint;
				Offset = offset;
				Weight = weight;
			}
		}

		private readonly struct Sample
		{
			internal readonly int Joint;

			internal readonly Influence[] Influences;

			internal Sample(int joint, Influence[] influences)
			{
				Joint = joint;
				Influences = influences;
			}
		}

		private struct Contact
		{
			internal int Joint;

			internal Vector3 Position;

			internal Vector3 Separation;

			internal float Depth;

			internal float Priority;
		}

		private readonly struct Capsule
		{
			internal readonly Vector3 Start;

			internal readonly Vector3 End;

			internal readonly Vector3 WidthAxis;

			internal readonly float WidthStart;

			internal readonly float WidthEnd;

			internal readonly float Radius;

			private readonly Vector3 length;

			private readonly float inverseLengthSquared;

			private readonly float reachSquared;

			private readonly Vector3 center;

			internal Capsule(Vector3 start, Vector3 end, float radius, Vector3 widthAxis = default(Vector3), float widthStart = 0f, float widthEnd = 0f)
			{
				//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_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_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_0028: 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_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: 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_0070: 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_007a: 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_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: 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_0094: 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)
				Start = start;
				End = end;
				WidthStart = widthStart;
				WidthEnd = widthEnd;
				Radius = radius;
				length = end - start;
				inverseLengthSquared = 1f / Mathf.Max(1E-06f, ((Vector3)(ref length)).sqrMagnitude);
				Vector3 val = widthAxis - length * (Vector3.Dot(widthAxis, length) * inverseLengthSquared);
				WidthAxis = ((Vector3)(ref val)).normalized;
				center = (start + end) * 0.5f;
				float num = ((Vector3)(ref length)).magnitude * 0.5f + radius + Mathf.Max(widthStart, widthEnd);
				reachSquared = num * num;
			}

			internal float Penetration(Vector3 point, out Vector3 separation)
			{
				//IL_0001: 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_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_0029: 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_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: 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_009f: 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_00ab: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: 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)
				separation = default(Vector3);
				Vector3 val = point - center;
				if (((Vector3)(ref val)).sqrMagnitude >= reachSquared)
				{
					return 0f;
				}
				float num = Mathf.Clamp01(Vector3.Dot(point - Start, length) * inverseLengthSquared);
				separation = point - (Start + length * num);
				if (WidthStart > 0f || WidthEnd > 0f)
				{
					float num2 = Mathf.Lerp(WidthStart, WidthEnd, num);
					separation -= WidthAxis * Mathf.Clamp(Vector3.Dot(separation, WidthAxis), 0f - num2, num2);
				}
				float sqrMagnitude = ((Vector3)(ref separation)).sqrMagnitude;
				if (!(sqrMagnitude < Radius * Radius))
				{
					return 0f;
				}
				return Radius - Mathf.Sqrt(sqrMagnitude);
			}
		}

		private const string Prefix = "ValveBiped.Bip01_";

		private const int ChainLength = 6;

		private const int JointCount = 12;

		private const int ArmCapsuleCount = 8;

		private const int CapsuleCount = 16;

		private const float StillPoseTime = 0.5f;

		private const float DisplayResponse = 10f;

		private const float DisplaySpeed = 130f;

		private const float DisplayAcceleration = 1400f;

		private const float StillTolerance = 1E-05f;

		private static readonly int[] SamplesPerJoint = new int[6] { 15, 16, 16, 9, 7, 7 };

		private static readonly float[] TorsoFollow = new float[6] { 0.22f, 0.64f, 0.83f, 0.91f, 0.96f, 0.97f };

		private static readonly float[] CorrectionLimit = new float[6] { 12f, 30f, 36f, 36f, 33f, 30f };

		private static readonly float[] ArmRadius = new float[4] { 0.052f, 0.054f, 0.069f, 0.079f };

		private readonly Transform root;

		private readonly Transform head;

		private readonly Transform chest;

		private readonly Transform pelvis;

		private readonly Quaternion inverseHeadRest;

		private readonly Quaternion inverseChestRest;

		private readonly Quaternion inversePelvisRest;

		private readonly Transform[] joints;

		private readonly Transform[] arms;

		private readonly Transform[] weapon;

		private readonly Sample[][] samples;

		private readonly Sample[][] coupledSamples = new Sample[2][];

		private readonly Transform[] anchorBones;

		private readonly Matrix4x4[] anchorMatrices;

		private readonly Vector3[] offsets = (Vector3[])(object)new Vector3[12];

		private readonly Vector3[] positions = (Vector3[])(object)new Vector3[12];

		private readonly Quaternion[] rotations = (Quaternion[])(object)new Quaternion[12];

		private readonly Quaternion[] neutral = (Quaternion[])(object)new Quaternion[12];

		private readonly Quaternion[] baseLocal = (Quaternion[])(object)new Quaternion[12];

		private readonly Quaternion[] lowerRightBase = (Quaternion[])(object)new Quaternion[3];

		private readonly Quaternion[] correction = (Quaternion[])(object)new Quaternion[12];

		private readonly Quaternion[] pausedCorrection = (Quaternion[])(object)new Quaternion[12];

		private readonly Capsule[] capsules = new Capsule[16];

		private readonly Capsule[] previousCapsules = new Capsule[16];

		private readonly Capsule[] swept = new Capsule[16];

		private readonly Vector3[] weaponPoints = (Vector3[])(object)new Vector3[7];

		private Vector3 headPosition;

		private Quaternion headRotation;

		private Quaternion smoothedTorso;

		private Quaternion previousWorldTorso;

		private float yawLag;

		private bool hasHistory;

		private int previousCount;

		private int capsuleCount;

		private int sweptCount;

		private readonly Capsule[] displayCapsules = new Capsule[16];

		private readonly Quaternion[] heldRotations = (Quaternion[])(object)new Quaternion[12];

		private readonly Vector3[] displayAngles = (Vector3[])(object)new Vector3[12];

		private readonly Vector3[] displayVelocities = (Vector3[])(object)new Vector3[12];

		private Vector3 displayRootPosition;

		private Vector3 displayHeadPosition;

		private Quaternion displayHeadRotation;

		private Quaternion displayTorso;

		private Quaternion displayWorldTorso;

		private int displayCapsuleCount;

		private float stillTime;

		private bool hasDisplayInputs;

		private bool displaySleeping;

		private float naturalRoute;

		private float previousAimYaw;

		private bool hasAimYaw;

		private const int RightSecondJoint = 7;

		private const int RightThirdJoint = 8;

		private const float RouteLookAhead = 0.1f;

		private const float RouteReleaseSpeed = 3f;

		private const float RouteDisplayResponse = 20f;

		private static readonly Vector3 NaturalSecond = new Vector3(19.69f, -4.61f, -4.7f);

		private static readonly Vector3 NaturalThird = new Vector3(6.92f, -5.2f, 13.25f);

		internal static NanachiCape? TryCreate(Transform donorRoot, IReadOnlyDictionary<string, Transform> donorBones, IReadOnlyList<Transform>? weaponChain, Mesh capeMesh, int capeSubmesh, Transform[] skinBones)
		{
			if (!donorBones.TryGetValue("ValveBiped.Bip01_Head1", out Transform value) || !donorBones.TryGetValue("ValveBiped.Bip01_Spine4", out Transform value2) || !donorBones.TryGetValue("ValveBiped.Bip01_Pelvis", out Transform value3) || capeSubmesh < 0 || capeSubmesh >= capeMesh.subMeshCount)
			{
				return null;
			}
			Transform[] array = (Transform[])(object)new Transform[12];
			Transform[] array2 = (Transform[])(object)new Transform[10];
			string[] array3 = new string[5] { "Clavicle", "UpperArm", "Forearm", "Hand", "Finger22" };
			for (int i = 0; i < 2; i++)
			{
				string arg = ((i == 0) ? "left" : "right");
				string text = "ValveBiped.Bip01_" + ((i == 0) ? "L_" : "R_");
				Transform val = value;
				for (int j = 0; j < 6; j++)
				{
					if (!donorBones.TryGetValue($"head fur {arg} {j + 1:00}", out Transform value4) || (Object)(object)value4.parent != (Object)(object)val)
					{
						return null;
					}
					array[i * 6 + j] = value4;
					val = value4;
				}
				for (int k = 0; k < array3.Length; k++)
				{
					if (!donorBones.TryGetValue(text + array3[k], out Transform value5))
					{
						return null;
					}
					array2[i * array3.Length + k] = value5;
				}
			}
			Transform[] array4 = Array.Empty<Transform>();
			if (weaponChain != null && weaponChain.Count == 7)
			{
				array4 = (Transform[])(object)new Transform[weaponChain.Count];
				for (int l = 0; l < array4.Length; l++)
				{
					if (!Object.op_Implicit((Object)(object)weaponChain[l]))
					{
						array4 = Array.Empty<Transform>();
						break;
					}
					array4[l] = weaponChain[l];
				}
			}
			Transform[] anchors;
			Sample[][] array5 = ReadSamples(capeMesh, capeSubmesh, skinBones, array, out anchors);
			if (array5[0].Length == 0 || array5[1].Length == 0)
			{
				return null;
			}
			return new NanachiCape(donorRoot, value, value2, value3, array, array2, array4, array5, anchors);
		}

		private NanachiCape(Transform root, Transform head, Transform chest, Transform pelvis, Transform[] joints, Transform[] arms, Transform[] weapon, Sample[][] samples, Transform[] anchors)
		{
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: 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_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_0242: 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_0254: 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_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			this.root = root;
			this.head = head;
			this.chest = chest;
			this.pelvis = pelvis;
			this.joints = joints;
			this.arms = arms;
			this.weapon = weapon;
			this.samples = samples;
			for (int i = 0; i < 2; i++)
			{
				List<Sample> list = new List<Sample>();
				Sample[] array = samples[1 - i];
				for (int j = 0; j < array.Length; j++)
				{
					Sample item = array[j];
					float num = 0f;
					Influence[] influences = item.Influences;
					for (int k = 0; k < influences.Length; k++)
					{
						Influence influence = influences[k];
						if (influence.Joint >= 0 && influence.Joint / 6 == i)
						{
							num += influence.Weight;
						}
					}
					if (num > 0.08f)
					{
						list.Add(item);
					}
				}
				coupledSamples[i] = list.ToArray();
			}
			anchorBones = anchors;
			anchorMatrices = (Matrix4x4[])(object)new Matrix4x4[anchors.Length];
			Quaternion val = Quaternion.Inverse(root.rotation);
			inverseHeadRest = Quaternion.Inverse(val * head.rotation);
			inverseChestRest = Quaternion.Inverse(val * chest.rotation);
			inversePelvisRest = Quaternion.Inverse(val * pelvis.rotation);
			for (int l = 0; l < 12; l++)
			{
				offsets[l] = joints[l].localPosition;
				neutral[l] = val * joints[l].rotation;
			}
			Reset();
		}

		internal void Reset()
		{
			//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)
			hasHistory = false;
			previousCount = 0;
			yawLag = 0f;
			hasDisplayInputs = false;
			displaySleeping = false;
			stillTime = 0f;
			naturalRoute = (previousAimYaw = 0f);
			hasAimYaw = false;
			for (int i = 0; i < 12; i++)
			{
				correction[i] = Quaternion.identity;
			}
		}

		internal void Step(float deltaTime, bool weaponVisible, bool anticipateHeadTurn)
		{
			//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_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_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_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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_005e: 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_0066: 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_0071: 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_007b: 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_0087: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0108: 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_01e0: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: 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_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: 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_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: 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_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4 worldToLocalMatrix = root.worldToLocalMatrix;
			Quaternion rotation = root.rotation;
			Quaternion val = Quaternion.Inverse(rotation);
			headPosition = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(head.position);
			headRotation = val * head.rotation;
			Quaternion val2 = headRotation * inverseHeadRest;
			Quaternion val3 = Quaternion.Slerp(val * chest.rotation * inverseChestRest, val * pelvis.rotation * inversePelvisRest, 0.36f);
			Quaternion val4 = rotation * val3;
			bool flag = deltaTime > 0f;
			if (flag && (deltaTime > 0.16f || (hasHistory && Quaternion.Angle(previousWorldTorso, val4) > 80f)))
			{
				Reset();
			}
			float num = Mathf.Clamp(deltaTime, 0f, 0.05f);
			if (flag)
			{
				Vector3 val5 = val2 * Vector3.forward;
				float num2 = Mathf.Atan2(val5.x, val5.z) * 57.29578f;
				float num3 = (hasAimYaw ? Mathf.Clamp(Mathf.DeltaAngle(previousAimYaw, num2) / Mathf.Max(deltaTime, 0.001f), -720f, 720f) : 0f);
				previousAimYaw = num2;
				hasAimYaw = true;
				float num4 = num2 + Mathf.Min(0f, num3) * 0.1f;
				float num5 = ((weaponVisible && anticipateHeadTurn) ? Mathf.SmoothStep(0f, 1f, (0f - num4 - 5f) / 25f) : 0f);
				naturalRoute = ((num5 >= naturalRoute) ? num5 : Mathf.MoveTowards(naturalRoute, num5, 3f * num));
			}
			if (!hasHistory)
			{
				smoothedTorso = val3;
				if (flag)
				{
					previousWorldTorso = val4;
					hasHistory = true;
				}
			}
			else if (flag)
			{
				float num6 = 1f - Mathf.Exp(-13f * num);
				smoothedTorso = Quaternion.Slerp(smoothedTorso, val3, num6);
				Quaternion val6 = Quaternion.Inverse(previousWorldTorso) * val4;
				if (val6.w < 0f)
				{
					((Quaternion)(ref val6))..ctor(0f - val6.x, 0f - val6.y, 0f - val6.z, 0f - val6.w);
				}
				float num7 = 2f * Mathf.Atan2(val6.y, val6.w) * 57.29578f;
				yawLag = Mathf.Lerp(yawLag, Mathf.Clamp(num7 * (0.055f / num), -11f, 11f), num6);
				previousWorldTorso = val4;
			}
			Quaternion val7 = Quaternion.Slerp(val3, smoothedTorso, 0.28f);
			float num8 = 1f - Mathf.Exp(-10f * num);
			if (!flag)
			{
				Array.Copy(correction, pausedCorrection, 12);
			}
			for (int i = 0; i < anchorBones.Length; i++)
			{
				anchorMatrices[i] = worldToLocalMatrix * anchorBones[i].localToWorldMatrix;
			}
			UpdateCapsules(worldToLocalMatrix, weaponVisible, flag);
			for (int j = 0; j < 2; j++)
			{
				int num9 = j * 6;
				Quaternion val8 = headRotation;
				Quaternion val9 = headRotation;
				for (int k = 0; k < 6; k++)
				{
					int num10 = num9 + k;
					float num11 = (float)k / 5f;
					float num12 = Mathf.Lerp((j == 0) ? 12f : 15f, (j == 0) ? 31f : 36f, num11);
					float num13 = Mathf.Lerp(5f, 20f, num11) * ((j == 0) ? (-1f) : 1f);
					Quaternion val10 = Quaternion.AngleAxis((0f - yawLag) * num11, Vector3.up) * Quaternion.AngleAxis(num12, Vector3.right) * Quaternion.AngleAxis(num13 - yawLag * num11 * 0.3f, Vector3.forward);
					Quaternion val11 = Quaternion.Slerp(val2, val7, TorsoFollow[k]) * val10 * neutral[num10];
					Quaternion val12 = val11;
					if (j == 1 && k >= 3)
					{
						Quaternion val13 = Quaternion.Slerp(val2, val7, TorsoFollow[k]);
						Quaternion val14 = Quaternion.AngleAxis((0f - yawLag) * num11, Vector3.up) * Quaternion.AngleAxis(num12 - 6f, Vector3.right) * Quaternion.AngleAxis(num13 - yawLag * num11 * 0.3f, Vector3.forward);
						val12 = val13 * val14 * neutral[num10];
						lowerRightBase[k - 3] = Quaternion.Inverse(val9) * val12;
					}
					val9 = val12;
					baseLocal[num10] = Quaternion.Inverse(val8) * val11;
					correction[num10] = Quaternion.Slerp(correction[num10], Quaternion.identity, num8);
					val8 = val11;
				}
				ForwardKinematics(j, num9);
			}
			for (int l = 0; l < 2; l++)
			{
				Vector3 rearBias = val7 * (Vector3.back + ((l == 0) ? Vector3.left : Vector3.right) * 0.45f);
				SolvePanel(l, rearBias);
			}
			Array.Copy(lowerRightBase, 0, baseLocal, 9, lowerRightBase.Length);
			PublishPose(deltaTime, root.position, val3, val4);
			if (!flag)
			{
				Array.Copy(pausedCorrection, correction, 12);
			}
		}

		private void PublishPose(float dt, Vector3 rootPosition, Quaternion torso, Quaternion worldTorso)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_002d: 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_008d: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: 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)
			//IL_01c0: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			bool flag = !hasDisplayInputs;
			if (dt > 0f)
			{
				if (!flag && SamePosition(rootPosition, displayRootPosition) && SamePosition(headPosition, displayHeadPosition) && SameRotation(headRotation, displayHeadRotation) && SameRotation(torso, displayTorso) && SameRotation(worldTorso, displayWorldTorso) && SameCapsules())
				{
					stillTime += dt;
				}
				else
				{
					hasDisplayInputs = true;
					displayRootPosition = rootPosition;
					displayHeadPosition = headPosition;
					displayHeadRotation = headRotation;
					displayTorso = torso;
					displayWorldTorso = worldTorso;
					displayCapsuleCount = capsuleCount;
					Array.Copy(capsules, displayCapsules, capsuleCount);
					stillTime = 0f;
					displaySleeping = false;
				}
			}
			bool flag2 = !displaySleeping && stillTime >= 0.5f;
			float num = Mathf.Clamp(dt, 0f, 0.05f);
			float response = ((num > 0f) ? ((1f - Mathf.Exp(-10f * num)) / num) : 0f);
			for (int i = 0; i < 12; i++)
			{
				if (displaySleeping)
				{
					joints[i].localRotation = heldRotations[i];
					continue;
				}
				Quaternion val;
				if (flag)
				{
					val = correction[i];
					if ((i == 7 || i == 8) && naturalRoute > 0f)
					{
						Vector3 val2 = DisplayTarget(i);
						val = ((((Vector3)(ref val2)).sqrMagnitude > 1E-10f) ? Quaternion.AngleAxis(((Vector3)(ref val2)).magnitude, val2) : Quaternion.identity);
					}
					displayAngles[i] = RotationVector(val);
					displayVelocities[i] = Vector3.zero;
				}
				else
				{
					if (num > 0f)
					{
						AdvanceDisplayCorrection(i, num, response);
					}
					Vector3 val3 = displayAngles[i];
					val = ((((Vector3)(ref val3)).sqrMagnitude > 1E-10f) ? Quaternion.AngleAxis(((Vector3)(ref val3)).magnitude, val3) : Quaternion.identity);
				}
				Quaternion val4 = baseLocal[i] * val;
				joints[i].localRotation = val4;
				if (flag2)
				{
					heldRotations[i] = val4;
					displayVelocities[i] = Vector3.zero;
				}
			}
			if (flag2)
			{
				displaySleeping = true;
			}
		}

		private void AdvanceDisplayCorrection(int joint, float dt, float response)
		{
			//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)
			//IL_005e: 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_0071: 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_007e: 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_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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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)
			//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_00b7: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			int num = joint % 6;
			Vector3 val = displayAngles[joint];
			Vector3 val2 = DisplayTarget(joint);
			if ((joint == 7 || joint == 8) && naturalRoute > 0f)
			{
				response = Mathf.Lerp(response, (1f - Mathf.Exp(-20f * dt)) / dt, naturalRoute);
			}
			float num2 = 1f + 0.18f * (float)num;
			Vector3 val3 = Vector3.ClampMagnitude((val2 - val) * response, 130f * num2);
			Vector3 val4 = Vector3.MoveTowards(displayVelocities[joint], val3, 1400f * num2 * dt);
			Vector3 val5 = Vector3.ClampMagnitude(val + val4 * dt, CorrectionLimit[num]);
			displayAngles[joint] = val5;
			displayVelocities[joint] = (val5 - val) / dt;
		}

		private Vector3 DisplayTarget(int joint)
		{
			//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_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_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_003e: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = RotationVector(correction[joint]);
			return (Vector3)(joint switch
			{
				7 => Vector3.Lerp(val, NaturalSecond, naturalRoute), 
				8 => Vector3.Lerp(val, NaturalThird, naturalRoute), 
				_ => val, 
			});
		}

		private static Vector3 RotationVector(Quaternion rotation)
		{
			//IL_0002: 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_000e: 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)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(rotation.x, rotation.y, rotation.z);
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude < 1E-08f)
			{
				return Vector3.zero;
			}
			if (rotation.w < 0f)
			{
				val = -val;
			}
			float num = 2f * Mathf.Atan2(magnitude, Mathf.Abs(rotation.w)) * 57.29578f;
			return val * (num / magnitude);
		}

		private bool SameCapsules()
		{
			//IL_0032: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			if (capsuleCount != displayCapsuleCount)
			{
				return false;
			}
			for (int i = 0; i < capsuleCount; i++)
			{
				Capsule capsule = capsules[i];
				Capsule capsule2 = displayCapsules[i];
				if (!SamePosition(capsule.Start, capsule2.Start) || !SamePosition(capsule.End, capsule2.End) || !SamePosition(capsule.WidthAxis, capsule2.WidthAxis) || Mathf.Abs(capsule.Radius - capsule2.Radius) > 1E-05f || Mathf.Abs(capsule.WidthStart - capsule2.WidthStart) > 1E-05f || Mathf.Abs(capsule.WidthEnd - capsule2.WidthEnd) > 1E-05f)
				{
					return false;
				}
			}
			return true;
		}

		private static bool SamePosition(Vector3 current, Vector3 previous)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = current - previous;
			return ((Vector3)(ref val)).sqrMagnitude <= 9.9999994E-11f;
		}

		private static bool SameRotation(Quaternion current, Quaternion previous)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0058: 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)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Quaternion.Dot(current, previous) < 0f) ? (-1f) : 1f);
			if (Mathf.Abs(current.x - num * previous.x) <= 1E-05f && Mathf.Abs(current.y - num * previous.y) <= 1E-05f && Mathf.Abs(current.z - num * previous.z) <= 1E-05f)
			{
				return Mathf.Abs(current.w - num * previous.w) <= 1E-05f;
			}
			return false;
		}

		private void UpdateCapsules(Matrix4x4 worldToRoot, bool weaponVisible, bool advance)
		{
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0066: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_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_0123: 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_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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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_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_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: 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)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: 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_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: 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_0232: 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_0244: 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_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			capsuleCount = 0;
			sweptCount = 0;
			Vector3 widthAxis;
			for (int i = 0; i < 2; i++)
			{
				int num = i * 5;
				Vector3 val = ((Matrix4x4)(ref worldToRoot)).MultiplyPoint3x4(arms[num].position);
				for (int j = 0; j < ArmRadius.Length; j++)
				{
					Vector3 val2 = ((Matrix4x4)(ref worldToRoot)).MultiplyPoint3x4(arms[num + j + 1].position);
					Capsule[] array = capsules;
					int num2 = capsuleCount++;
					Vector3 start = val;
					float radius = ArmRadius[j];
					widthAxis = default(Vector3);
					array[num2] = new Capsule(start, val2, radius, widthAxis);
					val = val2;
				}
			}
			float scale;
			if (weaponVisible && weapon.Length == weaponPoints.Length)
			{
				for (int k = 0; k < weapon.Length; k++)
				{
					weaponPoints[k] = ((Matrix4x4)(ref worldToRoot)).MultiplyPoint3x4(weapon[k].position);
				}
				Vector3 widthAxis2 = ((Matrix4x4)(ref worldToRoot)).MultiplyVector(weapon[0].TransformVector(Vector3.up));
				Vector3 widthAxis3 = ((Matrix4x4)(ref worldToRoot)).MultiplyVector(weapon[6].TransformVector(Vector3.forward));
				scale = ((Vector3)(ref widthAxis2)).magnitude;
				Vector3 a = ((Matrix4x4)(ref worldToRoot)).MultiplyPoint3x4(weapon[0].TransformPoint(Vector3.left * 0.29f));
				Vector3 b = ((Matrix4x4)(ref worldToRoot)).MultiplyPoint3x4(weapon[6].TransformPoint(Vector3.left * 0.19f));
				AddWeapon(a, weaponPoints[0], 0.054f, widthAxis2, 0.065f, 0.095f);
				AddWeapon(weaponPoints[0], weaponPoints[1], 0.063f, widthAxis2, 0.13f, 0.17f);
				AddWeapon(weaponPoints[1], weaponPoints[2], 0.077f, widthAxis2, 0.17f, 0.115f);
				for (int l = 2; l <= 4; l++)
				{
					Vector3 a2 = weaponPoints[l];
					Vector3 b2 = weaponPoints[l + 1];
					widthAxis = default(Vector3);
					AddWeapon(a2, b2, 0.073f, widthAxis);
				}
				AddWeapon(weaponPoints[5], weaponPoints[6], 0.066f, widthAxis3, 0.065f, 0.115f);
				AddWeapon(weaponPoints[6], b, 0.064f, widthAxis3, 0.115f, 0.025f);
			}
			if (!advance)
			{
				return;
			}
			for (int m = 0; m < Mathf.Min(previousCount, capsuleCount); m++)
			{
				Capsule capsule = previousCapsules[m];
				Capsule capsule2 = capsules[m];
				widthAxis = capsule2.Start - capsule.Start;
				float sqrMagnitude = ((Vector3)(ref widthAxis)).sqrMagnitude;
				widthAxis = capsule2.End - capsule.End;
				float num3 = Mathf.Max(sqrMagnitude, ((Vector3)(ref widthAxis)).sqrMagnitude);
				if (!(num3 < 0.0036f) && !(num3 > 0.81f))
				{
					swept[sweptCount++] = new Capsule(Vector3.Lerp(capsule.Start, capsule2.Start, 0.5f), Vector3.Lerp(capsule.End, capsule2.End, 0.5f), capsule2.Radius * 0.85f, capsule2.WidthAxis, capsule2.WidthStart, capsule2.WidthEnd);
				}
			}
			Array.Copy(capsules, previousCapsules, capsuleCount);
			previousCount = capsuleCount;
			void AddWeapon(Vector3 start2, Vector3 end, float num4, Vector3 val3 = default(Vector3), float widthStart = 0f, float widthEnd = 0f)
			{
				//IL_0017: 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_002a: Unknown result type (might be due to invalid IL or missing references)
				capsules[capsuleCount++] = new Capsule(start2, end, num4 * scale + 0.012f, ((Vector3)(ref val3)).normalized, widthStart * scale, widthEnd * scale);
			}
		}

		private void ForwardKinematics(int side, int first)
		{
			//IL_0019: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_0098: 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)
			//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)
			int num = side * 6;
			Vector3 val = ((first == num) ? headPosition : positions[first - 1]);
			Quaternion val2 = ((first == num) ? headRotation : rotations[first - 1]);
			for (int i = first; i < num + 6; i++)
			{
				positions[i] = val + val2 * offsets[i];
				rotations[i] = val2 * baseLocal[i] * correction[i];
				val = positions[i];
				val2 = rotations[i];
			}
		}

		private void SolvePanel(int side, Vector3 rearBias)
		{
			//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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			int start = side * 6;
			for (int i = 0; i < 3; i++)
			{
				Contact hit;
				float num = MeasurePanel(side, out hit);
				if (hit.Priority <= 0.0015f)
				{
					break;
				}
				int num2 = hit.Joint;
				if (num2 > start)
				{
					Vector3 val = hit.Position - positions[num2];
					if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
					{
						num2--;
					}
				}
				Vector3 away = ((((Vector3)(ref hit.Separation)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref hit.Separation)).normalized : rearBias);
				int bestJoint = num2;
				Quaternion best = correction[num2];
				float bestScore = num;
				EvaluateJoint(num2);
				if (num2 > start && (bestScore == num || (hit.Depth > 0.025f && num2 - start <= 3)))
				{
					EvaluateJoint(num2 - 1);
				}
				if (bestScore == num)
				{
					break;
				}
				correction[bestJoint] = best;
				ForwardKinematics(side, bestJoint);
				void EvaluateJoint(int index)
				{
					//IL_0010: 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_003e: 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)
					//IL_0056: 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_0060: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ab: 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_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_00d1: 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_0104: 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)
					Vector3 lever = hit.Position - positions[index];
					Quaternion saved = correction[index];
					Quaternion inverse = Quaternion.Inverse(rotations[index]);
					float num3 = Mathf.Clamp((hit.Depth + 0.012f) / Mathf.Max(0.06f, ((Vector3)(ref lever)).magnitude) * 57.29578f * 1.45f, 5f, 21f);
					Evaluate(away + rearBias * 0.45f, num3);
					Evaluate(rearBias, num3);
					Evaluate(away, num3 * 0.6f);
					correction[index] = saved;
					ForwardKinematics(side, index);
					void Evaluate(Vector3 direction, float degrees)
					{
						//IL_0002: 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_000d: 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_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_0031: Unknown result type (might be due to invalid IL or missing references)
						//IL_0036: 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_004b: 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_0051: Unknown result type (might be due to invalid IL or missing references)
						//IL_006a: 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_00cc: 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)
						Vector3 val2 = Vector3.Cross(lever, direction);
						if (!(((Vector3)(ref val2)).sqrMagnitude < 1E-06f))
						{
							Quaternion val3 = Quaternion.AngleAxis(degrees, inverse * ((Vector3)(ref val2)).normalized);
							correction[index] = Quaternion.RotateTowards(Quaternion.identity, saved * val3, CorrectionLimit[index - start]);
							ForwardKinematics(side, index);
							Contact hit2;
							float num4 = MeasurePanel(side, out hit2);
							if (!(num4 + 1E-06f >= bestScore))
							{
								bestScore = num4;
								bestJoint = index;
								best = correction[index];
							}
						}
					}
				}
			}
		}

		private float MeasurePanel(int side, out Contact hit)
		{
			Contact strongest = default(Contact);
			float score = 0f;
			MeasureSamples(samples[side], 1f, ownsJoint: true);
			MeasureSamples(coupledSamples[side], 0.65f, ownsJoint: false);
			hit = strongest;
			return score;
			void MeasureSamples(Sample[] points, float panelWeight, bool ownsJoint)
			{
				//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_007d: 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_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_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_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: 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_00be: Unknown result type (might be due to invalid IL or missing references)
				for (int i = 0; i < points.Length; i++)
				{
					Sample sample = points[i];
					Vector3 point = Vector3.zero;
					Influence[] influences = sample.Influences;
					for (int j = 0; j < influences.Length; j++)
					{
						Influence influence = influences[j];
						int joint = influence.Joint;
						Vector3 val = ((joint >= 0) ? (positions[joint] + rotations[joint] * influence.Offset) : ((Matrix4x4)(ref anchorMatrices[~joint])).MultiplyPoint3x4(influence.Offset));
						point += val * influence.Weight;
					}
					Measure(capsules, capsuleCount, panelWeight);
					Measure(swept, sweptCount, panelWeight * 0.3f);
					void Measure(Capsule[] group, int count, float weight)
					{
						//IL_0010: 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)
						//IL_0071: Unknown result type (might be due to invalid IL or missing references)
						//IL_0078: Unknown result type (might be due to invalid IL or missing references)
						//IL_0079: Unknown result type (might be due to invalid IL or missing references)
						for (int k = 0; k < count; k++)
						{
							Vector3 separation;
							float num = group[k].Penetration(point, out separation);
							float num2 = num * weight;
							score += num * num2;
							if (ownsJoint && !(num2 <= strongest.Priority))
							{
								strongest = new Contact
								{
									Joint = sample.Joint,
									Position = point,
									Separation = separation,
									Depth = num,
									Priority = num2
								};
							}
						}
					}
				}
			}
		}

		private static Sample[][] ReadSamples(Mesh mesh, int submesh, Transform[] skinBones, Transform[] joints, out Transform[] anchors)
		{
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: 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_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			List<int>[] array = new List<int>[12];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new List<int>();
			}
			Vector3[] vertices = mesh.vertices;
			BoneWeight[] boneWeights = mesh.boneWeights;
			Matrix4x4[] binds = mesh.bindposes;
			bool[] array2 = new bool[vertices.Length];
			int[] slots = new int[skinBones.Length];
			List<Transform> anchorList = new List<Transform>();
			Dictionary<int, int> anchorSlots = new Dictionary<int, int>();
			for (int j = 0; j < slots.Length; j++)
			{
				slots[j] = Array.IndexOf(joints, skinBones[j]);
			}
			int[] triangles = mesh.GetTriangles(submesh);
			foreach (int num in triangles)
			{
				if (!array2[num])
				{
					array2[num] = true;
					int num2 = slots[((BoneWeight)(ref boneWeights[num])).boneIndex0];
					if (num2 >= 0)
					{
						array[num2].Add(num);
					}
				}
			}
			List<Sample>[] array3 = new List<Sample>[2]
			{
				new List<Sample>(),
				new List<Sample>()
			};
			for (int l = 0; l < array.Length; l++)
			{
				List<int> list = array[l];
				if (list.Count == 0)
				{
					continue;
				}
				float[] array4 = new float[list.Count];
				int num3 = 0;
				for (int m = 0; m < list.Count; m++)
				{
					array4[m] = float.PositiveInfinity;
					if (vertices[list[m]].z > vertices[list[num3]].z)
					{
						num3 = m;
					}
				}
				int num4 = Mathf.Min(list.Count, SamplesPerJoint[l % 6]);
				for (int n = 0; n < num4; n++)
				{
					Vector3 vertex = vertices[list[num3]];
					BoneWeight val = boneWeights[list[num3]];
					List<Influence> influences = new List<Influence>(4);
					Add(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0);
					Add(((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1);
					Add(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2);
					Add(((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3);
					array3[l / 6].Add(new Sample(l, influences.ToArray()));
					int num5 = num3;
					for (int num6 = 0; num6 < list.Count; num6++)
					{
						int num7 = num6;
						float num8 = array4[num6];
						Vector3 val2 = vertices[list[num6]] - vertex;
						array4[num7] = Mathf.Min(num8, ((Vector3)(ref val2)).sqrMagnitude);
						if (array4[num6] > array4[num5])
						{
							num5 = num6;
						}
					}
					if (array4[num5] < 4E-06f)
					{
						break;
					}
					num3 = num5;
					void Add(int index, float weight)
					{
						//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)
						if (!(weight <= 0f))
						{
							int num9 = slots[index];
							if (num9 < 0)
							{
								if (!anchorSlots.TryGetValue(index, out var value))
								{
									value = anchorList.Count;
									anchorList.Add(skinBones[index]);
									anchorSlots.Add(index, value);
								}
								num9 = ~value;
							}
							influences.Add(new Influence(num9, ((Matrix4x4)(ref binds[index])).MultiplyPoint3x4(vertex), weight));
						}
					}
				}
			}
			anchors = anchorList.ToArray();
			return new Sample[2][]
			{
				array3[0].ToArray(),
				array3[1].ToArray()
			};
		}
	}
	internal sealed class NanachiCapeContact : IDisposable
	{
		private struct Sample
		{
			internal readonly int Vertex;

			internal readonly int Side;

			internal readonly int Cell;

			internal readonly Vector2 BindXY;

			internal Vector3 Position;

			internal int Capsule;

			internal float Depth;

			internal float BodyDepth;

			internal Sample(int vertex, Vector3 position)
			{
				//IL_0008: 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_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: 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)
				//IL_0071: 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)
				Vertex = vertex;
				Side = ((!(position.x < 0f)) ? 1 : 0);
				Cell = Mathf.Clamp((int)((Mathf.Abs(position.x) - 0.045f) / 0.13f), 0, 1) + 2 * Mathf.Clamp((int)((position.y - 0.48f) / 0.105f), 0, 2);
				BindXY = new Vector2(position.x, position.y);
				Position = default(Vector3);
				Capsule = 0;
				Depth = (BodyDepth = 0f);
			}
		}

		private readonly struct Control
		{
			internal readonly Vector2 Position;

			internal readonly float Strength;

			internal Control(Vector2 position, float strength)
			{
				//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)
				Position = position;
				Strength = strength;
			}
		}

		private readonly struct BodySegment
		{
			internal readonly Transform Start;

			internal readonly Transform End;

			internal readonly float Radius;

			internal BodySegment(Transform start, Transform end, float radius)
			{
				Start = start;
				End = end;
				Radius = radius;
			}
		}

		private sealed class SurfaceShading
		{
			private readonly struct Stencil
			{
				internal readonly int Group;

				internal readonly int Center;

				internal readonly Term[] Terms;

				internal Stencil(int group, int center, Term[] terms)
				{
					Group = group;
					Center = center;
					Terms = terms;
				}
			}

			private readonly struct Term
			{
				internal readonly int Vertex;

				internal readonly float X;

				internal readonly float Y;

				internal Term(int vertex, float x, float y)
				{
					Vertex = vertex;
					X = x;
					Y = y;
				}
			}

			private readonly Vector3[] offsets;

			private readonly int[] movable;

			private readonly Vector3[] restNormals;

			private readonly Vector4[] restTangents;

			private readonly Vector3[] normals;

			private readonly Vector4[] tangents;

			private readonly int[] groupByVertex;

			private readonly Stencil[] stencils;

			private readonly Vector3[] dx;

			private readonly Vector3[] dy;

			internal SurfaceShading(Mesh mesh, Vector3[] points, Vector3[] offsets, int[] movable)
			{
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_0243: Unknown result type (might be due to invalid IL or missing references)
				//IL_0248: 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_0271: Unknown result type (might be due to invalid IL or missing references)
				//IL_0279: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Unknown result type (might be due to invalid IL or missing references)
				//IL_0290: Unknown result type (might be due to invalid IL or missing references)
				//IL_029f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_032e: Unknown result type (might be due to invalid IL or missing references)
				//IL_033d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0350: Unknown result type (might be due to invalid IL or missing references)
				//IL_035f: Unknown result type (might be due to invalid IL or missing references)
				SurfaceShading surfaceShading = this;
				this.offsets = offsets;
				this.movable = movable;
				restNormals = mesh.normals;
				restTangents = mesh.tangents;
				normals = (Vector3[])restNormals.Clone();
				tangents = (Vector4[])restTangents.Clone();
				groupByVertex = new int[points.Length];
				Array.Fill(groupByVertex, -1);
				Dictionary<Vector2Int, int> lookup = new Dictionary<Vector2Int, int>();
				List<int> representatives = new List<int>();
				List<HashSet<int>> neighbors = new List<HashSet<int>>();
				int[] triangles = mesh.GetTriangles(1);
				Vector2[] uv = mesh.uv;
				for (int i = 0; i < triangles.Length; i += 3)
				{
					int num = triangles[i];
					int num2 = triangles[i + 1];
					int num3 = triangles[i + 2];
					if (!(uv[num].y > 0.5615f) && !(uv[num2].y > 0.5615f) && !(uv[num3].y > 0.5615f))
					{
						num = Group(num);
						num2 = Group(num2);
						num3 = Group(num3);
						Connect(num, num2);
						Connect(num2, num3);
						Connect(num3, num);
					}
				}
				bool[] array = new bool[representatives.Count];
				foreach (int num4 in movable)
				{
					if (groupByVertex[num4] >= 0)
					{
						array[groupByVertex[num4]] = true;
					}
				}
				List<Stencil> list = new List<Stencil>();
				for (int k = 0; k < array.Length; k++)
				{
					if (!array[k])
					{
						continue;
					}
					int num5 = representatives[k];
					List<(int, Vector2, float)> list2 = new List<(int, Vector2, float)>();
					float num6 = 0.025f;
					float num7 = 0f;
					float num8 = 0.025f;
					foreach (int item in neighbors[k])
					{
						int num9 = representatives[item];
						Vector2 val = Vector2.op_Implicit(points[num9] - points[num5]);
						float num10 = 1f / Mathf.Max(3.6E-05f, ((Vector2)(ref val)).sqrMagnitude);
						num6 += num10 * val.x * val.x;
						num7 += num10 * val.x * val.y;
						num8 += num10 * val.y * val.y;
						list2.Add((num9, val, num10));
					}
					float num11 = 1f / (num6 * num8 - num7 * num7);
					Term[] array2 = new Term[list2.Count];
					for (int l = 0; l < array2.Length; l++)
					{
						(int, Vector2, float) tuple = list2[l];
						float num12 = num11 * tuple.Item3;
						array2[l] = new Term(tuple.Item1, num12 * (num8 * tuple.Item2.x - num7 * tuple.Item2.y), num12 * (num6 * tuple.Item2.y - num7 * tuple.Item2.x));
					}
					list.Add(new Stencil(k, num5, array2));
				}
				stencils = list.ToArray();
				dx = (Vector3[])(object)new Vector3[array.Length];
				dy = (Vector3[])(object)new Vector3[array.Length];
				void Connect(int a, int b)
				{
					if (a != b)
					{
						neighbors[a].Add(b);
						neighbors[b].Add(a);
					}
				}
				int Group(int vertex)
				{
					//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_0023: Unknown result type (might be due to invalid IL or missing references)
					//IL_0034: 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_006c: Unknown result type (might be due to invalid IL or missing references)
					if (groupByVertex[vertex] >= 0)
					{
						return groupByVertex[vertex];
					}
					Vector3 val2 = points[vertex];
					Vector2Int key = default(Vector2Int);
					((Vector2Int)(ref key))..ctor(Mathf.RoundToInt(val2.x * 100000f), Mathf.RoundToInt(val2.y * 100000f));
					if (!lookup.TryGetValue(key, out var value))
					{
						value = representatives.Count;
						lookup.Add(key, value);
						representatives.Add(vertex);
						neighbors.Add(new HashSet<int>());
					}
					groupByVertex[vertex] = value;
					return value;
				}
			}

			internal void Upload(Mesh mesh)
			{
				//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_0028: 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_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: 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_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: 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_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: 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_007f: 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_008a: 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)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_0108: 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_0121: 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_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0190: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: 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_019c: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d8: 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_01e3: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: 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_0209: Unknown result type (might be due to invalid IL or missing references)
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Unknown result type (might be due to invalid IL or missing references)
				//IL_0219: Unknown result type (might be due to invalid IL or missing references)
				//IL_021b: 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_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: 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_0235: Unknown result type (might be due to invalid IL or missing references)
				//IL_023a: Unknown result type (might be due to invalid IL or missing references)
				//IL_023f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0246: Unknown result type (might be due to invalid IL or missing references)
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0250: 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_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0264: Unknown result t