Decompiled source of AntroSkins v3.0.0

Antro.Skins.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnhollowerBaseLib;
using UnhollowerRuntimeLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Antro.Skins")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Antro.Skins")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyProduct("Antro.Skins")]
[assembly: AssemblyTitle("Antro.Skins")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Antro.CustomOutline
{
	public enum OutlineMode
	{
		Normal,
		Rainbow,
		Pulse,
		Police,
		Golden,
		Toxic,
		Glitch,
		Angelic,
		Disco,
		Fire,
		Ice,
		Void,
		Heartbeat,
		Chroma,
		Danger,
		LoadingBar
	}
	[BepInPlugin("Antro.CustomOutline", "Antro Custom Outline", "2.4.4")]
	public class MainPlugin : BasePlugin
	{
		public override void Load()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ClassInjector.RegisterTypeInIl2Cpp<OutlineController>();
			GameObject val = new GameObject("AntroOutline_Manager");
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<OutlineController>();
			((BasePlugin)this).Log.LogInfo((object)"[Antro.CustomOutline 2.4.4] Loaded. Optimized Caching Enabled!");
		}
	}
	public class OutlineController : MonoBehaviour
	{
		private bool _showMenu = false;

		private Rect _windowRect = new Rect(50f, 50f, 350f, 480f);

		private GUIStyle _headerStyle;

		private bool _stylesInit = false;

		public static bool IsEnabled = true;

		public static OutlineMode CurrentMode = OutlineMode.Rainbow;

		private float _hue;

		private float _discoTimer;

		private float _glitchTimer = 0f;

		private Color _currentDiscoColor = Color.white;

		private Color _currentGlitchColor = Color.cyan;

		private float _currentGlitchWidth = 10f;

		private bool _reflectionInitialized = false;

		private Type _nextGenSettingsType;

		private FieldInfo _nextGenToggleField;

		private FieldInfo _nextGenBoolField;

		private Dictionary<ulong, MonoBehaviourPublicHa1MeObouCoSiouBoprUnique[]> _cachedOutlines = new Dictionary<ulong, MonoBehaviourPublicHa1MeObouCoSiouBoprUnique[]>();

		public OutlineController(IntPtr ptr)
			: base(ptr)
		{
		}//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)


		private void Start()
		{
			InitNextGenReflection();
		}

		private void Update()
		{
			if (!_reflectionInitialized)
			{
				InitNextGenReflection();
			}
			if (Input.GetKeyDown((KeyCode)288))
			{
				_showMenu = !_showMenu;
				if (_showMenu)
				{
					Cursor.visible = true;
					Cursor.lockState = (CursorLockMode)0;
				}
				else if ((Object)(object)MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance != (Object)null)
				{
					Cursor.lockState = (CursorLockMode)1;
				}
			}
			if (IsEnabled && (Object)(object)MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance != (Object)null)
			{
				ApplyEffects();
			}
		}

		private void LateUpdate()
		{
			ForceDisableNextGenLoop();
		}

		private void InitNextGenReflection()
		{
			try
			{
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly in assemblies)
				{
					Type type = assembly.GetType("NextGenMods.SettingsNextGen");
					if (type != null)
					{
						_nextGenSettingsType = type;
						_nextGenToggleField = type.GetField("RGBTagToggle", BindingFlags.Static | BindingFlags.Public);
						_nextGenBoolField = type.GetField("RGBTagBool", BindingFlags.Static | BindingFlags.Public);
						_reflectionInitialized = true;
						break;
					}
				}
			}
			catch
			{
			}
		}

		private void ForceDisableNextGenLoop()
		{
			if (!_reflectionInitialized)
			{
				return;
			}
			try
			{
				if (_nextGenBoolField != null)
				{
					_nextGenBoolField.SetValue(null, false);
				}
				if (!(_nextGenToggleField != null))
				{
					return;
				}
				object? value = _nextGenToggleField.GetValue(null);
				GameObject val = (GameObject)((value is GameObject) ? value : null);
				if (val != null)
				{
					Toggle component = val.GetComponent<Toggle>();
					if ((Object)(object)component != (Object)null && component.isOn)
					{
						component.isOn = false;
					}
				}
			}
			catch
			{
			}
		}

		private void OnGUI()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (_showMenu)
			{
				if (!_stylesInit)
				{
					_headerStyle = new GUIStyle(GUI.skin.label)
					{
						alignment = (TextAnchor)4,
						fontStyle = (FontStyle)1,
						fontSize = 14
					};
					_headerStyle.normal.textColor = Color.yellow;
					_stylesInit = true;
				}
				GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.95f);
				GUI.contentColor = Color.white;
				_windowRect = GUI.Window(1337, _windowRect, WindowFunction.op_Implicit((Action<int>)DrawWindow), "Antro.CustomOutline Settings");
			}
		}

		private void DrawWindow(int id)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f));
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUI.backgroundColor = (IsEnabled ? Color.green : Color.red);
			if (GUILayout.Button(IsEnabled ? "STATUS: ENABLED" : "STATUS: DISABLED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				IsEnabled = !IsEnabled;
			}
			GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f);
			GUILayout.Space(10f);
			GUILayout.Label($"Mode: {CurrentMode}", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUI.backgroundColor = Color.gray;
			if (GUILayout.Button("Normal (Default Red)", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Normal;
			}
			GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f);
			GUILayout.Space(5f);
			GUILayout.Label("Classic:", _headerStyle, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Rainbow", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Rainbow;
			}
			if (GUILayout.Button("Pulse", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Pulse;
			}
			if (GUILayout.Button("Police", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Police;
			}
			if (GUILayout.Button("Golden", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Golden;
			}
			GUILayout.Space(5f);
			GUILayout.Label("Exotic:", _headerStyle, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Toxic", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Toxic;
			}
			if (GUILayout.Button("Glitch", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Glitch;
			}
			if (GUILayout.Button("Angelic", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Angelic;
			}
			if (GUILayout.Button("Disco", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Disco;
			}
			GUILayout.Space(5f);
			GUILayout.Label("Interactive:", _headerStyle, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Loading Bar", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.LoadingBar;
			}
			if (GUILayout.Button("Fire / Lava", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Fire;
			}
			if (GUILayout.Button("Ice / Frozen", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Ice;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Void", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Void;
			}
			if (GUILayout.Button("Chroma", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Chroma;
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Heartbeat", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Heartbeat;
			}
			if (GUILayout.Button("Danger", Array.Empty<GUILayoutOption>()))
			{
				CurrentMode = OutlineMode.Danger;
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private void ApplyEffects()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_0688: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance == (Object)null)
			{
				return;
			}
			ulong mySteamID = GetMySteamID();
			if (CurrentMode == OutlineMode.Disco)
			{
				_discoTimer += Time.deltaTime;
				if (_discoTimer >= 0.1f)
				{
					_currentDiscoColor = new Color(Random.value, Random.value, Random.value);
					_discoTimer = 0f;
				}
			}
			if (CurrentMode == OutlineMode.Glitch)
			{
				_glitchTimer += Time.deltaTime;
				if (_glitchTimer >= 0.05f)
				{
					_currentGlitchColor = ((Random.value > 0.5f) ? Color.cyan : Color.magenta);
					_currentGlitchWidth = Random.Range(5f, 25f);
					_glitchTimer = 0f;
				}
			}
			Enumerator<ulong, MonoBehaviourPublicCSstReshTrheObplBojuUnique> enumerator = MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<ulong, MonoBehaviourPublicCSstReshTrheObplBojuUnique> current = enumerator.Current;
				MonoBehaviourPublicCSstReshTrheObplBojuUnique value = current.Value;
				if ((Object)(object)value == (Object)null)
				{
					continue;
				}
				_ = value.steamProfile;
				if (false)
				{
					continue;
				}
				ulong steamID = value.steamProfile.m_SteamID;
				if (steamID == mySteamID)
				{
					continue;
				}
				Il2CppArrayBase<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique> componentsInChildren = ((Component)value).GetComponentsInChildren<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique>(true);
				bool flag = !_cachedOutlines.ContainsKey(steamID) || _cachedOutlines[steamID] == null;
				if (!flag)
				{
					if (_cachedOutlines[steamID].Length != componentsInChildren.Count)
					{
						flag = true;
					}
					else
					{
						MonoBehaviourPublicHa1MeObouCoSiouBoprUnique[] array = _cachedOutlines[steamID];
						foreach (MonoBehaviourPublicHa1MeObouCoSiouBoprUnique val in array)
						{
							if ((Object)(object)val == (Object)null)
							{
								flag = true;
								break;
							}
						}
					}
				}
				if (flag)
				{
					_cachedOutlines[steamID] = Il2CppArrayBase<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique>.op_Implicit(componentsInChildren);
				}
				MonoBehaviourPublicHa1MeObouCoSiouBoprUnique val2 = (((Object)(object)value.shirt != (Object)null) ? ((Component)value.shirt).GetComponent<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique>() : null);
				bool flag2 = (Object)(object)val2 != (Object)null && ((Behaviour)val2).enabled;
				Color color = Color.black;
				float width = 0f;
				if (flag2)
				{
					color = Color.red;
					width = 20f;
					switch (CurrentMode)
					{
					case OutlineMode.Normal:
						color = Color.red;
						width = 8f;
						break;
					case OutlineMode.Rainbow:
						_hue += Time.deltaTime * 0.05f;
						if (_hue > 1f)
						{
							_hue = 0f;
						}
						color = Color.HSVToRGB(_hue, 1f, 1f);
						break;
					case OutlineMode.Pulse:
					{
						float num3 = Mathf.PingPong(Time.time * 0.5f, 1f);
						((Color)(ref color))..ctor(0.6f + num3 * 0.4f, 0f, 0f);
						width = 6f + num3 * 4f;
						break;
					}
					case OutlineMode.Police:
						color = (((int)(Time.time * 8f) % 2 == 0) ? Color.blue : Color.red);
						width = 10f;
						break;
					case OutlineMode.Golden:
						color = Color.Lerp(new Color(0.7f, 0.5f, 0f), new Color(1f, 0.9f, 0.5f), Mathf.PingPong(Time.time * 0.8f, 1f));
						width = 9f;
						break;
					case OutlineMode.Toxic:
						color = Color.Lerp(Color.green, new Color(0.5f, 1f, 0f), Mathf.PingPong(Time.time * 3f, 1f));
						width = 8f + Mathf.Sin(Time.time * 15f) * 2f;
						break;
					case OutlineMode.Glitch:
						color = _currentGlitchColor;
						width = _currentGlitchWidth;
						break;
					case OutlineMode.Angelic:
						color = Color.white;
						width = 8f + Mathf.PingPong(Time.time * 0.5f, 1f) * 4f;
						break;
					case OutlineMode.Disco:
						color = _currentDiscoColor;
						width = 9f;
						break;
					case OutlineMode.Fire:
						color = Color.Lerp(Color.red, Color.yellow, Mathf.PingPong(Time.time * 2f, 1f));
						width = 9f;
						break;
					case OutlineMode.Ice:
						color = Color.Lerp(new Color(0f, 1f, 1f), Color.white, 0.3f);
						width = 8f;
						break;
					case OutlineMode.Void:
						((Color)(ref color))..ctor(0.2f, 0f, 0.4f);
						width = 10f;
						break;
					case OutlineMode.Chroma:
						color = Color.Lerp(Color.blue, Color.magenta, Mathf.PingPong(Time.time * 0.5f, 1f));
						width = 8f;
						break;
					case OutlineMode.Danger:
						color = (((int)(Time.time * 4f) % 2 == 0) ? Color.yellow : Color.black);
						width = 10f;
						break;
					case OutlineMode.Heartbeat:
					{
						float num2 = Time.time % 2f;
						color = Color.red;
						width = ((!(num2 < 0.1f)) ? ((!(num2 < 0.2f)) ? ((!(num2 < 0.3f)) ? ((!(num2 < 0.4f)) ? 4f : Mathf.Lerp(12f, 4f, (num2 - 0.3f) / 0.1f)) : Mathf.Lerp(6f, 12f, (num2 - 0.2f) / 0.1f)) : Mathf.Lerp(12f, 6f, (num2 - 0.1f) / 0.1f)) : Mathf.Lerp(4f, 12f, num2 / 0.1f));
						break;
					}
					case OutlineMode.LoadingBar:
					{
						float num = Mathf.Repeat(Time.time, 3f) / 3f;
						color = Color.Lerp(Color.red, Color.green, num);
						width = Mathf.Lerp(0f, 15f, num);
						break;
					}
					}
				}
				SetCachedOutline(_cachedOutlines[steamID], color, width, flag2);
			}
		}

		private void SetCachedOutline(MonoBehaviourPublicHa1MeObouCoSiouBoprUnique[] outlines, Color color, float width, bool active)
		{
			//IL_010f: 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)
			if (outlines == null)
			{
				return;
			}
			foreach (MonoBehaviourPublicHa1MeObouCoSiouBoprUnique val in outlines)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				((Behaviour)val).enabled = active;
				if (!active)
				{
					continue;
				}
				val.Method_Public_Void_Color_0(color);
				try
				{
					PropertyInfo propertyInfo = typeof(MonoBehaviourPublicHa1MeObouCoSiouBoprUnique).GetProperty("OutlineMode") ?? typeof(MonoBehaviourPublicHa1MeObouCoSiouBoprUnique).GetProperty("outlineMode");
					if (propertyInfo != null)
					{
						object value = Enum.ToObject(propertyInfo.PropertyType, 1);
						propertyInfo.SetValue(val, value);
					}
					else
					{
						FieldInfo fieldInfo = typeof(MonoBehaviourPublicHa1MeObouCoSiouBoprUnique).GetField("OutlineMode") ?? typeof(MonoBehaviourPublicHa1MeObouCoSiouBoprUnique).GetField("outlineMode");
						if (fieldInfo != null)
						{
							object value2 = Enum.ToObject(fieldInfo.FieldType, 1);
							fieldInfo.SetValue(val, value2);
						}
					}
				}
				catch
				{
				}
				float num = ((Component)val).transform.lossyScale.x;
				if (num < 0.01f)
				{
					num = 0.01f;
				}
				float outlineWidth = width;
				if (((Object)((Component)val).gameObject).name.Contains("AntroSkin") || ((Object)((Component)val).transform.root).name.Contains("AntroSkin") || num != 1f)
				{
					outlineWidth = width / Mathf.Sqrt(num) * 3f;
					outlineWidth = Mathf.Clamp(outlineWidth, 5f, 50f);
				}
				val.outlineWidth = outlineWidth;
			}
		}

		private ulong GetMySteamID()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance != (Object)null)
			{
				return MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID;
			}
			return 0uL;
		}
	}
}
namespace Antro.Skins
{
	public static class AccessoryManager
	{
		public static Dictionary<string, string> ActiveAccessories = new Dictionary<string, string>();

		public static readonly string[] AccessoryBones = new string[5] { "Head", "Spine2", "RightShoulder", "LeftShoulder", "Hips" };

		private static Dictionary<string, AssetBundle> _loadedBundles = new Dictionary<string, AssetBundle>();

		private static Dictionary<string, GameObject> _loadedPrefabs = new Dictionary<string, GameObject>();

		public static Dictionary<string, float> SizeTweaks = new Dictionary<string, float>();

		public static string AccessoriesPath => Path.Combine(Paths.PluginPath, "AntroSkins", "Accessories");

		public static void InitFolder()
		{
			if (!Directory.Exists(AccessoriesPath))
			{
				Directory.CreateDirectory(AccessoriesPath);
			}
			string[] accessoryBones = AccessoryBones;
			foreach (string path in accessoryBones)
			{
				string path2 = Path.Combine(AccessoriesPath, path);
				if (!Directory.Exists(path2))
				{
					Directory.CreateDirectory(path2);
				}
			}
		}

		public static List<string> GetAvailableAccessories(string boneName)
		{
			List<string> list = new List<string>();
			string path = Path.Combine(AccessoriesPath, boneName);
			if (Directory.Exists(path))
			{
				string[] files = Directory.GetFiles(path, "*.bundle");
				foreach (string path2 in files)
				{
					list.Add(Path.GetFileName(path2));
				}
			}
			return list;
		}

		public static GameObject GetOrLoadPrefab(string boneName, string bundleName)
		{
			string key = boneName + "_" + bundleName;
			if (_loadedPrefabs.ContainsKey(key))
			{
				if ((Object)(object)_loadedPrefabs[key] != (Object)null)
				{
					return _loadedPrefabs[key];
				}
				_loadedPrefabs.Remove(key);
			}
			string text = Path.Combine(AccessoriesPath, boneName, bundleName);
			if (!File.Exists(text))
			{
				return null;
			}
			if (!_loadedBundles.ContainsKey(key))
			{
				AssetBundle val = AssetBundle.LoadFromFile(text);
				if (val == null)
				{
					return null;
				}
				_loadedBundles[key] = val;
			}
			Il2CppReferenceArray<Object> val2 = _loadedBundles[key].LoadAllAssets(Il2CppType.Of<GameObject>());
			foreach (Object item in (Il2CppArrayBase<Object>)(object)val2)
			{
				GameObject val3 = ((Il2CppObjectBase)item).Cast<GameObject>();
				if ((Object)(object)val3 != (Object)null && (Object)(object)val3.transform.parent == (Object)null)
				{
					Object.DontDestroyOnLoad((Object)(object)val3);
					val3.SetActive(false);
					_loadedPrefabs[key] = val3;
					return val3;
				}
			}
			return null;
		}

		public static void ApplyModels()
		{
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			Il2CppArrayBase<MonoBehaviourPublicObVeSiVeRiSiAnVeanTrUnique> val = Object.FindObjectsOfType<MonoBehaviourPublicObVeSiVeRiSiAnVeanTrUnique>();
			Dictionary<string, string> dictionary = new Dictionary<string, string>
			{
				{ "Head", "head" },
				{ "Spine2", "upperchest" },
				{ "RightShoulder", "shoulderr" },
				{ "LeftShoulder", "shoulderl" },
				{ "Hips", "hips" }
			};
			foreach (MonoBehaviourPublicObVeSiVeRiSiAnVeanTrUnique item in val)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				Transform transform = ((Component)item).transform;
				string[] accessoryBones = AccessoryBones;
				foreach (string text in accessoryBones)
				{
					ActiveAccessories.TryGetValue(text, out var value);
					Transform val2 = null;
					string text2 = dictionary[text];
					foreach (Transform componentsInChild in ((Component)transform).GetComponentsInChildren<Transform>(true))
					{
						if (((Object)componentsInChild).name.ToLower() == text2 && !((Object)componentsInChild).name.StartsWith("AntroSkin_"))
						{
							val2 = componentsInChild;
							break;
						}
					}
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					Transform val3 = null;
					string text3 = "";
					for (int j = 0; j < val2.childCount; j++)
					{
						Transform child = val2.GetChild(j);
						if ((Object)(object)child != (Object)null && ((Object)child).name.StartsWith("AntroAccessory_" + text + "_"))
						{
							val3 = child;
							text3 = ((Object)child).name.Replace("AntroAccessory_" + text + "_", "");
							break;
						}
					}
					if (string.IsNullOrEmpty(value))
					{
						if ((Object)(object)val3 != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)val3).gameObject);
						}
						continue;
					}
					if ((Object)(object)val3 != (Object)null && text3 == value)
					{
						float num = (SizeTweaks.ContainsKey(text + "_" + value) ? SizeTweaks[text + "_" + value] : 1f);
						BoneSynchronizer component = ((Component)val3).GetComponent<BoneSynchronizer>();
						if ((Object)(object)component != (Object)null && BoneSynchronizer.DataMap.TryGetValue(((Il2CppObjectBase)component).Pointer, out var value2))
						{
							value2.BaseScale = new Vector3(num, num, num);
						}
						continue;
					}
					if ((Object)(object)val3 != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val3).gameObject);
					}
					GameObject orLoadPrefab = GetOrLoadPrefab(text, value);
					if (!((Object)(object)orLoadPrefab != (Object)null))
					{
						continue;
					}
					GameObject val4 = Object.Instantiate<GameObject>(orLoadPrefab, val2);
					((Object)val4).name = "AntroAccessory_" + text + "_" + value;
					val4.SetActive(true);
					float num2 = (SizeTweaks.ContainsKey(text + "_" + value) ? SizeTweaks[text + "_" + value] : 1f);
					BoneSynchronizer boneSynchronizer = val4.AddComponent<BoneSynchronizer>();
					SyncData syncData = new SyncData();
					syncData.SkinName = "ACC_" + text + "_" + value;
					syncData.IsAccessory = true;
					syncData.RootTransform = val4.transform;
					syncData.BaseScale = new Vector3(num2, num2, num2);
					BoneSynchronizer.DataMap[((Il2CppObjectBase)boneSynchronizer).Pointer] = syncData;
					foreach (Transform componentsInChild2 in val4.GetComponentsInChildren<Transform>(true))
					{
						if (((Object)componentsInChild2).name.ToLower().Contains("jiggle") && (Object)(object)((Component)componentsInChild2).gameObject.GetComponent<AntroJiggleBone>() == (Object)null)
						{
							((Component)componentsInChild2).gameObject.AddComponent<AntroJiggleBone>();
						}
					}
					Shader shader = Shader.Find("Standard");
					foreach (Renderer componentsInChild3 in val4.GetComponentsInChildren<Renderer>(true))
					{
						foreach (Material item2 in (Il2CppArrayBase<Material>)(object)componentsInChild3.materials)
						{
							if ((Object)(object)item2 != (Object)null)
							{
								item2.shader = shader;
							}
						}
						if ((Object)(object)((Component)componentsInChild3).gameObject.GetComponent<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique>() == (Object)null)
						{
							MonoBehaviourPublicHa1MeObouCoSiouBoprUnique val5 = ((Component)componentsInChild3).gameObject.AddComponent<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique>();
							((Behaviour)val5).enabled = false;
						}
					}
					foreach (Camera componentsInChild4 in val4.GetComponentsInChildren<Camera>(true))
					{
						Object.Destroy((Object)(object)componentsInChild4);
					}
					foreach (AudioListener componentsInChild5 in val4.GetComponentsInChildren<AudioListener>(true))
					{
						Object.Destroy((Object)(object)componentsInChild5);
					}
					foreach (Collider componentsInChild6 in val4.GetComponentsInChildren<Collider>(true))
					{
						Object.Destroy((Object)(object)componentsInChild6);
					}
					foreach (Rigidbody componentsInChild7 in val4.GetComponentsInChildren<Rigidbody>(true))
					{
						Object.Destroy((Object)(object)componentsInChild7);
					}
					foreach (Transform componentsInChild8 in val4.GetComponentsInChildren<Transform>(true))
					{
						if (((Object)componentsInChild8).name.ToLower().Contains("jiggle") && (Object)(object)((Component)componentsInChild8).gameObject.GetComponent<AntroJiggleBone>() == (Object)null)
						{
							((Component)componentsInChild8).gameObject.AddComponent<AntroJiggleBone>();
						}
					}
				}
			}
		}
	}
	public class AntroJiggleBone : MonoBehaviour
	{
		private Quaternion _origLocalRot;

		private Vector3 _velocity;

		private Vector3 _dynamicPos;

		private bool _initialized = false;

		public AntroJiggleBone(IntPtr ptr)
			: base(ptr)
		{
		}

		private void Awake()
		{
			//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_0019: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			_origLocalRot = ((Component)this).transform.localRotation;
			_dynamicPos = ((Component)this).transform.position + ((Component)this).transform.up;
			_initialized = true;
		}

		private void LateUpdate()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			if (!_initialized || !ConfigManager.JiggleEnabled.Value || (Object)(object)((Component)this).transform.parent == (Object)null)
			{
				((Component)this).transform.localRotation = _origLocalRot;
				return;
			}
			Vector3 val = ((Component)this).transform.position + ((Component)this).transform.parent.rotation * _origLocalRot * Vector3.up;
			if (Vector3.Distance(_dynamicPos, val) > 5f)
			{
				_dynamicPos = val;
				_velocity = Vector3.zero;
			}
			Vector3 val2 = (val - _dynamicPos) * ConfigManager.JiggleStiffness.Value;
			_velocity = (_velocity + val2) * ConfigManager.JiggleDamping.Value;
			_dynamicPos += _velocity * Time.deltaTime;
			Vector3 val3 = _dynamicPos - ((Component)this).transform.position;
			if (((Vector3)(ref val3)).sqrMagnitude > 0.001f)
			{
				((Component)this).transform.rotation = Quaternion.FromToRotation(Vector3.up, val3) * (((Component)this).transform.parent.rotation * _origLocalRot);
			}
		}
	}
	public class SyncData
	{
		public string SkinName;

		public bool IsStuff = false;

		public bool IsLocalPlayer = false;

		public Vector3 BaseScale = Vector3.one;

		public bool IsAccessory = false;

		public Transform RootTransform;

		public Transform OriginalHips;

		public Transform CustomHips;

		public Transform OriginalRightHand;

		public Transform CustomRightHand;

		public List<Transform> CustomBones = new List<Transform>();

		public List<Transform> OriginalBones = new List<Transform>();

		public Dictionary<string, Transform> AllCustomTransforms = new Dictionary<string, Transform>();

		public Dictionary<string, Vector3> InitialLocalPositions = new Dictionary<string, Vector3>();

		public Dictionary<string, Quaternion> InitialLocalRotations = new Dictionary<string, Quaternion>();

		private bool _isCached = false;

		private Transform[] _staticTransforms;

		private Vector3[] _staticPositions;

		private Quaternion[] _staticRotations;

		private Transform _cRightArm;

		private Transform _cRightForeArm;

		private Transform _cLeftArm;

		private Transform _cLeftForeArm;

		private Transform _cLeftHand;

		private Transform _oLeftHand;

		private Vector3 GetDefaultPos(string bone)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.zero;
		}

		private Vector3 GetDefaultRot(string bone)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.zero;
		}

		public void InvalidateCache()
		{
			_isCached = false;
		}

		private void BuildCache()
		{
			//IL_0093: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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)
			SkinConfig skinConfig = SkinsMenu.GetSkinConfig(SkinName);
			List<Transform> list = new List<Transform>();
			List<Vector3> list2 = new List<Vector3>();
			List<Quaternion> list3 = new List<Quaternion>();
			foreach (KeyValuePair<string, Transform> allCustomTransform in AllCustomTransforms)
			{
				string key = allCustomTransform.Key;
				Transform value = allCustomTransform.Value;
				if ((Object)(object)value != (Object)null && (Object)(object)value != (Object)(object)CustomHips)
				{
					if (!skinConfig.BoneRotOffsets.ContainsKey(key))
					{
						skinConfig.BoneRotOffsets[key] = GetDefaultRot(key);
					}
					if (!skinConfig.BonePosOffsets.ContainsKey(key))
					{
						skinConfig.BonePosOffsets[key] = GetDefaultPos(key);
					}
					Vector3 val = skinConfig.BoneRotOffsets[key];
					Vector3 val2 = skinConfig.BonePosOffsets[key];
					Quaternion val3 = Quaternion.Euler(val);
					Vector3 item = InitialLocalPositions[key] + val2;
					if (!CustomBones.Contains(value))
					{
						val3 = InitialLocalRotations[key] * val3;
					}
					list.Add(value);
					list2.Add(item);
					list3.Add(val3);
				}
			}
			_staticTransforms = list.ToArray();
			_staticPositions = list2.ToArray();
			_staticRotations = list3.ToArray();
			AllCustomTransforms.TryGetValue("RightArm", out _cRightArm);
			AllCustomTransforms.TryGetValue("RightForeArm", out _cRightForeArm);
			AllCustomTransforms.TryGetValue("LeftArm", out _cLeftArm);
			AllCustomTransforms.TryGetValue("LeftForeArm", out _cLeftForeArm);
			AllCustomTransforms.TryGetValue("LeftHand", out _cLeftHand);
			if ((Object)(object)_cLeftHand != (Object)null)
			{
				int num = CustomBones.IndexOf(_cLeftHand);
				if (num != -1 && num < OriginalBones.Count)
				{
					_oLeftHand = OriginalBones[num];
				}
			}
			_isCached = true;
		}

		public void Sync()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_016e: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: 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_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: 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_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: 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_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_0696: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: 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_057d: Unknown result type (might be due to invalid IL or missing references)
			if (!_isCached)
			{
				BuildCache();
			}
			SkinConfig skinConfig = SkinsMenu.GetSkinConfig(SkinName);
			if (IsStuff)
			{
				if (!((Object)(object)RootTransform != (Object)null))
				{
					return;
				}
				Il2CppArrayBase<Renderer> componentsInChildren = ((Component)RootTransform).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer item in componentsInChildren)
				{
					if (!item.enabled)
					{
						item.enabled = true;
					}
				}
				Vector3 localPosition = Vector3.zero;
				Vector3 val = Vector3.zero;
				if (IsLocalPlayer && skinConfig.EnableViewModel)
				{
					localPosition = skinConfig.VMPos;
					val = skinConfig.VMRot;
					RootTransform.localScale = BaseScale * skinConfig.VMScale;
				}
				else
				{
					if (skinConfig.BonePosOffsets.ContainsKey("Hips"))
					{
						localPosition = skinConfig.BonePosOffsets["Hips"];
					}
					if (skinConfig.BoneRotOffsets.ContainsKey("Hips"))
					{
						val = skinConfig.BoneRotOffsets["Hips"];
					}
					RootTransform.localScale = BaseScale;
				}
				localPosition.y += skinConfig.GlobalHeightOffset;
				RootTransform.localPosition = localPosition;
				RootTransform.localRotation = Quaternion.Euler(val);
			}
			else if (IsAccessory)
			{
				if (!((Object)(object)RootTransform != (Object)null))
				{
					return;
				}
				Il2CppArrayBase<Renderer> componentsInChildren2 = ((Component)RootTransform).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer item2 in componentsInChildren2)
				{
					if (!item2.enabled)
					{
						item2.enabled = true;
					}
				}
				Vector3 localPosition2 = (skinConfig.BonePosOffsets.ContainsKey("Root") ? skinConfig.BonePosOffsets["Root"] : Vector3.zero);
				localPosition2.y += skinConfig.GlobalHeightOffset;
				Vector3 val2 = (skinConfig.BoneRotOffsets.ContainsKey("Root") ? skinConfig.BoneRotOffsets["Root"] : Vector3.zero);
				RootTransform.localPosition = localPosition2;
				RootTransform.localRotation = Quaternion.Euler(val2);
				RootTransform.localScale = BaseScale;
			}
			else
			{
				if ((Object)(object)OriginalHips == (Object)null || (Object)(object)CustomHips == (Object)null)
				{
					return;
				}
				float globalHeightOffset = skinConfig.GlobalHeightOffset;
				bool flag = true;
				if ((Object)(object)Camera.main != (Object)null && (Object)(object)RootTransform != (Object)null)
				{
					float num = Vector3.Distance(((Component)Camera.main).transform.position, OriginalHips.position);
					if (num > 35f)
					{
						flag = false;
					}
				}
				if ((Object)(object)RootTransform != (Object)null)
				{
					RootTransform.localPosition = new Vector3(0f, globalHeightOffset, 0f);
				}
				if (!skinConfig.BonePosOffsets.ContainsKey("Hips"))
				{
					skinConfig.BonePosOffsets["Hips"] = GetDefaultPos("Hips");
				}
				if (!skinConfig.BoneRotOffsets.ContainsKey("Hips"))
				{
					skinConfig.BoneRotOffsets["Hips"] = GetDefaultRot("Hips");
				}
				Vector3 position = OriginalHips.position;
				if ((Object)(object)RootTransform != (Object)null && (Object)(object)RootTransform.parent != (Object)null)
				{
					position += RootTransform.parent.TransformDirection(skinConfig.BonePosOffsets["Hips"]);
					position += RootTransform.parent.up * globalHeightOffset;
				}
				else
				{
					position += skinConfig.BonePosOffsets["Hips"];
					position += Vector3.up * globalHeightOffset;
				}
				CustomHips.position = position;
				CustomHips.rotation = OriginalHips.rotation * Quaternion.Euler(skinConfig.BoneRotOffsets["Hips"]);
				if (flag)
				{
					for (int i = 0; i < CustomBones.Count; i++)
					{
						if (!((Object)(object)CustomBones[i] == (Object)(object)CustomHips) && (Object)(object)CustomBones[i] != (Object)null && (Object)(object)OriginalBones[i] != (Object)null)
						{
							string text = ((Object)OriginalBones[i]).name.ToLower();
							if (text.Contains("arm") || text.Contains("hand") || text.Contains("shoulder"))
							{
								CustomBones[i].rotation = OriginalBones[i].rotation;
							}
							else
							{
								CustomBones[i].localRotation = OriginalBones[i].localRotation;
							}
						}
					}
				}
				for (int j = 0; j < _staticTransforms.Length; j++)
				{
					Transform val3 = _staticTransforms[j];
					if (!((Object)(object)val3 != (Object)null && flag))
					{
						continue;
					}
					if (!CustomBones.Contains(val3))
					{
						val3.localRotation = _staticRotations[j];
					}
					else
					{
						val3.localRotation *= _staticRotations[j];
					}
					if (!((Object)val3).name.ToLower().Contains("hand"))
					{
						if ((Object)(object)val3 == (Object)(object)RootTransform)
						{
							val3.localPosition = _staticPositions[j] + new Vector3(0f, globalHeightOffset, 0f);
						}
						else
						{
							val3.localPosition = _staticPositions[j];
						}
					}
				}
				if (flag)
				{
					ApplyTwoBoneIK(_cRightArm, _cRightForeArm, CustomRightHand, OriginalRightHand, skinConfig);
					ApplyTwoBoneIK(_cLeftArm, _cLeftForeArm, _cLeftHand, _oLeftHand, skinConfig);
				}
			}
		}

		private void ApplyTwoBoneIK(Transform upper, Transform lower, Transform hand, Transform origHand, SkinConfig config)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if ((Object)(object)upper == (Object)null || (Object)(object)lower == (Object)null || (Object)(object)hand == (Object)null || (Object)(object)origHand == (Object)null)
			{
				return;
			}
			Vector3 val = origHand.position;
			string key = SkinManager.CleanBoneName(((Object)hand).name);
			if (config.BonePosOffsets.ContainsKey(key))
			{
				Vector3 val2 = config.BonePosOffsets[key];
				if (val2 != Vector3.zero)
				{
					val += origHand.rotation * val2;
				}
			}
			for (int i = 0; i < 10; i++)
			{
				Vector3 val3 = hand.position - lower.position;
				Vector3 val4 = val - lower.position;
				if (((Vector3)(ref val3)).sqrMagnitude > 0.0001f && ((Vector3)(ref val4)).sqrMagnitude > 0.0001f)
				{
					lower.rotation = Quaternion.FromToRotation(val3, val4) * lower.rotation;
				}
				Vector3 val5 = hand.position - upper.position;
				Vector3 val6 = val - upper.position;
				if (((Vector3)(ref val5)).sqrMagnitude > 0.0001f && ((Vector3)(ref val6)).sqrMagnitude > 0.0001f)
				{
					upper.rotation = Quaternion.FromToRotation(val5, val6) * upper.rotation;
				}
			}
			hand.rotation = origHand.rotation;
			if (config.BoneRotOffsets.ContainsKey(key))
			{
				Vector3 val7 = config.BoneRotOffsets[key];
				if (val7 != Vector3.zero)
				{
					hand.rotation *= Quaternion.Euler(val7);
				}
			}
		}
	}
	public class BoneSynchronizer : MonoBehaviour
	{
		public static Dictionary<IntPtr, SyncData> DataMap = new Dictionary<IntPtr, SyncData>();

		public BoneSynchronizer(IntPtr ptr)
			: base(ptr)
		{
		}

		public static void ForceRecalculateAll()
		{
			foreach (SyncData value in DataMap.Values)
			{
				value.InvalidateCache();
			}
		}

		public void LateUpdate()
		{
			SyncData value = null;
			if (DataMap.TryGetValue(((Il2CppObjectBase)this).Pointer, out value))
			{
				value.Sync();
			}
		}

		public void OnDestroy()
		{
			DataMap.Remove(((Il2CppObjectBase)this).Pointer);
		}
	}
	public static class ConfigManager
	{
		public static ConfigEntry<KeyCode> MenuKey;

		public static ConfigEntry<bool> RememberState;

		public static ConfigEntry<string> SavedMode;

		public static ConfigEntry<string> SavedSingleSkin;

		public static ConfigEntry<string> DisabledSkinsStr;

		public static ConfigEntry<string> StuffModeStr;

		public static ConfigEntry<string> StuffSkinsStr;

		public static ConfigEntry<string> DisabledStuffStr;

		public static ConfigEntry<string> DisabledStuffSkinsStr;

		public static ConfigEntry<string> AccSizeTweaksStr;

		public static ConfigEntry<bool> AutoScaleSettings;

		public static ConfigEntry<string> SizeTweaksStr;

		public static ConfigEntry<bool> JiggleEnabled;

		public static ConfigEntry<float> JiggleStiffness;

		public static ConfigEntry<float> JiggleDamping;

		public static ConfigEntry<string> ActiveAccessoriesStr;

		private static ConfigFile _config;

		public static string PresetsFolder => Path.Combine(Paths.ConfigPath, "AntroSkinsPresets");

		public static void Init(ConfigFile config)
		{
			_config = config;
			if (!Directory.Exists(PresetsFolder))
			{
				Directory.CreateDirectory(PresetsFolder);
			}
			MenuKey = config.Bind<KeyCode>("General", "MenuKey", (KeyCode)287, "Key to open Skins Menu");
			RememberState = config.Bind<bool>("Settings", "RememberState", false, "Remember active skins between sessions");
			SavedMode = config.Bind<string>("Settings", "SavedMode", "None", "Last active mode");
			SavedSingleSkin = config.Bind<string>("Settings", "SavedSingleSkin", "", "Last selected single skin");
			DisabledSkinsStr = config.Bind<string>("Settings", "DisabledSkins", "", "Skins excluded from Random");
			StuffModeStr = config.Bind<string>("Settings", "StuffMode", "None", "Last stuff mode");
			StuffSkinsStr = config.Bind<string>("Settings", "StuffSkins", "", "Saved stuff skins dictionary");
			DisabledStuffStr = config.Bind<string>("Settings", "DisabledStuff", "", "Stuff categories excluded from Random");
			DisabledStuffSkinsStr = config.Bind<string>("Settings", "DisabledStuffSkins", "", "Specific stuff skins excluded from Random");
			AccSizeTweaksStr = config.Bind<string>("Settings", "AccSizeTweaks", "", "Custom scale for accessories");
			AutoScaleSettings = config.Bind<bool>("Settings", "AutoScale", true, "Auto scale stuff to match vanilla");
			SizeTweaksStr = config.Bind<string>("Settings", "SizeTweaks", "", "Custom scale multipliers");
			JiggleEnabled = config.Bind<bool>("Physics", "JiggleEnabled", true, "Enable jiggle physics on bones with 'jiggle' in name");
			JiggleStiffness = config.Bind<float>("Physics", "JiggleStiffness", 15f, "Jiggle spring stiffness");
			JiggleDamping = config.Bind<float>("Physics", "JiggleDamping", 0.8f, "Jiggle spring damping");
			ActiveAccessoriesStr = config.Bind<string>("Settings", "ActiveAccessories", "", "Currently equipped accessories");
			LoadSettings();
		}

		public static void LoadSettings()
		{
			if (RememberState.Value)
			{
				LoadPreset("_AutoSave");
			}
		}

		public static void SaveSettings()
		{
			if (RememberState.Value)
			{
				SavePreset("_AutoSave");
			}
		}

		public static void SavePreset(string name)
		{
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: 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)
			string path = Path.Combine(PresetsFolder, name + ".txt");
			using StreamWriter streamWriter = new StreamWriter(path);
			streamWriter.WriteLine("[MODES]");
			streamWriter.WriteLine("PlayerMode=" + SkinManager.CurrentMode);
			streamWriter.WriteLine("PlayerSingle=" + SkinManager.GlobalSelectedSkin);
			streamWriter.WriteLine("StuffMode=" + StuffManager.CurrentMode);
			streamWriter.WriteLine("Disabled=" + string.Join("|", SkinManager.DisabledSkins));
			streamWriter.WriteLine("DisabledStuff=" + string.Join("|", StuffManager.DisabledRandomTypes));
			streamWriter.WriteLine("DisabledStuffSkins=" + string.Join("|", StuffManager.DisabledRandomStuffSkins));
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, float> sizeTweak in StuffManager.SizeTweaks)
			{
				list.Add(sizeTweak.Key + "=" + sizeTweak.Value.ToString("F3", CultureInfo.InvariantCulture));
			}
			streamWriter.WriteLine("SizeTweaks=" + string.Join("|", list));
			streamWriter.WriteLine("");
			List<string> list2 = new List<string>();
			foreach (KeyValuePair<string, float> sizeTweak2 in AccessoryManager.SizeTweaks)
			{
				list2.Add(sizeTweak2.Key + "=" + sizeTweak2.Value.ToString("F3", CultureInfo.InvariantCulture));
			}
			streamWriter.WriteLine("AccSizeTweaks=" + string.Join("|", list2.ToArray()));
			streamWriter.WriteLine("[PHYSICS]");
			streamWriter.WriteLine($"JiggleEnabled={JiggleEnabled.Value}");
			streamWriter.WriteLine("JiggleStiffness=" + JiggleStiffness.Value.ToString("F2", CultureInfo.InvariantCulture));
			streamWriter.WriteLine("JiggleDamping=" + JiggleDamping.Value.ToString("F2", CultureInfo.InvariantCulture));
			streamWriter.WriteLine("");
			streamWriter.WriteLine("[ACCESSORIES]");
			foreach (KeyValuePair<string, string> activeAccessory in AccessoryManager.ActiveAccessories)
			{
				streamWriter.WriteLine(activeAccessory.Key + "=" + activeAccessory.Value);
			}
			streamWriter.WriteLine("");
			streamWriter.WriteLine("[STUFF]");
			foreach (KeyValuePair<string, string> activeSkin in StuffManager.ActiveSkins)
			{
				streamWriter.WriteLine(activeSkin.Key + "=" + activeSkin.Value);
			}
			streamWriter.WriteLine("");
			foreach (KeyValuePair<string, SkinConfig> skinConfig in SkinsMenu.SkinConfigs)
			{
				streamWriter.WriteLine("[SKIN_" + skinConfig.Key + "]");
				streamWriter.WriteLine("Height=" + skinConfig.Value.GlobalHeightOffset.ToString("F3", CultureInfo.InvariantCulture));
				streamWriter.WriteLine($"VM={skinConfig.Value.EnableViewModel}");
				streamWriter.WriteLine("VMP=" + skinConfig.Value.VMPos.x.ToString("F3", CultureInfo.InvariantCulture) + "," + skinConfig.Value.VMPos.y.ToString("F3", CultureInfo.InvariantCulture) + "," + skinConfig.Value.VMPos.z.ToString("F3", CultureInfo.InvariantCulture));
				streamWriter.WriteLine("VMR=" + skinConfig.Value.VMRot.x.ToString("F3", CultureInfo.InvariantCulture) + "," + skinConfig.Value.VMRot.y.ToString("F3", CultureInfo.InvariantCulture) + "," + skinConfig.Value.VMRot.z.ToString("F3", CultureInfo.InvariantCulture));
				streamWriter.WriteLine("VMS=" + skinConfig.Value.VMScale.ToString("F3", CultureInfo.InvariantCulture));
				foreach (KeyValuePair<string, Vector3> bonePosOffset in skinConfig.Value.BonePosOffsets)
				{
					if (bonePosOffset.Value != Vector3.zero || bonePosOffset.Key == "Hips")
					{
						streamWriter.WriteLine("P_" + bonePosOffset.Key + "=" + bonePosOffset.Value.x.ToString("F3", CultureInfo.InvariantCulture) + "," + bonePosOffset.Value.y.ToString("F3", CultureInfo.InvariantCulture) + "," + bonePosOffset.Value.z.ToString("F3", CultureInfo.InvariantCulture));
					}
				}
				foreach (KeyValuePair<string, Vector3> boneRotOffset in skinConfig.Value.BoneRotOffsets)
				{
					if (boneRotOffset.Value != Vector3.zero || boneRotOffset.Key == "Hips")
					{
						streamWriter.WriteLine("R_" + boneRotOffset.Key + "=" + boneRotOffset.Value.x.ToString("F3", CultureInfo.InvariantCulture) + "," + boneRotOffset.Value.y.ToString("F3", CultureInfo.InvariantCulture) + "," + boneRotOffset.Value.z.ToString("F3", CultureInfo.InvariantCulture));
					}
				}
				streamWriter.WriteLine("");
			}
		}

		public static void LoadPreset(string name)
		{
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: 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_0676: Unknown result type (might be due to invalid IL or missing references)
			string path = Path.Combine(PresetsFolder, name + ".txt");
			if (!File.Exists(path))
			{
				return;
			}
			string[] array = File.ReadAllLines(path);
			string text = "";
			SkinConfig skinConfig = null;
			StuffManager.ActiveSkins.Clear();
			StuffManager.SizeTweaks.Clear();
			AccessoryManager.ActiveAccessories.Clear();
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				string text3 = text2.Trim();
				if (string.IsNullOrWhiteSpace(text3))
				{
					continue;
				}
				if (text3.StartsWith("[SKIN_"))
				{
					string skinName = text3.Substring(6, text3.Length - 7);
					skinConfig = SkinsMenu.GetSkinConfig(skinName);
					text = "SKIN_NEW";
					continue;
				}
				if (text3.StartsWith("["))
				{
					text = text3;
					continue;
				}
				switch (text)
				{
				case "[MODES]":
				{
					string[] array8 = text3.Split(new char[1] { '=' }, 2);
					if (array8.Length != 2)
					{
						break;
					}
					if (array8[0] == "PlayerMode" && Enum.TryParse<SkinManager.SkinMode>(array8[1], out var result))
					{
						SkinManager.CurrentMode = result;
					}
					if (array8[0] == "PlayerSingle")
					{
						SkinManager.GlobalSelectedSkin = array8[1];
					}
					if (array8[0] == "StuffMode" && Enum.TryParse<StuffManager.StuffMode>(array8[1], out var result2))
					{
						StuffManager.CurrentMode = result2;
					}
					if (array8[0] == "Disabled")
					{
						SkinManager.DisabledSkins = new HashSet<string>(array8[1].Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries));
					}
					if (array8[0] == "DisabledStuff")
					{
						StuffManager.DisabledRandomTypes = new HashSet<string>(array8[1].Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries));
					}
					if (array8[0] == "DisabledStuffSkins")
					{
						StuffManager.DisabledRandomStuffSkins = new HashSet<string>(array8[1].Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries));
					}
					if (array8[0] == "SizeTweaks" && !string.IsNullOrEmpty(array8[1]))
					{
						string[] array9 = array8[1].Split(new char[1] { '|' });
						foreach (string text4 in array9)
						{
							string[] array10 = text4.Split(new char[1] { '=' });
							if (array10.Length == 2 && float.TryParse(array10[1], NumberStyles.Any, CultureInfo.InvariantCulture, out var result3))
							{
								StuffManager.SizeTweaks[array10[0]] = result3;
							}
						}
					}
					if (!(array8[0] == "AccSizeTweaks") || string.IsNullOrEmpty(array8[1]))
					{
						break;
					}
					string[] array11 = array8[1].Split(new char[1] { '|' });
					foreach (string text5 in array11)
					{
						string[] array12 = text5.Split(new char[1] { '=' });
						if (array12.Length == 2 && float.TryParse(array12[1], NumberStyles.Any, CultureInfo.InvariantCulture, out var result4))
						{
							AccessoryManager.SizeTweaks[array12[0]] = result4;
						}
					}
					break;
				}
				case "[PHYSICS]":
				{
					string[] array5 = text3.Split(new char[1] { '=' }, 2);
					if (array5.Length == 2)
					{
						if (array5[0] == "JiggleEnabled")
						{
							JiggleEnabled.Value = bool.Parse(array5[1]);
						}
						if (array5[0] == "JiggleStiffness")
						{
							JiggleStiffness.Value = float.Parse(array5[1], CultureInfo.InvariantCulture);
						}
						if (array5[0] == "JiggleDamping")
						{
							JiggleDamping.Value = float.Parse(array5[1], CultureInfo.InvariantCulture);
						}
					}
					break;
				}
				case "[ACCESSORIES]":
				{
					string[] array7 = text3.Split(new char[1] { '=' }, 2);
					if (array7.Length == 2)
					{
						AccessoryManager.ActiveAccessories[array7[0]] = array7[1];
					}
					break;
				}
				case "[STUFF]":
				{
					string[] array6 = text3.Split(new char[1] { '=' }, 2);
					if (array6.Length == 2)
					{
						StuffManager.ActiveSkins[array6[0]] = array6[1];
					}
					break;
				}
				case "SKIN_NEW":
					if (skinConfig == null)
					{
						break;
					}
					if (text3.StartsWith("Height="))
					{
						float.TryParse(text3.Substring(7), NumberStyles.Any, CultureInfo.InvariantCulture, out skinConfig.GlobalHeightOffset);
					}
					else if (text3.StartsWith("VM="))
					{
						skinConfig.EnableViewModel = bool.Parse(text3.Substring(3));
					}
					else if (text3.StartsWith("VMP="))
					{
						skinConfig.VMPos = ParseVector(text3.Substring(4));
					}
					else if (text3.StartsWith("VMR="))
					{
						skinConfig.VMRot = ParseVector(text3.Substring(4));
					}
					else if (text3.StartsWith("VMS="))
					{
						float.TryParse(text3.Substring(4), NumberStyles.Any, CultureInfo.InvariantCulture, out skinConfig.VMScale);
					}
					else if (text3.StartsWith("P_"))
					{
						string[] array3 = text3.Substring(2).Split(new char[1] { '=' });
						if (array3.Length == 2)
						{
							skinConfig.BonePosOffsets[array3[0]] = ParseVector(array3[1]);
						}
					}
					else if (text3.StartsWith("R_"))
					{
						string[] array4 = text3.Substring(2).Split(new char[1] { '=' });
						if (array4.Length == 2)
						{
							skinConfig.BoneRotOffsets[array4[0]] = ParseVector(array4[1]);
						}
					}
					break;
				}
			}
			SkinManager.FastUpdateNextFrame = true;
			BoneSynchronizer.ForceRecalculateAll();
		}

		private static Vector3 ParseVector(string data)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			string[] array = data.Split(new char[1] { ',' });
			if (array.Length == 3 && float.TryParse(array[0], NumberStyles.Any, CultureInfo.InvariantCulture, out var result) && float.TryParse(array[1], NumberStyles.Any, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array[2], NumberStyles.Any, CultureInfo.InvariantCulture, out var result3))
			{
				return new Vector3(result, result2, result3);
			}
			return Vector3.zero;
		}
	}
	[BepInPlugin("Antro.Skins", "Antro Client Avatars", "1.6.0")]
	public class Plugin : BasePlugin
	{
		public static Plugin Instance { get; private set; }

		public override void Load()
		{
			Instance = this;
			SkinManager.InitFolders();
			AccessoryManager.InitFolder();
			ConfigManager.Init(((BasePlugin)this).Config);
			ClassInjector.RegisterTypeInIl2Cpp<SkinsMenu>();
			ClassInjector.RegisterTypeInIl2Cpp<BoneSynchronizer>();
			ClassInjector.RegisterTypeInIl2Cpp<AntroRendererHider>();
			ClassInjector.RegisterTypeInIl2Cpp<AntroJiggleBone>();
			Harmony.CreateAndPatchAll(typeof(Patches), (string)null);
			SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)delegate
			{
				SkinManager.ForceReshuffle = true;
				SkinManager.FastUpdateNextFrame = true;
			});
			((BasePlugin)this).Log.LogInfo((object)"Antro Client Avatars 1.6.0 Loaded! Jiggle & Accessories Active!");
		}
	}
	internal static class Patches
	{
		[HarmonyPatch(typeof(MonoBehaviourPublicObInVoAwVoVoVoVoVoVoUnique), "Awake")]
		[HarmonyPostfix]
		public static void SpawnSystem()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			if ((Object)(object)GameObject.Find("AntroSkinsSystem") == (Object)null)
			{
				GameObject val = new GameObject("AntroSkinsSystem");
				Object.DontDestroyOnLoad((Object)(object)val);
				val.AddComponent<SkinsMenu>();
			}
		}

		[HarmonyPatch(typeof(MonoBehaviourPublicObVeSiVeRiSiAnVeanTrUnique), "Start")]
		[HarmonyPostfix]
		public static void OnPlayerSpawn()
		{
			SkinManager.FastUpdateNextFrame = true;
		}
	}
	public static class SkinManager
	{
		public enum SkinMode
		{
			None,
			Single,
			Random
		}

		public static SkinMode CurrentMode = SkinMode.None;

		public static string GlobalSelectedSkin = "";

		public static bool ForceReshuffle = false;

		public static bool FastUpdateNextFrame = false;

		public static HashSet<string> DisabledSkins = new HashSet<string>();

		public static Dictionary<ulong, string> PersistentRandomSkins = new Dictionary<ulong, string>();

		private static Dictionary<string, AssetBundle> _loadedBundles = new Dictionary<string, AssetBundle>();

		private static Dictionary<string, GameObject> _loadedPrefabs = new Dictionary<string, GameObject>();

		private static Dictionary<string, string> ExactMixamoToCrab = new Dictionary<string, string>
		{
			{ "Hips", "hips" },
			{ "Spine", "spine" },
			{ "Spine1", "chest" },
			{ "Spine2", "upperchest" },
			{ "Neck", "neck" },
			{ "Head", "head" },
			{ "LeftShoulder", "shoulderl" },
			{ "LeftArm", "upperarml" },
			{ "LeftForeArm", "lowerarml" },
			{ "LeftHand", "handl" },
			{ "RightShoulder", "shoulderr" },
			{ "RightArm", "upperarmr" },
			{ "RightForeArm", "lowerarmr" },
			{ "RightHand", "handr" },
			{ "LeftUpLeg", "legl" },
			{ "LeftLeg", "footl" },
			{ "LeftFoot", "toel" },
			{ "RightUpLeg", "legr" },
			{ "RightLeg", "footr" },
			{ "RightFoot", "toer" }
		};

		private static string BasePath => Path.Combine(Paths.PluginPath, "AntroSkins");

		private static string PlayersPath => Path.Combine(BasePath, "Players");

		private static string NormalizeName(string name)
		{
			return name.ToLower().Replace(" ", "").Replace(".", "")
				.Replace("_", "");
		}

		public static string CleanBoneName(string name)
		{
			return name.Replace("mixamorig:", "").Replace(":", "_").Replace("/", "_")
				.Replace("|", "_");
		}

		public static void InitFolders()
		{
			if (!Directory.Exists(BasePath))
			{
				Directory.CreateDirectory(BasePath);
			}
			if (!Directory.Exists(PlayersPath))
			{
				Directory.CreateDirectory(PlayersPath);
			}
			StuffManager.InitFolder();
		}

		public static List<string> GetAvailableSkins()
		{
			List<string> list = new List<string>();
			if (Directory.Exists(PlayersPath))
			{
				string[] files = Directory.GetFiles(PlayersPath, "*.bundle");
				foreach (string path in files)
				{
					list.Add(Path.GetFileName(path));
				}
			}
			return list;
		}

		public static GameObject GetOrLoadPrefab(string skinName)
		{
			if (_loadedPrefabs.ContainsKey(skinName))
			{
				if ((Object)(object)_loadedPrefabs[skinName] != (Object)null)
				{
					return _loadedPrefabs[skinName];
				}
				_loadedPrefabs.Remove(skinName);
			}
			string text = Path.Combine(PlayersPath, skinName);
			if (!File.Exists(text))
			{
				return null;
			}
			if (!_loadedBundles.ContainsKey(skinName))
			{
				AssetBundle val = AssetBundle.LoadFromFile(text);
				if (val == null)
				{
					return null;
				}
				_loadedBundles[skinName] = val;
			}
			Il2CppReferenceArray<Object> val2 = _loadedBundles[skinName].LoadAllAssets(Il2CppType.Of<GameObject>());
			foreach (Object item in (Il2CppArrayBase<Object>)(object)val2)
			{
				GameObject val3 = ((Il2CppObjectBase)item).Cast<GameObject>();
				if ((Object)(object)val3 != (Object)null && (Object)(object)val3.transform.parent == (Object)null)
				{
					Object.DontDestroyOnLoad((Object)(object)val3);
					val3.SetActive(false);
					_loadedPrefabs[skinName] = val3;
					return val3;
				}
			}
			return null;
		}

		public static void DisableAll()
		{
			CurrentMode = SkinMode.None;
			GlobalSelectedSkin = "";
			PersistentRandomSkins.Clear();
			ApplyModels();
		}

		public static void ApplySingleSkin(string skinName)
		{
			GlobalSelectedSkin = skinName;
			CurrentMode = SkinMode.Single;
			ApplyModels();
		}

		public static void ApplyRandomSkins()
		{
			CurrentMode = SkinMode.Random;
			ForceReshuffle = true;
			PersistentRandomSkins.Clear();
			ApplyModels();
		}

		private static void SetLayerRecursively(GameObject obj, int newLayer)
		{
			if (!((Object)(object)obj == (Object)null))
			{
				obj.layer = newLayer;
				for (int i = 0; i < obj.transform.childCount; i++)
				{
					SetLayerRecursively(((Component)obj.transform.GetChild(i)).gameObject, newLayer);
				}
			}
		}

		private static Bounds GetModelBounds(GameObject obj)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] array = Il2CppArrayBase<Renderer>.op_Implicit(obj.GetComponentsInChildren<Renderer>());
			Bounds bounds = default(Bounds);
			((Bounds)(ref bounds))..ctor(obj.transform.position, Vector3.zero);
			bool flag = false;
			Renderer[] array2 = array;
			foreach (Renderer val in array2)
			{
				bool flag2 = false;
				Transform val2 = ((Component)val).transform;
				while ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)obj.transform)
				{
					if (((Object)val2).name.StartsWith("AntroAccessory_") || ((Object)val2).name.StartsWith("AntroSkin_"))
					{
						flag2 = true;
						break;
					}
					val2 = val2.parent;
				}
				if (!flag2)
				{
					if (!flag)
					{
						bounds = val.bounds;
						flag = true;
					}
					else
					{
						((Bounds)(ref bounds)).Encapsulate(val.bounds);
					}
				}
			}
			return bounds;
		}

		private static void UpdateVanillaVisibility(Transform originalVisuals, Transform playerRoot, bool hideBody)
		{
			Il2CppArrayBase<Renderer> componentsInChildren = ((Component)originalVisuals).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer item in componentsInChildren)
			{
				if ((Object)(object)item == (Object)null || ((Object)((Component)item).gameObject).name.StartsWith("AntroSkin_"))
				{
					continue;
				}
				bool flag = !hideBody;
				if (hideBody)
				{
					Transform val = ((Component)item).transform;
					while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)playerRoot.parent)
					{
						string text = ((Object)val).name.ToLower();
						if (text.Contains("crown") || text.Contains("handr") || text.Contains("handl") || text.Contains("righthand") || text.Contains("lefthand") || text.Contains("weaponpivot"))
						{
							flag = true;
							break;
						}
						val = val.parent;
					}
				}
				if (flag)
				{
					AntroRendererHider component = ((Component)item).GetComponent<AntroRendererHider>();
					if ((Object)(object)component != (Object)null)
					{
						((Behaviour)component).enabled = false;
						Object.Destroy((Object)(object)component);
					}
					item.enabled = true;
				}
				else
				{
					item.enabled = false;
					if ((Object)(object)((Component)item).gameObject.GetComponent<AntroRendererHider>() == (Object)null)
					{
						((Component)item).gameObject.AddComponent<AntroRendererHider>();
					}
				}
			}
		}

		public static void ApplyModels()
		{
			//IL_018c: 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_05aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: 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_06b6: 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_06cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: 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_08c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08da: Unknown result type (might be due to invalid IL or missing references)
			Il2CppArrayBase<MonoBehaviourPublicObVeSiVeRiSiAnVeanTrUnique> val = Object.FindObjectsOfType<MonoBehaviourPublicObVeSiVeRiSiAnVeanTrUnique>();
			List<string> availableSkins = GetAvailableSkins();
			List<string> list = new List<string>();
			foreach (string item in availableSkins)
			{
				if (!DisabledSkins.Contains(item))
				{
					list.Add(item);
				}
			}
			foreach (MonoBehaviourPublicObVeSiVeRiSiAnVeanTrUnique item2 in val)
			{
				if ((Object)(object)item2 == (Object)null)
				{
					continue;
				}
				Transform transform = ((Component)item2).transform;
				Transform val2 = transform.Find("PlayerModel");
				SkinnedMeshRenderer val3 = null;
				if ((Object)(object)val2 == (Object)null)
				{
					val3 = ((Component)transform).GetComponentInChildren<SkinnedMeshRenderer>();
					if ((Object)(object)val3 != (Object)null)
					{
						val2 = ((Component)val3).transform;
					}
				}
				else
				{
					val3 = ((Component)val2).GetComponentInChildren<SkinnedMeshRenderer>();
				}
				if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null)
				{
					continue;
				}
				Transform val4 = null;
				string text = "";
				foreach (Transform componentsInChild in ((Component)transform).GetComponentsInChildren<Transform>(true))
				{
					if (((Object)componentsInChild).name.StartsWith("AntroSkin_Player_"))
					{
						val4 = componentsInChild;
						text = ((Object)componentsInChild).name.Replace("AntroSkin_Player_", "");
						break;
					}
				}
				ulong num = 0uL;
				MonoBehaviourPublicCSstReshTrheObplBojuUnique component = ((Component)item2).GetComponent<MonoBehaviourPublicCSstReshTrheObplBojuUnique>();
				if ((Object)(object)component != (Object)null)
				{
					_ = component.steamProfile;
					if (true)
					{
						num = component.steamProfile.m_SteamID;
						goto IL_01bb;
					}
				}
				num = (ulong)((Object)((Component)item2).gameObject).GetInstanceID();
				goto IL_01bb;
				IL_01bb:
				if (CurrentMode == SkinMode.None)
				{
					if ((Object)(object)val4 != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val4).gameObject);
					}
					UpdateVanillaVisibility(val2, transform, hideBody: false);
					continue;
				}
				string text2 = text;
				if (CurrentMode == SkinMode.Single)
				{
					text2 = GlobalSelectedSkin;
				}
				else if (CurrentMode == SkinMode.Random && list.Count > 0)
				{
					if (!PersistentRandomSkins.ContainsKey(num) || !availableSkins.Contains(PersistentRandomSkins[num]))
					{
						PersistentRandomSkins[num] = list[Random.Range(0, list.Count)];
					}
					text2 = PersistentRandomSkins[num];
				}
				if (string.IsNullOrEmpty(text2))
				{
					continue;
				}
				if ((Object)(object)val4 != (Object)null && text == text2)
				{
					UpdateVanillaVisibility(val2, transform, hideBody: true);
					continue;
				}
				if ((Object)(object)val4 != (Object)null && text != text2)
				{
					Object.Destroy((Object)(object)((Component)val4).gameObject);
					val4 = null;
				}
				Shader shader = Shader.Find("Standard");
				Renderer componentInChildren = ((Component)val2).GetComponentInChildren<Renderer>();
				if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMaterial != (Object)null)
				{
					shader = componentInChildren.sharedMaterial.shader;
				}
				val3.updateWhenOffscreen = true;
				Animator val5 = ((Component)val2).GetComponent<Animator>();
				if ((Object)(object)val5 == (Object)null)
				{
					val5 = ((Component)transform).GetComponentInChildren<Animator>();
				}
				if ((Object)(object)val5 != (Object)null)
				{
					val5.cullingMode = (AnimatorCullingMode)0;
				}
				UpdateVanillaVisibility(val2, transform, hideBody: true);
				if (!((Object)(object)val4 == (Object)null))
				{
					continue;
				}
				GameObject orLoadPrefab = GetOrLoadPrefab(text2);
				if (!((Object)(object)orLoadPrefab != (Object)null))
				{
					continue;
				}
				GameObject val6 = Object.Instantiate<GameObject>(orLoadPrefab, transform);
				((Object)val6).name = "AntroSkin_Player_" + text2;
				val6.SetActive(true);
				foreach (Animator componentsInChild2 in val6.GetComponentsInChildren<Animator>(true))
				{
					componentsInChild2.applyRootMotion = false;
					componentsInChild2.cullingMode = (AnimatorCullingMode)0;
				}
				foreach (Transform componentsInChild3 in val6.GetComponentsInChildren<Transform>(true))
				{
					if (((Object)componentsInChild3).name.ToLower().Contains("jiggle") && (Object)(object)((Component)componentsInChild3).gameObject.GetComponent<AntroJiggleBone>() == (Object)null)
					{
						((Component)componentsInChild3).gameObject.AddComponent<AntroJiggleBone>();
					}
				}
				foreach (Camera componentsInChild4 in val6.GetComponentsInChildren<Camera>(true))
				{
					Object.Destroy((Object)(object)componentsInChild4);
				}
				foreach (AudioListener componentsInChild5 in val6.GetComponentsInChildren<AudioListener>(true))
				{
					Object.Destroy((Object)(object)componentsInChild5);
				}
				foreach (Collider componentsInChild6 in val6.GetComponentsInChildren<Collider>(true))
				{
					Object.Destroy((Object)(object)componentsInChild6);
				}
				foreach (Rigidbody componentsInChild7 in val6.GetComponentsInChildren<Rigidbody>(true))
				{
					Object.Destroy((Object)(object)componentsInChild7);
				}
				SkinnedMeshRenderer componentInChildren2 = val6.GetComponentInChildren<SkinnedMeshRenderer>();
				if ((Object)(object)componentInChildren2 != (Object)null)
				{
					componentInChildren2.updateWhenOffscreen = true;
					componentInChildren2.localBounds = new Bounds(Vector3.zero, new Vector3(50f, 50f, 50f));
				}
				foreach (Renderer componentsInChild8 in val6.GetComponentsInChildren<Renderer>())
				{
					foreach (Material item3 in (Il2CppArrayBase<Material>)(object)componentsInChild8.materials)
					{
						if ((Object)(object)item3 != (Object)null)
						{
							item3.shader = shader;
						}
					}
					if ((Object)(object)((Component)componentsInChild8).gameObject.GetComponent<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique>() == (Object)null)
					{
						MonoBehaviourPublicHa1MeObouCoSiouBoprUnique val7 = ((Component)componentsInChild8).gameObject.AddComponent<MonoBehaviourPublicHa1MeObouCoSiouBoprUnique>();
						((Behaviour)val7).enabled = false;
					}
				}
				val6.transform.localPosition = Vector3.zero;
				val6.transform.localRotation = orLoadPrefab.transform.localRotation;
				Bounds modelBounds = GetModelBounds(val6);
				float num2 = 2f;
				Bounds modelBounds2 = GetModelBounds(((Component)val2).gameObject);
				if (((Bounds)(ref modelBounds2)).size.y > 0.1f)
				{
					num2 = ((Bounds)(ref modelBounds2)).size.y;
				}
				if (((Bounds)(ref modelBounds)).size.y > 0.01f)
				{
					float num3 = num2 / ((Bounds)(ref modelBounds)).size.y;
					float num4 = val6.transform.localScale.y * num3;
					val6.transform.localScale = new Vector3(num4, num4, num4);
				}
				BoneSynchronizer boneSynchronizer = val6.AddComponent<BoneSynchronizer>();
				SyncData syncData = new SyncData();
				syncData.SkinName = text2;
				syncData.RootTransform = val6.transform;
				Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>();
				foreach (Transform componentsInChild9 in ((Component)transform).GetComponentsInChildren<Transform>(true))
				{
					bool flag = false;
					Transform val8 = componentsInChild9;
					while ((Object)(object)val8 != (Object)null && (Object)(object)val8 != (Object)(object)transform)
					{
						if (((Object)val8).name.StartsWith("AntroAccessory_") || ((Object)val8).name.StartsWith("AntroSkin_Stuff_") || ((Object)val8).name.StartsWith("AntroSkin_Player_"))
						{
							flag = true;
							break;
						}
						val8 = val8.parent;
					}
					if (!flag)
					{
						string key = NormalizeName(((Object)componentsInChild9).name);
						if (!dictionary.ContainsKey(key))
						{
							dictionary[key] = componentsInChild9;
						}
					}
				}
				foreach (Transform componentsInChild10 in val6.GetComponentsInChildren<Transform>(true))
				{
					string text3 = CleanBoneName(((Object)componentsInChild10).name);
					if (!syncData.AllCustomTransforms.ContainsKey(text3))
					{
						syncData.AllCustomTransforms.Add(text3, componentsInChild10);
						syncData.InitialLocalPositions.Add(text3, componentsInChild10.localPosition);
						syncData.InitialLocalRotations.Add(text3, componentsInChild10.localRotation);
					}
					if (ExactMixamoToCrab.TryGetValue(text3, out var value) && dictionary.TryGetValue(value, out var value2))
					{
						syncData.CustomBones.Add(componentsInChild10);
						syncData.OriginalBones.Add(value2);
						if (text3 == "Hips")
						{
							syncData.CustomHips = componentsInChild10;
							syncData.OriginalHips = value2;
						}
						if (text3 == "RightHand")
						{
							syncData.CustomRightHand = componentsInChild10;
							syncData.OriginalRightHand = value2;
						}
					}
				}
				BoneSynchronizer.DataMap[((Il2CppObjectBase)boneSynchronizer).Pointer] = syncData;
				SetLayerRecursively(val6, ((Component)val2).gameObject.layer);
			}
			if (ForceReshuffle)
			{
				ForceReshuffle = false;
			}
		}
	}
	public class SkinConfig
	{
		public float GlobalHeightOffset = 0f;

		public Dictionary<string, Vector3> BonePosOffsets = new Dictionary<string, Vector3>();

		public Dictionary<string, Vector3> BoneRotOffsets = new Dictionary<string, Vector3>();

		public bool EnableViewModel = false;

		public Vector3 VMPos = Vector3.zero;

		public Vector3 VMRot = Vector3.zero;

		public float VMScale = 1f;
	}
	public class SkinsMenu : MonoBehaviour
	{
		private bool _isWaitingForKey = false;

		private bool _isMenuOpen = false;

		private Rect _windowRect = new Rect(20f, 20f, 550f, 700f);

		private Vector2 _scrollPos = Vector2.zero;

		private Vector2 _bonesScrollPos = Vector2.zero;

		private Vector2 _tweakerScrollPos = Vector2.zero;

		private List<string> _availablePlayerSkins = new List<string>();

		private int _currentTab = 0;

		private string[] _tabs = new string[5] { "Skins", "Accessories", "Tweaker", "Share", "Presets" };

		private int _categoryTab = 0;

		private string[] _categories = new string[2] { "Players", "Stuff (Weapons)" };

		public string _selectedSkinInList = "";

		private string _presetInputName = "MyPreset";

		private string _shareInputString = "";

		private string _shareStatus = "";

		private string _accScaleInputStr = null;

		public static Dictionary<string, SkinConfig> SkinConfigs = new Dictionary<string, SkinConfig>();

		private string _globalHeightStr;

		private string[] _currentSkinBones = new string[0];

		private string _lastLoadedBonesSkin = "";

		private string _currentBoneEditing = "";

		private string _posXStr;

		private string _posYStr;

		private string _posZStr;

		private string _rotXStr;

		private string _rotYStr;

		private string _rotZStr;

		private string _vmPosXStr;

		private string _vmPosYStr;

		private string _vmPosZStr;

		private string _vmRotXStr;

		private string _vmRotYStr;

		private string _vmRotZStr;

		private string _vmScaleStr;

		private bool _editPositionMode = false;

		private string _boneSearchQuery = "";

		private int _boneSortMode = 0;

		private float _slowUpdateTimer = 0f;

		private int _accessoryBoneTab = 0;

		public SkinsMenu(IntPtr ptr)
			: base(ptr)
		{
		}//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)


		public static SkinConfig GetSkinConfig(string skinName)
		{
			if (string.IsNullOrEmpty(skinName))
			{
				return new SkinConfig();
			}
			if (!SkinConfigs.ContainsKey(skinName))
			{
				SkinConfigs[skinName] = new SkinConfig();
			}
			return SkinConfigs[skinName];
		}

		public void Start()
		{
			RefreshLists();
		}

		public void Update()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (!_isWaitingForKey && Input.GetKeyDown(ConfigManager.MenuKey.Value))
			{
				bool isMenuOpen = _isMenuOpen;
				_isMenuOpen = !_isMenuOpen;
				Cursor.lockState = (CursorLockMode)((!_isMenuOpen) ? 1 : 0);
				Cursor.visible = _isMenuOpen;
				if (isMenuOpen && !_isMenuOpen && ConfigManager.RememberState.Value)
				{
					ConfigManager.SaveSettings();
				}
			}
			_slowUpdateTimer += Time.deltaTime;
			if (_slowUpdateTimer > 0.5f)
			{
				_slowUpdateTimer = 0f;
				SkinManager.ApplyModels();
				StuffManager.ApplyModels();
				AccessoryManager.ApplyModels();
			}
			if (SkinManager.FastUpdateNextFrame)
			{
				SkinManager.FastUpdateNextFrame = false;
				SkinManager.ApplyModels();
				StuffManager.ApplyModels();
				AccessoryManager.ApplyModels();
			}
		}

		public void OnGUI()
		{
			//IL_006d: 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_008d: 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_0021: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (_isWaitingForKey)
			{
				Event current = Event.current;
				if (current.isKey && (int)current.type == 4 && (int)current.keyCode > 0)
				{
					ConfigManager.MenuKey.Value = current.keyCode;
					ConfigManager.SaveSettings();
					_isWaitingForKey = false;
					current.Use();
				}
			}
			if (_isMenuOpen)
			{
				_windowRect = GUI.Window(8889, _windowRect, DelegateSupport.ConvertDelegate<WindowFunction>((Delegate)new Action<int>(DrawWindow)), "Antro Client Avatars 1.6");
			}
		}

		private void RefreshLists()
		{
			_availablePlayerSkins = SkinManager.GetAvailableSkins();
			if (_availablePlayerSkins.Contains(_selectedSkinInList))
			{
				return;
			}
			bool flag = false;
			string[] stuffTypes = StuffManager.StuffTypes;
			foreach (string itemType in stuffTypes)
			{
				if (StuffManager.GetAvailableSkins(itemType).Contains(_selectedSkinInList))
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				_selectedSkinInList = "";
			}
		}

		private void DrawWindow(int windowID)
		{
			GUILayout.Space(5f);
			_currentTab = GUILayout.Toolbar(_currentTab, Il2CppStringArray.op_Implicit(_tabs), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			GUILayout.Space(10f);
			if (_currentTab == 0)
			{
				DrawSkinsTab();
			}
			else if (_currentTab == 1)
			{
				DrawAccessoriesTab();
			}
			else if (_currentTab == 2)
			{
				DrawTweakerTab();
			}
			else if (_currentTab == 3)
			{
				DrawShareTab();
			}
			else if (_currentTab == 4)
			{
				DrawPresetsTab();
			}
			GUI.DragWindow();
		}

		private void DrawAccessoriesTab()
		{
			//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_0027: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("--- ACCESSORIES MANAGER ---", new GUI