Decompiled source of PEAK2011x v0.0.3

plugins/PEAK2011xStandalone/PEAK2011xStandalone.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using PEAKSkinCatalog;
using Photon.Pun;
using Photon.Voice;
using Photon.Voice.Unity;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 PEAK2011xStandalone
{
	public sealed class FirstPersonParts : IDisposable
	{
		private readonly SkinnedMeshRenderer body;

		private readonly SkinnedMeshRenderer head;

		private readonly SkinnedMeshRenderer extremities;

		public FirstPersonParts(GameObject model)
		{
			Transform val = model.transform.Find("2011x_Head");
			Transform val2 = model.transform.Find("__2011x_HandsAndFeet");
			if (Object.op_Implicit((Object)(object)val))
			{
				head = ((Component)val).GetComponent<SkinnedMeshRenderer>();
			}
			if (Object.op_Implicit((Object)(object)val2))
			{
				extremities = ((Component)val2).GetComponent<SkinnedMeshRenderer>();
			}
			SkinnedMeshRenderer[] componentsInChildren = model.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val3 in componentsInChildren)
			{
				if ((Object)(object)val3 != (Object)(object)head && (Object)(object)val3 != (Object)(object)extremities)
				{
					body = val3;
					break;
				}
			}
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)head) || !Object.op_Implicit((Object)(object)extremities))
			{
				throw new InvalidOperationException("Use the 0.2.3 AssetBundle: prebuilt body, head and hands/feet renderers required");
			}
		}

		public void SetFirstPerson(bool active)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				((Renderer)body).shadowCastingMode = (ShadowCastingMode)((!active) ? 1 : 3);
			}
			if (Object.op_Implicit((Object)(object)head))
			{
				((Renderer)head).shadowCastingMode = (ShadowCastingMode)((!active) ? 1 : 3);
			}
			if (Object.op_Implicit((Object)(object)extremities))
			{
				((Renderer)extremities).shadowCastingMode = (ShadowCastingMode)1;
			}
		}

		public void Dispose()
		{
			SetFirstPerson(active: false);
		}
	}
	public static class FitCalibration
	{
		public const float Scale = 1.150323f;

		public const float VerticalOffset = 0.000868697f;
	}
	internal static class GeneratedBoneMap
	{
		internal static BoneMap Create()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0093: 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_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_00ef: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: 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_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_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: 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_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: 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_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: 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_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0704: Unknown result type (might be due to invalid IL or missing references)
			//IL_0709: Unknown result type (might be due to invalid IL or missing references)
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_073d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0742: Unknown result type (might be due to invalid IL or missing references)
			//IL_0757: Unknown result type (might be due to invalid IL or missing references)
			//IL_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0795: Unknown result type (might be due to invalid IL or missing references)
			//IL_079a: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0826: Unknown result type (might be due to invalid IL or missing references)
			//IL_082b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0845: Unknown result type (might be due to invalid IL or missing references)
			//IL_084a: Unknown result type (might be due to invalid IL or missing references)
			//IL_085f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0864: Unknown result type (might be due to invalid IL or missing references)
			//IL_0879: Unknown result type (might be due to invalid IL or missing references)
			//IL_087e: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08db: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_090a: Unknown result type (might be due to invalid IL or missing references)
			//IL_090f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0948: Unknown result type (might be due to invalid IL or missing references)
			//IL_094d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0967: Unknown result type (might be due to invalid IL or missing references)
			//IL_096c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0981: Unknown result type (might be due to invalid IL or missing references)
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_099b: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09de: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a31: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ccd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0def: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e85: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f2b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f30: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1014: Unknown result type (might be due to invalid IL or missing references)
			//IL_1019: Unknown result type (might be due to invalid IL or missing references)
			//IL_1033: Unknown result type (might be due to invalid IL or missing references)
			//IL_1038: Unknown result type (might be due to invalid IL or missing references)
			//IL_104d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1052: Unknown result type (might be due to invalid IL or missing references)
			//IL_1067: Unknown result type (might be due to invalid IL or missing references)
			//IL_106c: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_10aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_10de: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1136: Unknown result type (might be due to invalid IL or missing references)
			//IL_113b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1155: Unknown result type (might be due to invalid IL or missing references)
			//IL_115a: Unknown result type (might be due to invalid IL or missing references)
			//IL_116f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1174: Unknown result type (might be due to invalid IL or missing references)
			//IL_1189: Unknown result type (might be due to invalid IL or missing references)
			//IL_118e: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_11eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1200: Unknown result type (might be due to invalid IL or missing references)
			//IL_1205: Unknown result type (might be due to invalid IL or missing references)
			//IL_121a: Unknown result type (might be due to invalid IL or missing references)
			//IL_121f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1258: Unknown result type (might be due to invalid IL or missing references)
			//IL_125d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1277: Unknown result type (might be due to invalid IL or missing references)
			//IL_127c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1291: Unknown result type (might be due to invalid IL or missing references)
			//IL_1296: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_12b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_12e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_1308: Unknown result type (might be due to invalid IL or missing references)
			//IL_130d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1322: Unknown result type (might be due to invalid IL or missing references)
			//IL_1327: Unknown result type (might be due to invalid IL or missing references)
			//IL_133c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1341: Unknown result type (might be due to invalid IL or missing references)
			//IL_137a: Unknown result type (might be due to invalid IL or missing references)
			//IL_137f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1399: Unknown result type (might be due to invalid IL or missing references)
			//IL_139e: Unknown result type (might be due to invalid IL or missing references)
			//IL_13b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_13b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_13cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_13d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_140b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1410: Unknown result type (might be due to invalid IL or missing references)
			//IL_142a: Unknown result type (might be due to invalid IL or missing references)
			//IL_142f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1444: Unknown result type (might be due to invalid IL or missing references)
			//IL_1449: Unknown result type (might be due to invalid IL or missing references)
			//IL_145e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1463: Unknown result type (might be due to invalid IL or missing references)
			//IL_149c: Unknown result type (might be due to invalid IL or missing references)
			//IL_14a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_14bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_14c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_14d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_14da: Unknown result type (might be due to invalid IL or missing references)
			//IL_14ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_14f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_152d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1532: Unknown result type (might be due to invalid IL or missing references)
			//IL_154c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1551: Unknown result type (might be due to invalid IL or missing references)
			//IL_1566: Unknown result type (might be due to invalid IL or missing references)
			//IL_156b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1580: Unknown result type (might be due to invalid IL or missing references)
			//IL_1585: Unknown result type (might be due to invalid IL or missing references)
			//IL_15be: Unknown result type (might be due to invalid IL or missing references)
			//IL_15c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_15dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_15e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_15fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1611: Unknown result type (might be due to invalid IL or missing references)
			//IL_1616: Unknown result type (might be due to invalid IL or missing references)
			//IL_164f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1654: Unknown result type (might be due to invalid IL or missing references)
			//IL_166e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1673: Unknown result type (might be due to invalid IL or missing references)
			//IL_1688: Unknown result type (might be due to invalid IL or missing references)
			//IL_168d: Unknown result type (might be due to invalid IL or missing references)
			//IL_16a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_16a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_16e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_16e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_16ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_1704: Unknown result type (might be due to invalid IL or missing references)
			//IL_1719: Unknown result type (might be due to invalid IL or missing references)
			//IL_171e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1733: Unknown result type (might be due to invalid IL or missing references)
			//IL_1738: Unknown result type (might be due to invalid IL or missing references)
			//IL_1771: Unknown result type (might be due to invalid IL or missing references)
			//IL_1776: Unknown result type (might be due to invalid IL or missing references)
			//IL_1790: Unknown result type (might be due to invalid IL or missing references)
			//IL_1795: Unknown result type (might be due to invalid IL or missing references)
			//IL_17aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_17af: Unknown result type (might be due to invalid IL or missing references)
			//IL_17c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_17c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1802: Unknown result type (might be due to invalid IL or missing references)
			//IL_1807: Unknown result type (might be due to invalid IL or missing references)
			//IL_1821: Unknown result type (might be due to invalid IL or missing references)
			//IL_1826: Unknown result type (might be due to invalid IL or missing references)
			//IL_183b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1840: Unknown result type (might be due to invalid IL or missing references)
			//IL_1855: Unknown result type (might be due to invalid IL or missing references)
			//IL_185a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1893: Unknown result type (might be due to invalid IL or missing references)
			//IL_1898: Unknown result type (might be due to invalid IL or missing references)
			//IL_18b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_18b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_18cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_18d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_18e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_18eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1924: Unknown result type (might be due to invalid IL or missing references)
			//IL_1929: Unknown result type (might be due to invalid IL or missing references)
			//IL_1943: Unknown result type (might be due to invalid IL or missing references)
			//IL_1948: Unknown result type (might be due to invalid IL or missing references)
			//IL_195d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1962: Unknown result type (might be due to invalid IL or missing references)
			//IL_1977: Unknown result type (might be due to invalid IL or missing references)
			//IL_197c: Unknown result type (might be due to invalid IL or missing references)
			//IL_19b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_19ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_19d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_19d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_19ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_19f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a08: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a46: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a65: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a84: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a99: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ad7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1adc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1af6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1afb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b10: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b15: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b68: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b87: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ba1: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ba6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bc0: Unknown result type (might be due to invalid IL or missing references)
			BoneMap boneMap = new BoneMap();
			boneMap.bones = new BoneSpec[49]
			{
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso",
					peakPath = "Scout/Armature/Hip",
					modelRotation = new Quaternion(-3.5762787E-07f, 0f, 0f, 1f),
					peakRotation = new Quaternion(0f, 1.4901161E-08f, 0f, 1f),
					modelPosition = new Vector3(0f, 0.7555384f, -0.049913347f),
					peakPosition = new Vector3(0f, 0.66578674f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso",
					modelRotation = new Quaternion(-3.5762787E-07f, 0f, 0f, 1f),
					peakRotation = new Quaternion(0f, 1.4901161E-08f, 0f, 1f),
					modelPosition = new Vector3(0f, 0.9073133f, -0.049913406f),
					peakPosition = new Vector3(0f, 1.1051483f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/LeftThigh",
					peakPath = "Scout/Armature/Hip/Hip_L/Leg_L",
					modelRotation = new Quaternion(5.0946977E-07f, 3.5762787E-07f, 1f, -4.371124E-08f),
					peakRotation = new Quaternion(2.4958706E-07f, -5.9135733E-08f, 0.99950475f, 0.031468213f),
					modelPosition = new Vector3(-0.059458688f, 0.75866663f, -0.049913347f),
					peakPosition = new Vector3(-0.1341629f, 0.75841904f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/RightThigh",
					peakPath = "Scout/Armature/Hip/Hip_R/Leg_R",
					modelRotation = new Quaternion(5.0946977E-07f, 3.5762787E-07f, 1f, -4.371124E-08f),
					peakRotation = new Quaternion(2.5332713E-07f, 4.689129E-10f, -0.99950475f, 0.031468213f),
					modelPosition = new Vector3(0.061207462f, 0.75866663f, -0.049913347f),
					peakPosition = new Vector3(0.1341629f, 0.75841904f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/Head",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/Head",
					modelRotation = new Quaternion(-3.5762787E-07f, 0f, 0f, 1f),
					peakRotation = new Quaternion(0.017122984f, -1.0429285E-07f, -2.2963746E-09f, 0.9998534f),
					modelPosition = new Vector3(0f, 1.1337544f, -0.049913526f),
					peakPosition = new Vector3(0f, 1.3201599f, -0.06933594f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L",
					modelRotation = new Quaternion(5.662441E-07f, -3.874302E-07f, 0.8163388f, 0.5775733f),
					peakRotation = new Quaternion(-0.0039334786f, -0.003933449f, 0.70709586f, 0.70709586f),
					modelPosition = new Vector3(0f, 1.1337544f, -0.10201275f),
					peakPosition = new Vector3(0f, 1.1862564f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/LeftThigh/LeftCalf",
					peakPath = "Scout/Armature/Hip/Hip_L/Leg_L/Knee_L",
					modelRotation = new Quaternion(5.094697E-07f, 3.5762787E-07f, 1f, 1.5184204E-07f),
					peakRotation = new Quaternion(-1.583814E-08f, -8.8996444E-08f, 0.9996204f, 0.027549982f),
					modelPosition = new Vector3(-0.05945875f, 0.5422546f, -0.049913168f),
					peakPosition = new Vector3(-0.15530205f, 0.4230156f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R",
					modelRotation = new Quaternion(5.662441E-07f, 3.874302E-07f, -0.8163388f, 0.5775733f),
					peakRotation = new Quaternion(-0.0039335f, 0.00393347f, -0.70709586f, 0.70709586f),
					modelPosition = new Vector3(0.007557649f, 1.1337544f, -0.10201275f),
					peakPosition = new Vector3(0f, 1.1862564f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/RightThigh/RightCalf",
					peakPath = "Scout/Armature/Hip/Hip_R/Leg_R/Knee_R",
					modelRotation = new Quaternion(5.094697E-07f, 3.5762787E-07f, 1f, 1.5184204E-07f),
					peakRotation = new Quaternion(-1.02388915E-08f, 4.1052672E-10f, -0.9996204f, 0.027549982f),
					modelPosition = new Vector3(0.0612074f, 0.54225475f, -0.049913168f),
					peakPosition = new Vector3(0.15530205f, 0.4230156f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L",
					modelRotation = new Quaternion(-2.0861626E-07f, 5.066395E-07f, 0.7071067f, 0.7071068f),
					peakRotation = new Quaternion(-1.926561E-08f, 4.0339035E-08f, 0.7071068f, 0.7071068f),
					modelPosition = new Vector3(-0.17204481f, 1.073033f, -0.10201275f),
					peakPosition = new Vector3(-0.26133728f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/LeftThigh/LeftCalf/LeftFoot",
					peakPath = "Scout/Armature/Hip/Hip_L/Leg_L/Knee_L/Foot_L",
					modelRotation = new Quaternion(5.673215E-07f, 0.38649836f, 0.9222901f, -7.521578E-09f),
					peakRotation = new Quaternion(0.0005917065f, -0.03499338f, 0.9988731f, 0.032053947f),
					modelPosition = new Vector3(-0.05945883f, 0.29042968f, -0.04991302f),
					peakPosition = new Vector3(-0.17473221f, 0.07078552f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R",
					modelRotation = new Quaternion(0.49999967f, 0.4999998f, -0.50000036f, 0.5000002f),
					peakRotation = new Quaternion(-4.0339035E-08f, -1.926561E-08f, -0.7071068f, 0.7071068f),
					modelPosition = new Vector3(0.17960246f, 1.0730329f, -0.10201275f),
					peakPosition = new Vector3(0.26133728f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/RightThigh/RightCalf/RightFoot",
					peakPath = "Scout/Armature/Hip/Hip_R/Leg_R/Knee_R/Foot_R",
					modelRotation = new Quaternion(5.673215E-07f, 0.38649836f, 0.9222901f, -7.521578E-09f),
					peakRotation = new Quaternion(0.00059170835f, 0.03499326f, -0.9988731f, 0.032053947f),
					modelPosition = new Vector3(0.06120732f, 0.2904298f, -0.04991302f),
					peakPosition = new Vector3(0.17473221f, 0.07078552f, -0.056102753f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L",
					modelRotation = new Quaternion(-2.682209E-07f, 5.066395E-07f, 0.7071067f, 0.70710695f),
					peakRotation = new Quaternion(-1.926561E-08f, 4.0339035E-08f, 0.7071068f, 0.7071068f),
					modelPosition = new Vector3(-0.37445042f, 1.073033f, -0.102012634f),
					peakPosition = new Vector3(-0.6554527f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/LeftThigh/LeftCalf/LeftFoot/LeftToe",
					peakPath = "Scout/Armature/Hip/Hip_L/Leg_L/Knee_L/Foot_L/S_Toe_1_L",
					modelRotation = new Quaternion(7.3750573E-07f, 0.5900698f, 0.8073522f, 3.8150148E-08f),
					peakRotation = new Quaternion(5.6795084E-08f, 0.70710665f, 0.70710677f, 6.552399E-08f),
					modelPosition = new Vector3(-0.059458707f, 0.1015612f, 0.1421038f),
					peakPosition = new Vector3(-0.17650604f, 0.04322815f, -0.058036804f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R",
					modelRotation = new Quaternion(0.49999958f, 0.49999988f, -0.50000036f, 0.5000003f),
					peakRotation = new Quaternion(-4.0339035E-08f, -1.926561E-08f, -0.7071068f, 0.7071068f),
					modelPosition = new Vector3(0.38200805f, 1.073033f, -0.10201275f),
					peakPosition = new Vector3(0.6554527f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/RightThigh/RightCalf/RightFoot/RightToe",
					peakPath = "Scout/Armature/Hip/Hip_R/Leg_R/Knee_R/Foot_R/S_Toe_1_R",
					modelRotation = new Quaternion(7.375053E-07f, 0.59007037f, 0.8073518f, 3.8150432E-08f),
					peakRotation = new Quaternion(6.552398E-08f, -0.7071068f, -0.7071067f, 5.679509E-08f),
					modelPosition = new Vector3(0.06120744f, 0.10156138f, 0.14210375f),
					peakPosition = new Vector3(0.17650604f, 0.04322815f, -0.058036804f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L",
					modelRotation = new Quaternion(-2.682209E-07f, 5.066395E-07f, 0.7071067f, 0.70710695f),
					peakRotation = new Quaternion(-1.926561E-08f, 4.0339035E-08f, 0.7071068f, 0.7071068f),
					modelPosition = new Vector3(-0.64010763f, 1.073033f, -0.102012515f),
					peakPosition = new Vector3(-0.86626625f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R",
					modelRotation = new Quaternion(0.49999958f, 0.49999988f, -0.50000036f, 0.5000003f),
					peakRotation = new Quaternion(-4.0339035E-08f, -1.926561E-08f, -0.7071068f, 0.7071068f),
					modelPosition = new Vector3(0.6476653f, 1.073033f, -0.10201287f),
					peakPosition = new Vector3(0.86626625f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftIndex1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Index_1_L",
					modelRotation = new Quaternion(-0.0012294054f, -0.0012792051f, 0.7072407f, 0.7069708f),
					peakRotation = new Quaternion(0.4769166f, 0.08450187f, 0.52206373f, 0.70203966f),
					modelPosition = new Vector3(-0.9118343f, 1.073033f, -0.022746086f),
					peakPosition = new Vector3(-0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftMiddle1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Middle_1_L",
					modelRotation = new Quaternion(-0.007098466f, -0.0073588192f, 0.72625685f, 0.6873474f),
					peakRotation = new Quaternion(0.05693249f, 0.013481389f, 0.70481116f, 0.7069782f),
					modelPosition = new Vector3(-0.9222415f, 1.073033f, -0.0772059f),
					peakPosition = new Vector3(-0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftRing1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Middle_1_L",
					modelRotation = new Quaternion(-0.029455781f, -0.029208183f, 0.71633804f, 0.6965194f),
					peakRotation = new Quaternion(0.05693249f, 0.013481389f, 0.70481116f, 0.7069782f),
					modelPosition = new Vector3(-0.9204028f, 1.073033f, -0.12493372f),
					peakPosition = new Vector3(-0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftPinkie1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Pinky_1_L",
					modelRotation = new Quaternion(-0.07485312f, -0.07680836f, 0.6902987f, 0.71553135f),
					peakRotation = new Quaternion(-0.45150387f, -0.076705776f, 0.54419136f, 0.702934f),
					modelPosition = new Vector3(-0.90190125f, 1.073033f, -0.16581142f),
					peakPosition = new Vector3(-0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftThumb1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Thumb_1_L",
					modelRotation = new Quaternion(0.62797487f, 0.29012758f, 0.65419173f, 0.3057889f),
					peakRotation = new Quaternion(0.108927004f, 0.33870578f, 0.8896896f, 0.28612196f),
					modelPosition = new Vector3(-0.7606007f, 1.0730329f, -0.08264446f),
					peakPosition = new Vector3(-0.9024315f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightIndex1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Index_1_R",
					modelRotation = new Quaternion(0.708464f, 0.705109f, 0.021144897f, 0.021282703f),
					peakRotation = new Quaternion(0.4769166f, -0.084501855f, -0.52206373f, 0.70203966f),
					modelPosition = new Vector3(0.9046886f, 1.0730331f, -0.022746682f),
					peakPosition = new Vector3(0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightMiddle1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Middle_1_R",
					modelRotation = new Quaternion(0.73174167f, 0.681546f, -0.004775554f, -0.005138308f),
					peakRotation = new Quaternion(0.056932468f, -0.013481368f, -0.70481116f, 0.7069782f),
					modelPosition = new Vector3(0.91509557f, 1.0730331f, -0.07720649f),
					peakPosition = new Vector3(0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightRing1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Middle_1_R",
					modelRotation = new Quaternion(0.7203088f, 0.6932588f, -0.017070115f, -0.016006052f),
					peakRotation = new Quaternion(0.056932468f, -0.013481368f, -0.70481116f, 0.7069782f),
					modelPosition = new Vector3(0.9132569f, 1.0730331f, -0.1249342f),
					peakPosition = new Vector3(0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightPinkie1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Pinky_1_R",
					modelRotation = new Quaternion(0.70009255f, 0.70945257f, -0.056840837f, -0.057589978f),
					peakRotation = new Quaternion(-0.45150387f, 0.07670579f, -0.54419136f, 0.702934f),
					modelPosition = new Vector3(0.8947554f, 1.0730331f, -0.16581202f),
					peakPosition = new Vector3(0.92889977f, 1.2456627f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightThumb1",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Thumb_R_1",
					modelRotation = new Quaternion(0.6387411f, 0.31274796f, 0.6436841f, 0.2826121f),
					peakRotation = new Quaternion(0.108926974f, -0.33870578f, -0.8896896f, 0.28612196f),
					modelPosition = new Vector3(0.7534548f, 1.0730331f, -0.08264494f),
					peakPosition = new Vector3(0.9024315f, 1.1862564f, -0.059013367f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftIndex1/LeftIndex2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Index_1_L/Index_2_L",
					modelRotation = new Quaternion(0.019577116f, 0.016225636f, 0.77075756f, 0.63662106f),
					peakRotation = new Quaternion(0.21585913f, -0.2158591f, 0.6733535f, 0.6733535f),
					modelPosition = new Vector3(-0.9886748f, 1.0730036f, -0.023018718f),
					peakPosition = new Vector3(-0.9871292f, 1.2456627f, 0.008628845f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftMiddle1/LeftMiddle2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Middle_1_L/Middle_2_L",
					modelRotation = new Quaternion(0.00027826428f, 0.00023159385f, 0.7710832f, 0.6367345f),
					peakRotation = new Quaternion(0.021752547f, -0.021752555f, 0.7067722f, 0.7067721f),
					modelPosition = new Vector3(-1.0081351f, 1.0683007f, -0.07896519f),
					peakPosition = new Vector3(-0.9818363f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftRing1/LeftRing2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Middle_1_L/Middle_2_L",
					modelRotation = new Quaternion(-0.024139494f, -0.020005673f, 0.7705896f, 0.6365601f),
					peakRotation = new Quaternion(0.021752547f, -0.021752555f, 0.7067722f, 0.7067721f),
					modelPosition = new Vector3(-1.0084571f, 1.0705565f, -0.1322596f),
					peakPosition = new Vector3(-0.9818363f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftPinkie1/LeftPinkie2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Pinky_1_L/Pinky_2_L",
					modelRotation = new Quaternion(-0.083428234f, -0.069423795f, 0.7651514f, 0.6346364f),
					peakRotation = new Quaternion(-0.20351447f, 0.20351474f, 0.67718667f, 0.67718667f),
					modelPosition = new Vector3(-0.9836001f, 1.0760258f, -0.18364811f),
					peakPosition = new Vector3(-0.9836006f, 1.2456627f, -0.115478516f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftThumb1/LeftThumb2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Thumb_1_L/Thumb_2_L",
					modelRotation = new Quaternion(0.61842394f, 0.04299298f, 0.72131705f, 0.3088774f),
					peakRotation = new Quaternion(-0.03469475f, 0.23054715f, 0.75536966f, 0.61242235f),
					modelPosition = new Vector3(-0.7626392f, 1.0362223f, -0.039037704f),
					peakPosition = new Vector3(-0.94125175f, 1.1321411f, 0.000289917f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightIndex1/RightIndex2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Index_1_R/Index_2_R",
					modelRotation = new Quaternion(0.75384325f, 0.6567899f, 0.014630288f, 0.0115612745f),
					peakRotation = new Quaternion(0.2158591f, 0.21585913f, -0.6733535f, 0.6733535f),
					modelPosition = new Vector3(0.9871607f, 1.072642f, -0.01779151f),
					peakPosition = new Vector3(0.9871292f, 1.2456627f, 0.008628845f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightMiddle1/RightMiddle2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Middle_1_R/Middle_2_R",
					modelRotation = new Quaternion(0.74676955f, 0.6650671f, 0.0030332208f, 0.0034622848f),
					peakRotation = new Quaternion(0.021752525f, 0.021752577f, -0.7067722f, 0.7067721f),
					modelPosition = new Vector3(1.0092516f, 1.0663363f, -0.07853079f),
					peakPosition = new Vector3(0.9818363f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightRing1/RightRing2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Middle_1_R/Middle_2_R",
					modelRotation = new Quaternion(0.75625384f, 0.6535378f, -0.02353406f, -0.020366192f),
					peakRotation = new Quaternion(0.021752525f, 0.021752577f, -0.7067722f, 0.7067721f),
					modelPosition = new Vector3(1.006733f, 1.069449f, -0.12931001f),
					peakPosition = new Vector3(0.9818363f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightPinkie1/RightPinkie2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Pinky_1_R/Pinky_2_R",
					modelRotation = new Quaternion(0.7512212f, 0.6511935f, -0.0813795f, -0.07064828f),
					peakRotation = new Quaternion(-0.2035145f, -0.20351471f, -0.67718667f, 0.67718667f),
					modelPosition = new Vector3(0.98429894f, 1.074238f, -0.18044722f),
					peakPosition = new Vector3(0.9836006f, 1.2456627f, -0.115478516f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightThumb1/RightThumb2",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Thumb_R_1/Thumb_R_2",
					modelRotation = new Quaternion(0.6906988f, 0.31058943f, 0.6524429f, 0.028068483f),
					peakRotation = new Quaternion(-0.034694772f, -0.23054712f, -0.75536966f, 0.61242235f),
					modelPosition = new Vector3(0.75549364f, 1.0362226f, -0.03903842f),
					peakPosition = new Vector3(0.94125175f, 1.1321411f, 0.000289917f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftIndex1/LeftIndex2/LeftIndex3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Index_1_L/Index_2_L/Index_3_L",
					modelRotation = new Quaternion(0.045578867f, 0.044225663f, 0.7469162f, 0.66187847f),
					peakRotation = new Quaternion(0.21024102f, -0.22146226f, (float)Math.E * 38f / 153f, 0.67153156f),
					modelPosition = new Vector3(-1.0967004f, 1.0521964f, -0.017518044f),
					peakPosition = new Vector3(-1.0300674f, 1.2456627f, 0.008628845f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftMiddle1/LeftMiddle2/LeftMiddle3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Middle_1_L/Middle_2_L/Middle_3_L",
					modelRotation = new Quaternion(0.0074424148f, 0.009318054f, 0.7459653f, 0.6658782f),
					peakRotation = new Quaternion(0.021752518f, -0.021752525f, 0.7067722f, 0.7067721f),
					modelPosition = new Vector3(-1.1132244f, 1.0480586f, -0.07888901f),
					peakPosition = new Vector3(-1.0259495f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftRing1/LeftRing2/LeftRing3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Middle_1_L/Middle_2_L/Middle_3_L",
					modelRotation = new Quaternion(-0.038492978f, -0.030623764f, 0.7542827f, 0.6547047f),
					peakRotation = new Quaternion(0.021752518f, -0.021752525f, 0.7067722f, 0.7067721f),
					modelPosition = new Vector3(-1.1027732f, 1.0523896f, -0.13818407f),
					peakPosition = new Vector3(-1.0259495f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftPinkie1/LeftPinkie2/LeftPinkie3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Hand_Upper_L/Pinky_1_L/Pinky_2_L/Pinky_3_L",
					modelRotation = new Quaternion(-0.055013686f, -0.042713284f, 0.7561084f, 0.6507298f),
					peakRotation = new Quaternion(-0.2035145f, 0.20351481f, 0.6771867f, 0.67718667f),
					modelPosition = new Vector3(-1.0747073f, 1.0584773f, -0.20378852f),
					peakPosition = new Vector3(-1.0230103f, 1.2456627f, -0.115478516f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/LeftCollar/LeftArm/LeftForearm/LeftHand/LeftThumb1/LeftThumb2/LeftThumb3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_L/Arm_L/Elbow_L/Hand_L/Thumb_1_L/Thumb_2_L/Thumb_3_L",
					modelRotation = new Quaternion(0.56491196f, -0.062714726f, 0.70403373f, 0.42576757f),
					peakRotation = new Quaternion(-0.122516595f, 0.13008793f, 0.67456925f, 0.71625626f),
					modelPosition = new Vector3(-0.8013755f, 0.9567115f, 0.0047954917f),
					peakPosition = new Vector3(-0.97595406f, 1.1268501f, 0.011566162f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightIndex1/RightIndex2/RightIndex3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Index_1_R/Index_2_R/Index_3_R",
					modelRotation = new Quaternion(0.7655241f, 0.64223945f, 0.030388981f, 0.02404204f),
					peakRotation = new Quaternion(0.21024099f, 0.2214623f, (float)Math.E * -38f / 153f, 0.67153156f),
					modelPosition = new Vector3(1.0827626f, 1.0594122f, -0.014251947f),
					peakPosition = new Vector3(1.0300674f, 1.2456627f, 0.008628845f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightMiddle1/RightMiddle2/RightMiddle3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Middle_1_R/Middle_2_R/Middle_3_R",
					modelRotation = new Quaternion(0.74602556f, 0.6659051f, 0.0024602115f, 0.0031954944f),
					peakRotation = new Quaternion(0.021752495f, 0.021752547f, -0.7067722f, 0.7067721f),
					modelPosition = new Vector3(1.1068916f, 1.0549976f, -0.07762587f),
					peakPosition = new Vector3(1.0259495f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightRing1/RightRing2/RightRing3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Middle_1_R/Middle_2_R/Middle_3_R",
					modelRotation = new Quaternion(0.7436428f, 0.66519684f, -0.04957083f, -0.04529342f),
					peakRotation = new Quaternion(0.021752495f, 0.021752547f, -0.7067722f, 0.7067721f),
					modelPosition = new Vector3(1.0919414f, 1.0569422f, -0.1346221f),
					peakPosition = new Vector3(1.0259495f, 1.2456627f, -0.053718567f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightPinkie1/RightPinkie2/RightPinkie3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Hand_Upper_R/Pinky_1_R/Pinky_2_R/Pinky_3_R",
					modelRotation = new Quaternion(0.7465539f, 0.6581382f, -0.07241315f, -0.06532973f),
					peakRotation = new Quaternion(-0.20351453f, -0.20351478f, -0.6771867f, 0.67718667f),
					modelPosition = new Vector3(1.0743066f, 1.0610274f, -0.20019484f),
					peakPosition = new Vector3(1.0230103f, 1.2456627f, -0.115478516f)
				},
				new BoneSpec
				{
					modelPath = "2011x_ARM/Torso/UpperTorso/RightCollar/RightArm/RightForearm/RightHand/RightThumb1/RightThumb2/RightThumb3",
					peakPath = "Scout/Armature/Hip/Mid/AimJoint/Torso/S_Shoulder_R/Arm_R/Elbow_R/Hand_R/Thumb_R_1/Thumb_R_2/Thumb_R_3",
					modelRotation = new Quaternion(0.7046462f, 0.42583513f, 0.56414765f, -0.06225291f),
					peakRotation = new Quaternion(-0.12251661f, -0.1300879f, -0.67456925f, 0.71625626f),
					modelPosition = new Vector3(0.79422987f, 0.9567117f, 0.0047949553f),
					peakPosition = new Vector3(0.97595406f, 1.1268501f, 0.011566162f)
				}
			};
			return boneMap;
		}
	}
	public static class HeadVisibility
	{
		public static ShadowCastingMode ModeFor(Camera camera, Camera mainCamera, Transform head, bool hideNearCamera)
		{
			//IL_002a: 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)
			if (hideNearCamera && Object.op_Implicit((Object)(object)camera) && Object.op_Implicit((Object)(object)mainCamera) && (Object)(object)camera == (Object)(object)mainCamera && Object.op_Implicit((Object)(object)head) && Vector3.Distance(((Component)camera).transform.position, head.position) < 0.65f)
			{
				return (ShadowCastingMode)3;
			}
			return (ShadowCastingMode)1;
		}
	}
	public sealed class PassportPreview : IDisposable
	{
		private const string Name = "__2011x_PassportPreview";

		public readonly PlayerCustomizationDummy Dummy;

		private GameObject instance;

		private Retargeter driver;

		private JawPose jawPose;

		private Animator animator;

		private AnimatorCullingMode oldCulling;

		private readonly Dictionary<Renderer, bool> hidden = new Dictionary<Renderer, bool>();

		public bool IsValid
		{
			get
			{
				if (Object.op_Implicit((Object)(object)Dummy) && Object.op_Implicit((Object)(object)instance) && driver != null)
				{
					return driver.IsValid;
				}
				return false;
			}
		}

		public PassportPreview(PlayerCustomizationDummy dummy, GameObject prefab, BoneMap map)
		{
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			Dummy = dummy;
			try
			{
				Transform val = ((Component)dummy).transform.Find("__2011x_PassportPreview");
				if (Object.op_Implicit((Object)(object)val))
				{
					((Component)val).gameObject.SetActive(false);
					DestroyOwned(((Component)val).gameObject);
				}
				instance = Object.Instantiate<GameObject>(prefab, ((Component)dummy).transform, false);
				((Object)instance).name = "__2011x_PassportPreview";
				instance.SetActive(false);
				driver = new Retargeter(((Component)dummy).transform, instance.transform, map);
				jawPose = new JawPose(instance.transform);
				SkinnedMeshRenderer val2 = (Object.op_Implicit((Object)(object)dummy.refs) ? dummy.refs.mainRenderer : null);
				int layer = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).gameObject.layer : ((Component)dummy).gameObject.layer);
				Transform[] componentsInChildren = instance.GetComponentsInChildren<Transform>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).gameObject.layer = layer;
				}
				animator = dummy.anim;
				if (Object.op_Implicit((Object)(object)animator))
				{
					oldCulling = animator.cullingMode;
					animator.cullingMode = (AnimatorCullingMode)0;
				}
				driver.Apply(matchPositions: false);
				HideOriginal();
				instance.SetActive(true);
			}
			catch
			{
				Dispose();
				throw;
			}
		}

		public void SetFit(bool enabled)
		{
			driver.SetFit(enabled);
		}

		public void SetMouth(float amount, float openingScale)
		{
			jawPose.Apply(amount, openingScale);
		}

		public void Update(bool matchPositions)
		{
			driver.Apply(matchPositions);
			HideOriginal();
		}

		private void HideOriginal()
		{
			Renderer[] componentsInChildren = ((Component)Dummy).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				if (!((Component)val).transform.IsChildOf(instance.transform) && (val is SkinnedMeshRenderer || val is MeshRenderer))
				{
					if (!hidden.ContainsKey(val))
					{
						hidden.Add(val, val.forceRenderingOff);
					}
					val.forceRenderingOff = true;
				}
			}
		}

		public void Dispose()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<Renderer, bool> item in hidden)
			{
				if (Object.op_Implicit((Object)(object)item.Key))
				{
					item.Key.forceRenderingOff = item.Value;
				}
			}
			hidden.Clear();
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.cullingMode = oldCulling;
			}
			animator = null;
			if (Object.op_Implicit((Object)(object)instance))
			{
				instance.SetActive(false);
				DestroyOwned(instance);
			}
			instance = null;
			driver = null;
		}

		private static void DestroyOwned(GameObject value)
		{
			if (Application.isPlaying)
			{
				Object.Destroy((Object)(object)value);
			}
			else
			{
				Object.DestroyImmediate((Object)(object)value);
			}
		}
	}
	[BepInPlugin("alexs.peak.2011x.local", "2011x Local Model", "0.4.0")]
	[BepInDependency("alexs.peak.skin.catalog", "1.0.0")]
	[DefaultExecutionOrder(32000)]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Guid = "alexs.peak.2011x.local";

		private const string InstanceName = "__2011x_LocalModel";

		private const string PrefabPath = "assets/2011x/standalone/2011x_local.prefab";

		private AssetBundle bundle;

		private GameObject prefab;

		private GameObject instance;

		private Character owner;

		private Retargeter retarget;

		private BoneMap map;

		private float nextAttempt;

		private float nextScan;

		private string lastError;

		private string lastState;

		private ConfigEntry<bool> modEnabled;

		private ConfigEntry<bool> matchPositions;

		private ConfigEntry<bool> hideHeadNearCamera;

		private ConfigEntry<bool> skinEquipped;

		private ConfigEntry<bool> fitPlayer;

		private SkinRegistration registration;

		private PassportPreview passportPreview;

		private float nextPassportAttempt;

		private string lastPassportError;

		private FirstPersonParts firstPersonParts;

		private ConfigEntry<bool> handsAndFeetOnly;

		private ConfigEntry<bool> voiceMouthEnabled;

		private ConfigEntry<float> mouthSensitivity;

		private ConfigEntry<float> mouthOpeningScale;

		private readonly VoiceMouth voiceMouth = new VoiceMouth();

		private JawPose jawPose;

		private float mouthAmount;

		private string lastVoiceError;

		private SkinnedMeshRenderer headRenderer;

		private Transform headBone;

		private Animator gameAnimator;

		private AnimatorCullingMode oldCulling;

		private readonly Dictionary<Renderer, bool> hidden = new Dictionary<Renderer, bool>();

		private bool IsEquipped
		{
			get
			{
				if (registration != null && !registration.IsDisposed)
				{
					return registration.IsSelected;
				}
				return false;
			}
		}

		private void Awake()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable the 2011x outfit option and local model replacement.");
			voiceMouthEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Voice", "AnimateMouth", true, "Open LowerJaw while the existing PEAK voice recorder transmits speech. Respects push-to-talk/mute; no separate microphone capture.");
			mouthSensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("Voice", "Sensitivity", 1f, new ConfigDescription("Voice response: raise for a quiet microphone, lower if it opens too much.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			mouthOpeningScale = ((BaseUnityPlugin)this).Config.Bind<float>("Voice", "OpeningScale", 1f, new ConfigDescription("Maximum jaw opening relative to the calibrated limit. 1 is the full opening, 0 keeps the original smile.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			skinEquipped = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "Use2011x", false, "Select 2011x in Passport clothing (Fit) to equip it; select any standard outfit to remove it. Selected by the shared PEAK Skin Catalog; the catalog saves the authoritative skin ID.");
			handsAndFeetOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Model", "FirstPersonHandsAndFeet", true, "Show only gloves/fingers and shoes in the local first-person camera. Mirrors and Passport retain the complete model.");
			fitPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Model", "FitToPlayer", true, "Match the standard character height (+15.03%), align wrists to held-item anchors and keep feet aligned. False restores 0.2.0 proportions and placement.");
			matchPositions = ((BaseUnityPlugin)this).Config.Bind<bool>("Model", "MatchGameJointPositions", false, "Experimental: stretch main joints to PEAK positions. Default preserves 2011x proportions.");
			hideHeadNearCamera = ((BaseUnityPlugin)this).Config.Bind<bool>("Model", "HideHeadNearCamera", true, "Hide the model's head when the main camera is inside it; keep its shadow. Full head returns when the camera is farther away.");
			try
			{
				string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "2011x_local");
				if (!File.Exists(text))
				{
					throw new FileNotFoundException("Place 2011x_local next to PEAK2011xStandalone.dll", text);
				}
				bundle = AssetBundle.LoadFromFile(text);
				if (!Object.op_Implicit((Object)(object)bundle))
				{
					throw new InvalidDataException("Cannot load 2011x_local AssetBundle");
				}
				prefab = bundle.LoadAsset<GameObject>("assets/2011x/standalone/2011x_local.prefab");
				if (!Object.op_Implicit((Object)(object)prefab) || prefab.GetComponentsInChildren<SkinnedMeshRenderer>(true).Length == 0)
				{
					throw new InvalidDataException("Standalone prefab or skinned mesh missing");
				}
				if (!Object.op_Implicit((Object)(object)prefab.transform.Find("2011x_Head")))
				{
					throw new InvalidDataException("Expected standalone bundle with separate head renderer");
				}
				if (!Object.op_Implicit((Object)(object)prefab.transform.Find("__2011x_HandsAndFeet")))
				{
					throw new InvalidDataException("Replace 2011x_local with the 0.2.3 bundle containing prebuilt hands and feet");
				}
				if (prefab.GetComponentsInChildren<MonoBehaviour>(true).Length != 0)
				{
					throw new InvalidDataException("Expected a standalone prefab without MonoBehaviours");
				}
				map = Retargeter.ReadMap();
				EnsureRegistration();
				((BaseUnityPlugin)this).Logger.LogInfo((object)("2011x 0.4.0 ready; shared catalog; snappy voice-driven LowerJaw; selected=" + skinEquipped.Value + "; fitToPlayer=" + fitPlayer.Value + "; 49 bones including Ring <- Middle; no UCustomPrefabs."));
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)ex);
				((Behaviour)this).enabled = false;
			}
		}

		internal static bool Eligible(Character c)
		{
			if (Object.op_Implicit((Object)(object)c) && (Object)(object)c == (Object)(object)Character.localCharacter && c.IsLocal && !c.isBot && !c.isScoutmaster && !c.isZombie && Object.op_Implicit((Object)(object)((MonoBehaviourPun)c).photonView))
			{
				return ((MonoBehaviourPun)c).photonView.IsMine;
			}
			return false;
		}

		internal static bool RigReady(Character c)
		{
			if (Object.op_Implicit((Object)(object)c) && c.refs != null && Object.op_Implicit((Object)(object)c.refs.rigCreator))
			{
				return Object.op_Implicit((Object)(object)c.refs.animator);
			}
			return false;
		}

		private void ReportState(string state)
		{
			if (!(state == lastState))
			{
				lastState = state;
				((BaseUnityPlugin)this).Logger.LogInfo((object)("2011x state: " + state));
			}
		}

		private void LateUpdate()
		{
			try
			{
				UpdateVoiceMouth();
				UpdatePassport();
				Character localCharacter = Character.localCharacter;
				bool flag = modEnabled.Value && IsEquipped && Object.op_Implicit((Object)(object)prefab) && Eligible(localCharacter) && ((Component)localCharacter).gameObject.activeInHierarchy;
				if (retarget != null && (!Object.op_Implicit((Object)(object)owner) || !flag || (Object)(object)localCharacter != (Object)(object)owner || !Object.op_Implicit((Object)(object)instance) || !retarget.IsValid))
				{
					Detach();
				}
				if (!flag)
				{
					ReportState((!modEnabled.Value) ? "disabled by config" : ((!skinEquipped.Value) ? "standard appearance selected; choose 2011x in Passport" : ((!Object.op_Implicit((Object)(object)localCharacter)) ? "waiting for local Character" : "local Character inactive or not owned by this client")));
					return;
				}
				if (!Object.op_Implicit((Object)(object)owner) && Time.unscaledTime >= nextAttempt)
				{
					nextAttempt = Time.unscaledTime + 1f;
					if (!RigReady(localCharacter))
					{
						ReportState("waiting for local rig/Animator references");
						return;
					}
					Attach(localCharacter);
				}
				if (!Object.op_Implicit((Object)(object)owner))
				{
					return;
				}
				retarget.SetFit(fitPlayer.Value);
				retarget.Apply(matchPositions.Value);
				if (jawPose != null)
				{
					jawPose.Apply(mouthAmount, mouthOpeningScale.Value);
				}
				if (Object.op_Implicit((Object)(object)headRenderer))
				{
					((Renderer)headRenderer).shadowCastingMode = (ShadowCastingMode)1;
				}
				if (Time.unscaledTime >= nextScan)
				{
					nextScan = Time.unscaledTime + 0.5f;
					CollectRenderers();
				}
				foreach (KeyValuePair<Renderer, bool> item in hidden)
				{
					if (Object.op_Implicit((Object)(object)item.Key))
					{
						item.Key.forceRenderingOff = true;
					}
				}
			}
			catch (Exception ex)
			{
				Detach();
				nextAttempt = Time.unscaledTime + 5f;
				string text = ex.GetType().Name + ": " + ex.Message;
				if (text != lastError)
				{
					lastError = text;
					((BaseUnityPlugin)this).Logger.LogError((object)("Model attach/update failed; standard model restored. " + ex));
				}
			}
		}

		private void SelectSkin(bool equipped)
		{
			if (skinEquipped.Value != equipped)
			{
				skinEquipped.Value = equipped;
				((BaseUnityPlugin)this).Config.Save();
			}
			nextAttempt = 0f;
			nextPassportAttempt = 0f;
			if (!skinEquipped.Value)
			{
				Detach();
				if (passportPreview != null)
				{
					passportPreview.Dispose();
					passportPreview = null;
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Passport appearance selected: " + (skinEquipped.Value ? "2011x" : "standard")));
		}

		private void UpdateVoiceMouth()
		{
			try
			{
				mouthAmount = voiceMouth.Read(Character.localCharacter, modEnabled.Value && IsEquipped && voiceMouthEnabled.Value, mouthSensitivity.Value);
			}
			catch (Exception ex)
			{
				mouthAmount = 0f;
				voiceMouth.Reset();
				if (lastVoiceError != ex.Message)
				{
					lastVoiceError = ex.Message;
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Voice mouth paused; model remains available: " + ex.Message));
				}
			}
		}

		private void EnsureRegistration()
		{
			if (registration != null && !registration.IsDisposed)
			{
				return;
			}
			registration = null;
			CatalogPlugin val = CatalogPlugin.Instance;
			if (!Object.op_Implicit((Object)(object)prefab) || !Object.op_Implicit((Object)(object)val) || !((Behaviour)val).enabled || val.Registry == null || val.Registry.IsDisposed)
			{
				return;
			}
			byte[] array;
			using (Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("PEAK2011xStandalone.icon.png"))
			{
				if (stream == null)
				{
					throw new InvalidDataException("Embedded skin thumbnail missing");
				}
				using MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				array = memoryStream.ToArray();
			}
			registration = val.Registry.Register("alexs.peak.2011x.local", "2011x", array, (Func<bool>)(() => ((Behaviour)this).isActiveAndEnabled && modEnabled.Value && Object.op_Implicit((Object)(object)prefab)), (Action<bool>)SelectSkin);
		}

		private void UpdatePassport()
		{
			if (Time.unscaledTime < nextPassportAttempt)
			{
				return;
			}
			try
			{
				EnsureRegistration();
				PassportManager val = PassportManager.instance;
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.uiObject) || !((MenuWindow)val).isOpen)
				{
					if (passportPreview != null)
					{
						passportPreview.Dispose();
						passportPreview = null;
					}
					return;
				}
				bool flag = modEnabled.Value && IsEquipped && Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)val.dummy) && ((Component)val.dummy).gameObject.activeInHierarchy;
				if (passportPreview != null && (!flag || !passportPreview.IsValid || (Object)(object)passportPreview.Dummy != (Object)(object)val.dummy))
				{
					passportPreview.Dispose();
					passportPreview = null;
				}
				if (flag)
				{
					if (passportPreview == null)
					{
						passportPreview = new PassportPreview(val.dummy, prefab, map);
					}
					passportPreview.SetFit(fitPlayer.Value);
					passportPreview.Update(matchPositions.Value);
					passportPreview.SetMouth(mouthAmount, mouthOpeningScale.Value);
				}
				lastPassportError = null;
			}
			catch (Exception ex)
			{
				if (passportPreview != null)
				{
					passportPreview.Dispose();
					passportPreview = null;
				}
				nextPassportAttempt = Time.unscaledTime + 5f;
				if (ex.Message != lastPassportError)
				{
					lastPassportError = ex.Message;
					((BaseUnityPlugin)this).Logger.LogError((object)("Passport skin UI/preview: " + ex));
				}
			}
		}

		private void DisposePassport()
		{
			if (passportPreview != null)
			{
				passportPreview.Dispose();
				passportPreview = null;
			}
			if (registration != null)
			{
				registration.Dispose();
				registration = null;
			}
		}

		private void Attach(Character c)
		{
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)c).transform.Find("__2011x_LocalModel");
			if (Object.op_Implicit((Object)(object)val))
			{
				((Component)val).gameObject.SetActive(false);
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
			GameObject val2 = Object.Instantiate<GameObject>(prefab, ((Component)c).transform, false);
			((Object)val2).name = "__2011x_LocalModel";
			val2.SetActive(false);
			try
			{
				Retargeter retargeter = new Retargeter(((Component)c).transform, val2.transform, map);
				JawPose jawPose = new JawPose(val2.transform);
				retargeter.SetFit(fitPlayer.Value);
				Transform[] componentsInChildren = val2.GetComponentsInChildren<Transform>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).gameObject.layer = ((Component)c.refs.rigCreator).gameObject.layer;
				}
				SkinnedMeshRenderer[] componentsInChildren2 = val2.GetComponentsInChildren<SkinnedMeshRenderer>(true);
				foreach (SkinnedMeshRenderer obj in componentsInChildren2)
				{
					((Renderer)obj).enabled = true;
					((Renderer)obj).forceRenderingOff = false;
					obj.updateWhenOffscreen = true;
				}
				retargeter.Apply(matchPositions.Value);
				owner = c;
				instance = val2;
				retarget = retargeter;
				this.jawPose = jawPose;
				headRenderer = ((Component)val2.transform.Find("2011x_Head")).GetComponent<SkinnedMeshRenderer>();
				headBone = val2.transform.Find("2011x_ARM/Torso/UpperTorso/Head");
				firstPersonParts = new FirstPersonParts(val2);
				gameAnimator = c.refs.animator;
				oldCulling = gameAnimator.cullingMode;
				gameAnimator.cullingMode = (AnimatorCullingMode)0;
				CollectRenderers();
				val2.SetActive(true);
				lastError = null;
				Scene scene = ((Component)c).gameObject.scene;
				ReportState("attached to local Character in " + ((Scene)(ref scene)).name);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Attached 2011x to local Character " + ((Object)c).GetInstanceID() + "; bones=" + retargeter.Count + "; hidden renderers=" + hidden.Count));
			}
			catch
			{
				val2.SetActive(false);
				Object.Destroy((Object)(object)val2);
				throw;
			}
		}

		private void Hide(Renderer r)
		{
			if (Object.op_Implicit((Object)(object)r) && Object.op_Implicit((Object)(object)owner) && !((Component)r).transform.IsChildOf(instance.transform) && !((Object)(object)((Component)r).GetComponentInParent<Character>() != (Object)(object)owner) && !Object.op_Implicit((Object)(object)((Component)r).GetComponentInParent<Item>()))
			{
				if (!hidden.ContainsKey(r))
				{
					hidden.Add(r, r.forceRenderingOff);
				}
				r.forceRenderingOff = true;
			}
		}

		private void HideAll(Renderer[] renderers)
		{
			if (renderers != null)
			{
				foreach (Renderer r in renderers)
				{
					Hide(r);
				}
			}
		}

		private void CollectRenderers()
		{
			if (!Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)instance))
			{
				return;
			}
			SkinnedMeshRenderer[] componentsInChildren = ((Component)owner).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer r in componentsInChildren)
			{
				Hide((Renderer)(object)r);
			}
			CustomizationRefs val = (Object.op_Implicit((Object)(object)owner.refs.customization) ? owner.refs.customization.refs : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				HideAll(val.AllRenderers);
				HideAll(val.PlayerRenderers);
				HideAll(val.EyeRenderers);
				HideAll(val.playerHats);
				Hide(val.mouthRenderer);
				Hide(val.accessoryRenderer);
				Hide(val.medalRenderer);
				Hide(val.headShadow);
				Hide(val.blindRenderer);
				if (Object.op_Implicit((Object)(object)val.thirdEye))
				{
					Renderer[] componentsInChildren2 = val.thirdEye.GetComponentsInChildren<Renderer>(true);
					foreach (Renderer r2 in componentsInChildren2)
					{
						Hide(r2);
					}
				}
				if (Object.op_Implicit((Object)(object)val.hatShadowMeshFilter))
				{
					Hide(((Component)val.hatShadowMeshFilter).GetComponent<Renderer>());
				}
			}
			HideTheBody hideTheBody = owner.refs.hideTheBody;
			if (!Object.op_Implicit((Object)(object)hideTheBody))
			{
				return;
			}
			Hide(hideTheBody.headRend);
			Hide(hideTheBody.medal);
			if (Object.op_Implicit((Object)(object)hideTheBody.face))
			{
				Renderer[] componentsInChildren2 = ((Component)hideTheBody.face).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer r3 in componentsInChildren2)
				{
					Hide(r3);
				}
			}
			if (Object.op_Implicit((Object)(object)hideTheBody.shadowCasterHat))
			{
				Renderer[] componentsInChildren2 = hideTheBody.shadowCasterHat.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer r4 in componentsInChildren2)
				{
					Hide(r4);
				}
			}
		}

		private void Detach()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (firstPersonParts != null)
			{
				firstPersonParts.Dispose();
				firstPersonParts = null;
			}
			foreach (KeyValuePair<Renderer, bool> item in hidden)
			{
				if (Object.op_Implicit((Object)(object)item.Key))
				{
					item.Key.forceRenderingOff = item.Value;
				}
			}
			hidden.Clear();
			if (Object.op_Implicit((Object)(object)gameAnimator))
			{
				gameAnimator.cullingMode = oldCulling;
			}
			gameAnimator = null;
			if (Object.op_Implicit((Object)(object)instance))
			{
				instance.SetActive(false);
				Object.Destroy((Object)(object)instance);
			}
			instance = null;
			retarget = null;
			owner = null;
			headRenderer = null;
			headBone = null;
			jawPose = null;
		}

		private void OnEnable()
		{
			RenderPipelineManager.beginCameraRendering += BeforeCamera;
			RenderPipelineManager.endCameraRendering += AfterCamera;
		}

		private void BeforeCamera(ScriptableRenderContext context, Camera camera)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (firstPersonParts != null && handsAndFeetOnly.Value && Object.op_Implicit((Object)(object)owner) && Eligible(owner))
			{
				firstPersonParts.SetFirstPerson((Object)(object)camera == (Object)(object)Camera.main && !owner.data.dead && !owner.data.fullyPassedOut);
			}
			else if (Object.op_Implicit((Object)(object)headRenderer) && Object.op_Implicit((Object)(object)headBone) && Object.op_Implicit((Object)(object)owner) && Eligible(owner))
			{
				((Renderer)headRenderer).shadowCastingMode = HeadVisibility.ModeFor(camera, Camera.main, headBone, hideHeadNearCamera.Value);
			}
		}

		private void AfterCamera(ScriptableRenderContext context, Camera camera)
		{
			if (firstPersonParts != null)
			{
				firstPersonParts.SetFirstPerson(active: false);
			}
			if (Object.op_Implicit((Object)(object)headRenderer))
			{
				((Renderer)headRenderer).shadowCastingMode = (ShadowCastingMode)1;
			}
		}

		private void OnDisable()
		{
			RenderPipelineManager.beginCameraRendering -= BeforeCamera;
			RenderPipelineManager.endCameraRendering -= AfterCamera;
			Detach();
			DisposePassport();
			voiceMouth.Reset();
			mouthAmount = 0f;
		}

		private void OnDestroy()
		{
			Detach();
			DisposePassport();
			if (Object.op_Implicit((Object)(object)bundle))
			{
				bundle.Unload(true);
			}
			bundle = null;
			prefab = null;
		}
	}
	[Serializable]
	public sealed class BoneMap
	{
		public BoneSpec[] bones;
	}
	[Serializable]
	public sealed class BoneSpec
	{
		public string modelPath;

		public string peakPath;

		public Quaternion modelRotation;

		public Quaternion peakRotation;

		public Vector3 modelPosition;

		public Vector3 peakPosition;
	}
	public sealed class Retargeter
	{
		private readonly Transform[] source;

		private readonly Transform[] target;

		private readonly Quaternion[] offsets;

		private readonly BoneSpec[] specs;

		private readonly Vector3[] restLocalPositions;

		private readonly Vector3 initialScale;

		private bool fitToPlayer;

		private readonly int[][] limbs;

		public readonly Transform Root;

		public int Count => source.Length;

		public bool IsValid
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)Root))
				{
					return false;
				}
				for (int i = 0; i < source.Length; i++)
				{
					if (!Object.op_Implicit((Object)(object)source[i]) || !Object.op_Implicit((Object)(object)target[i]))
					{
						return false;
					}
				}
				return true;
			}
		}

		public static BoneMap ReadMap()
		{
			return GeneratedBoneMap.Create();
		}

		public Retargeter(Transform characterRoot, Transform modelRoot, BoneMap map)
		{
			//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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			if (map == null || map.bones == null || map.bones.Length != 49)
			{
				throw new InvalidDataException("Expected 49 verified bone mappings (including six Ring <- Middle followers)");
			}
			Root = modelRoot;
			specs = map.bones;
			initialScale = Root.localScale;
			source = (Transform[])(object)new Transform[specs.Length];
			target = (Transform[])(object)new Transform[specs.Length];
			offsets = (Quaternion[])(object)new Quaternion[specs.Length];
			restLocalPositions = (Vector3[])(object)new Vector3[specs.Length];
			for (int i = 0; i < specs.Length; i++)
			{
				source[i] = characterRoot.Find(specs[i].peakPath);
				target[i] = modelRoot.Find(specs[i].modelPath);
				if (!Object.op_Implicit((Object)(object)source[i]) || !Object.op_Implicit((Object)(object)target[i]))
				{
					throw new InvalidDataException("Required bone missing: " + specs[i].modelPath + " <- " + specs[i].peakPath);
				}
				offsets[i] = Quaternion.Inverse(specs[i].peakRotation) * specs[i].modelRotation;
				restLocalPositions[i] = target[i].localPosition;
			}
			limbs = new int[4][]
			{
				new int[3]
				{
					Index("LeftArm"),
					Index("LeftForearm"),
					Index("LeftHand")
				},
				new int[3]
				{
					Index("RightArm"),
					Index("RightForearm"),
					Index("RightHand")
				},
				new int[3]
				{
					Index("LeftThigh"),
					Index("LeftCalf"),
					Index("LeftFoot")
				},
				new int[3]
				{
					Index("RightThigh"),
					Index("RightCalf"),
					Index("RightFoot")
				}
			};
		}

		public void SetFit(bool enabled)
		{
			//IL_0018: 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)
			if (fitToPlayer != enabled)
			{
				fitToPlayer = enabled;
				Root.localScale = initialScale * (enabled ? 1.150323f : 1f);
			}
		}

		public void Apply(bool matchPositions)
		{
			//IL_0013: 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_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_007a: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < target.Length; i++)
			{
				target[i].localPosition = restLocalPositions[i];
			}
			for (int j = 0; j < source.Length; j++)
			{
				BoneSpec boneSpec = specs[j];
				target[j].rotation = source[j].rotation * offsets[j];
				if (j == 0)
				{
					target[j].position = source[j].position + source[j].rotation * Quaternion.Inverse(boneSpec.peakRotation) * (FittedPosition(boneSpec.modelPosition) - boneSpec.peakPosition);
				}
				else if (!fitToPlayer && matchPositions && IsMajorJoint(boneSpec.modelPath))
				{
					target[j].position = source[j].position;
				}
			}
			if (fitToPlayer)
			{
				for (int k = 0; k < limbs.Length; k++)
				{
					FitLimb(limbs[k][0], limbs[k][1], limbs[k][2], k < 2);
				}
			}
		}

		private Vector3 FittedPosition(Vector3 original)
		{
			//IL_000a: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			if (!fitToPlayer)
			{
				return original;
			}
			return original * 1.150323f + Vector3.up * 0.000868697f;
		}

		private int Index(string name)
		{
			for (int i = 0; i < specs.Length; i++)
			{
				if (specs[i].modelPath.EndsWith("/" + name, StringComparison.Ordinal))
				{
					return i;
				}
			}
			throw new InvalidDataException("Verified limb mapping missing: " + name);
		}

		private void FitLimb(int a, int b, int c, bool isHand)
		{
			//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_007f: 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_0093: 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_001b: 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_0032: 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_0052: 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_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)
			Vector3 val = source[c].position;
			if (!isHand)
			{
				val += source[c].rotation * Quaternion.Inverse(specs[c].peakRotation) * (FittedPosition(specs[c].modelPosition) - specs[c].peakPosition);
			}
			SolveLimb(target[a], target[b], target[c], val, source[b].position, Root.forward);
		}

		private static void SolveLimb(Transform upper, Transform middle, Transform end, Vector3 goal, Vector3 hint, Vector3 forward)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0036: 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_002f: 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_003e: 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_004d: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: 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_01af: Unknown result type (mi