Decompiled source of HoshinoEnforcer v1.0.0

HoshinoEnforcer.dll

Decompiled 13 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DynamicSkins;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using MwSkinAdditions;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace HoshinoEnforcer
{
	[BepInPlugin("com.Miyowi.HoshinoEnforcer", "HoshinoEnforcer", "1.0.0")]
	public class HoshinoEnforcerPlugin : BaseUnityPlugin
	{
		private class FieldException : Exception
		{
			public FieldException(string message, Exception innerException)
				: base(message, innerException)
			{
			}
		}

		private class ElementException : Exception
		{
			public int Index { get; }

			public ElementException(int index, string message)
				: base(message)
			{
				Index = index;
			}
		}

		public class DynamicSkinExtension
		{
			private Modification DefHoshinoEnforcerbag_01Modification;

			private Modification DefHoshinoEnforcerbag_02Modification;

			private Modification DefHoshinoEnforcerbag_03Modification;

			private Modification DefHoshinoEnforcerbag_04Modification;

			private Modification DefHoshinoEnforcerskirt_allModification;

			private Modification DefHoshinoEnforcerbackhair_01Modification;

			private Modification DefHoshinoEnforcerfronthairModification;

			private Modification DefHoshinoEnforcerfronthair_Top01_01Modification;

			private Modification DefHoshinoEnforcerhalorod1Modification;

			private Modification DefHoshinoEnforcersidehairModification;

			internal void BeforeStart()
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				_DynamicSkinManager.InstanceLogger = ((BaseUnityPlugin)Instance).Logger;
				new Hook((MethodBase)typeof(SkinDef).GetMethod("ApplyAsync"), (Delegate)new Func<Func<SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator>, SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator>(_DynamicSkinManager.SkinDefApply)).Apply();
			}

			internal void AfterStart()
			{
				InitializeModifications();
				InitializeDynamicBones();
				AddModificationsToList();
			}

			internal void BeforeBodyCatalogInit()
			{
				Enforcer2BodyDefHoshinoEnforcerSkinAddedEvent += onSkinAdded;
			}

			internal void AfterBodyCatalogInit()
			{
			}

			private void InitializeModifications()
			{
				DefHoshinoEnforcerbag_01Modification = new Modification("bag_01.prefab", "pelvis", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 110, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerbag_02Modification = new Modification("bag_02.prefab", "pelvis", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 108, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerbag_03Modification = new Modification("bag_03.prefab", "pelvis", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 111, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerbag_04Modification = new Modification("bag_04.prefab", "pelvis", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 113, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerskirt_allModification = new Modification("skirt_all.prefab", "pelvis", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 23, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerbackhair_01Modification = new Modification("backhair_01.prefab", "head", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 154, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerfronthairModification = new Modification("fronthair.prefab", "head", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 203, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerfronthair_Top01_01Modification = new Modification("fronthair_Top01_01.prefab", "head", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 150, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcerhalorod1Modification = new Modification("halorod1.prefab", "head", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 198, AffectsBaseModel: true, assetBundle);
				DefHoshinoEnforcersidehairModification = new Modification("sidehair.prefab", "head", "Enforcer2Body", "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 217, AffectsBaseModel: true, assetBundle);
			}

			private void InitializeDynamicBones()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_022a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0240: Unknown result type (might be due to invalid IL or missing references)
				//IL_0245: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0260: Unknown result type (might be due to invalid IL or missing references)
				//IL_0265: Unknown result type (might be due to invalid IL or missing references)
				//IL_026c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0293: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d0: Expected O, but got Unknown
				//IL_0312: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Unknown result type (might be due to invalid IL or missing references)
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				//IL_035a: Unknown result type (might be due to invalid IL or missing references)
				//IL_038a: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0405: 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_0470: Unknown result type (might be due to invalid IL or missing references)
				//IL_0484: 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_04ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0503: Unknown result type (might be due to invalid IL or missing references)
				//IL_0517: Unknown result type (might be due to invalid IL or missing references)
				//IL_055f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0564: Unknown result type (might be due to invalid IL or missing references)
				//IL_0575: Unknown result type (might be due to invalid IL or missing references)
				//IL_057a: Unknown result type (might be due to invalid IL or missing references)
				//IL_058b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0590: Unknown result type (might be due to invalid IL or missing references)
				//IL_0595: Unknown result type (might be due to invalid IL or missing references)
				//IL_059a: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0605: Expected O, but got Unknown
				DefHoshinoEnforcerbag_01Modification.dynamicBoneData = new DynamicBoneData("bag_01", 0.4f, null, 0.08f, null, 0.909f, null, 1f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerbag_02Modification.dynamicBoneData = new DynamicBoneData("bag_02", 0.4f, null, 0.08f, null, 0.909f, null, 1f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerbag_03Modification.dynamicBoneData = new DynamicBoneData("bag_03", 0.4f, null, 0.08f, null, 0.909f, null, 1f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerbag_04Modification.dynamicBoneData = new DynamicBoneData("bag_04", 0.4f, null, 0.08f, null, 0.909f, null, 1f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerskirt_allModification.dynamicBoneData = new DynamicBoneData("skirt_all", 0.36f, null, 0.1f, null, 1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3]
				{
					new Keyframe(0.003039514f, 1.058782f),
					new Keyframe(0.6251287f, 0.9837241f),
					new Keyframe(1.009338f, 0.8577881f)
				})
				{
					postWrapMode = (WrapMode)8,
					preWrapMode = (WrapMode)8
				}, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerbackhair_01Modification.dynamicBoneData = new DynamicBoneData("backhair_01", 0.255f, null, 0.091f, null, 0.803f, null, 0.659f, null, 0.05f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.002f, 0f), new List<DynamicBoneColliderData>
				{
					new DynamicBoneColliderData("shield_M_00_jnt", (Direction)1, new Vector3(0.12f, -0.12f, -0.63f), (Bound)0, 0.2f, 1.66f),
					new DynamicBoneColliderData("spine", (Direction)1, new Vector3(0f, -0.21f, 0.1f), (Bound)0, 0.23f, 1.09f)
				}, new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerfronthairModification.dynamicBoneData = new DynamicBoneData("fronthair", 0.457f, null, 0.1f, null, 0.928f, null, 0.654f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerfronthair_Top01_01Modification.dynamicBoneData = new DynamicBoneData("fronthair_Top01_01", 0.273f, null, 0.071f, null, 0.404f, null, 0.841f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcerhalorod1Modification.dynamicBoneData = new DynamicBoneData("halorod1", 0.485f, null, 0.215f, null, 0.875f, null, 0.716f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				DefHoshinoEnforcersidehairModification.dynamicBoneData = new DynamicBoneData("sidehair", 0.273f, null, 0.071f, null, 1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3]
				{
					new Keyframe(-0.001525879f, 1.010258f),
					new Keyframe(0.6102715f, 1.003382f),
					new Keyframe(1.008423f, 0.8226242f)
				})
				{
					postWrapMode = (WrapMode)8,
					preWrapMode = (WrapMode)8
				}, 0.543f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
			}

			private void AddModificationsToList()
			{
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 110, DefHoshinoEnforcerbag_01Modification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 108, DefHoshinoEnforcerbag_02Modification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 111, DefHoshinoEnforcerbag_03Modification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 113, DefHoshinoEnforcerbag_04Modification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 23, DefHoshinoEnforcerskirt_allModification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 154, DefHoshinoEnforcerbackhair_01Modification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 203, DefHoshinoEnforcerfronthairModification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 150, DefHoshinoEnforcerfronthair_Top01_01Modification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 198, DefHoshinoEnforcerhalorod1Modification);
				_DynamicSkinManager.AddModification("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", 217, DefHoshinoEnforcersidehairModification);
			}

			private static void onSkinAdded(object sender, SkinAddedArgs e)
			{
				_DynamicSkinManager.AddSkinDef(e.skinDef);
			}
		}

		public delegate void VoidDelegate();

		public class SkinAddedArgs : EventArgs
		{
			public SkinDef skinDef { get; }

			public GameObject bodyPrefab { get; }

			public SkinAddedArgs(SkinDef newSkinDef, GameObject newGameObject)
			{
				skinDef = newSkinDef;
				bodyPrefab = newGameObject;
			}
		}

		public static AssetBundle assetBundle;

		private static readonly List<Material> materialsWithRoRShader = new List<Material>();

		private static DynamicSkinExtension _DynamicSkinExtension = new DynamicSkinExtension();

		private static DynamicSkinManager _DynamicSkinManager = new DynamicSkinManager();

		private static VoidDelegate BeforeStartDelegate;

		private static VoidDelegate AfterStartDelegate;

		private static VoidDelegate BeforeBodyCatalogDelegate;

		private static VoidDelegate AfterBodyCatalogDelegate;

		internal static HoshinoEnforcerPlugin Instance { get; private set; }

		internal static ManualLogSource InstanceLogger
		{
			get
			{
				HoshinoEnforcerPlugin instance = Instance;
				if (instance == null)
				{
					return null;
				}
				return ((BaseUnityPlugin)instance).Logger;
			}
		}

		private static event EventHandler<SkinAddedArgs> Enforcer2BodyDefHoshinoEnforcerSkinAddedEvent;

		private void Awake()
		{
			MwSkinEvents.CreateVoiceGroups();
		}

		private void Start()
		{
			Instance = this;
			BeforeStart();
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HoshinoEnforcer.miyowihoshinoenforcer"))
			{
				assetBundle = AssetBundle.LoadFromStream(stream);
			}
			((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)BodyCatalogInit);
			HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action<Action<Language>, Language>(LanguageLoadStrings));
			ReplaceShaders();
			AfterStart();
		}

		private void BeforeStart()
		{
			Enforcer2BodyDefHoshinoEnforcerSkinAddedEvent += MwSkinEvents.Init;
			BeforeStartDelegate = (VoidDelegate)Delegate.Combine(BeforeStartDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeStart));
			BeforeStartDelegate?.Invoke();
		}

		private void AfterStart()
		{
			Options.Init();
			AfterStartDelegate = (VoidDelegate)Delegate.Combine(AfterStartDelegate, new VoidDelegate(_DynamicSkinExtension.AfterStart));
			AfterStartDelegate?.Invoke();
		}

		private static void BeforeBodyCatalogInit()
		{
			BeforeBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(BeforeBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeBodyCatalogInit));
			BeforeBodyCatalogDelegate?.Invoke();
		}

		private static void AfterBodyCatalogInit()
		{
			AfterBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(AfterBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.AfterBodyCatalogInit));
			AfterBodyCatalogDelegate?.Invoke();
		}

		private static void ReplaceShaders()
		{
			LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/Skins/HoshinoEnforcer/Skin/matHoshinoEnforcerBody.mat", "Assets/Skins/HoshinoEnforcer/Skin/matHoshinoEnforcerWeapon.mat", "Assets/Skins/HoshinoEnforcer/Skin/matHoshinoEnforcerShield.mat");
		}

		private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths)
		{
			//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)
			Shader shader = Addressables.LoadAssetAsync<Shader>((object)shaderPath).WaitForCompletion();
			foreach (string text in materialPaths)
			{
				Material val = assetBundle.LoadAsset<Material>(text);
				val.shader = shader;
				materialsWithRoRShader.Add(val);
			}
		}

		private static void LanguageLoadStrings(Action<Language> orig, Language self)
		{
			orig(self);
			self.SetStringByToken("MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME", "Hoshino");
		}

		private static void BodyCatalogInit()
		{
			BeforeBodyCatalogInit();
			AddEnforcer2BodyDefHoshinoEnforcerSkin();
			AfterBodyCatalogInit();
		}

		private static void Enforcer2BodyDefHoshinoEnforcerSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			HoshinoEnforcerPlugin.Enforcer2BodyDefHoshinoEnforcerSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddEnforcer2BodyDefHoshinoEnforcerSkin()
		{
			string text = "Enforcer2Body";
			string text2 = "DefHoshinoEnforcer";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject gameObject = ((Component)component.modelTransform).gameObject;
				ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)skinController))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true);
				gameObject.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\HoshinoEnforcer\\Icons\\DefHoshinoEnforcerIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "MIYOWI_SKIN_DEFHOSHINOENFORCER_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { ThrowIfOutOfBounds(0, "Index 0 is out of bounds of skins array", skinController.skins, 0) };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					//IL_0010: 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_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0071: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c8: 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)
					skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[2]
					{
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(0, "There is no renderer with the name \"FootLights\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "FootLights")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(1, "There is no renderer with the name \"ShoulderLights\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "ShoulderLights")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						}
					};
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					//IL_0082: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ea: 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_00f4: 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)
					//IL_015c: Unknown result type (might be due to invalid IL or missing references)
					//IL_015d: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[3]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoEnforcer/Skin/matHoshinoEnforcerBody.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Enforcer_geo\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Enforcer_geo")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoEnforcer/Skin/matHoshinoEnforcerWeapon.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(1, "There is no renderer with the name \"Enforcer_Gun_low\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Enforcer_Gun_low")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Skins/HoshinoEnforcer/Skin/matHoshinoEnforcerShield.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(2, "There is no renderer with the name \"Enforcer_Shield_low\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Enforcer_Shield_low")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
					//IL_012c: Unknown result type (might be due to invalid IL or missing references)
					//IL_012d: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[3]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoEnforcer\\Meshes\\HoshinoBodyMesh.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Enforcer_geo\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Enforcer_geo")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoEnforcer\\Meshes\\HoshinoWeaponMesh.mesh"),
							renderer = ThrowIfNull<Renderer>(1, "There is no renderer with the name \"Enforcer_Gun_low\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Enforcer_Gun_low")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\HoshinoEnforcer\\Meshes\\HoshinoShieldMesh.mesh"),
							renderer = ThrowIfNull<Renderer>(2, "There is no renderer with the name \"Enforcer_Shield_low\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Enforcer_Shield_low")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				Enforcer2BodyDefHoshinoEnforcerSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static T ThrowIfEquals<T>(int index, string message, T value, T expected) where T : Enum
		{
			if (value.Equals(expected))
			{
				throw new ElementException(index, message);
			}
			return value;
		}

		private static T ThrowIfOutOfBounds<T>(int index, string message, T[] array, int elementIndex) where T : class
		{
			if (array == null || array.Length <= elementIndex)
			{
				throw new ElementException(index, message);
			}
			return array[elementIndex];
		}

		private static T ThrowIfNull<T>(int index, string message, T value) where T : class
		{
			if (value == null)
			{
				throw new ElementException(index, message);
			}
			return value;
		}

		private static void TryCatchThrow(string message, Action action)
		{
			try
			{
				action?.Invoke();
			}
			catch (Exception innerException)
			{
				throw new FieldException(message, innerException);
			}
		}

		private static void TryAddComponent<T>(GameObject obj) where T : Component
		{
			if (Object.op_Implicit((Object)(object)obj) && !Object.op_Implicit((Object)(object)obj.GetComponent<T>()))
			{
				obj.AddComponent<T>();
			}
		}
	}
	public class HoshinoController : MonoBehaviour
	{
		public int consecutiveShrineFails;
	}
	public static class MwSkinEvents
	{
		public static VoiceGroup[] voiceGroups;

		private static float nextLobbyLineTime;

		public static VoiceArray skinSelect = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Select_1", 1.8f),
			new VoiceInfo("Play_HoshinoEnforcer_Select_2", 5.8f),
			new VoiceInfo("Play_HoshinoEnforcer_Select_3", 7.5f),
			new VoiceInfo("Play_HoshinoEnforcer_Select_4", 2f)
		});

		public static VoiceArray leavePod = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[2]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Pod_1", 1.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Pod_2", 2.3f)
		});

		public static VoiceArray idle = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[9]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Idle_2", 2.5f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_3", 6f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_4", 2.9f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_5", 5.3f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_6", 3.6f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_7", 2.2f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_8", 7.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_9", 1.5f),
			new VoiceInfo("Play_HoshinoEnforcer_Idle_10", 1.4f)
		});

		public static VoiceArray death = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Death_1", 2.8f),
			new VoiceInfo("Play_HoshinoEnforcer_Death_2", 2.3f),
			new VoiceInfo("Play_HoshinoEnforcer_Death_3", 2.8f),
			new VoiceInfo("Play_HoshinoEnforcer_Death_4", 2.6f)
		});

		public static VoiceArray useEquipment = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Equipment_1", 1.9f),
			new VoiceInfo("Play_HoshinoEnforcer_Select_1", 1.8f),
			new VoiceInfo("Play_HoshinoEnforcer_TPStart_2", 1.3f),
			new VoiceInfo("Play_HoshinoEnforcer_TPStart_5", 1.4f)
		});

		public static VoiceArray useSpecial = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[6]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Special_1", 0.9f),
			new VoiceInfo("Play_HoshinoEnforcer_Special_3", 1.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Special_4", 1f),
			new VoiceInfo("Play_HoshinoEnforcer_Special_5", 2f),
			new VoiceInfo("Play_HoshinoEnforcer_Special_6", 0.8f),
			new VoiceInfo("Play_HoshinoEnforcer_Special_7", 2f)
		});

		public static VoiceArray useUtility = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Utility_1", 1.3f),
			new VoiceInfo("Play_HoshinoEnforcer_Utility_2", 1f),
			new VoiceInfo("Play_HoshinoEnforcer_Utility_3", 1.3f),
			new VoiceInfo("Play_HoshinoEnforcer_Utility_4", 1f),
			new VoiceInfo("Play_HoshinoEnforcer_Utility_5", 2f)
		});

		public static VoiceArray useSecondary = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Secondary_1", 0.6f),
			new VoiceInfo("Play_HoshinoEnforcer_Secondary_2", 0.8f),
			new VoiceInfo("Play_HoshinoEnforcer_Secondary_3", 0.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Secondary_4", 0.5f)
		});

		public static VoiceArray usePrimary = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Primary_1", 0.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Primary_2", 0.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Primary_3", 0.4f)
		});

		public static VoiceArray jump = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[3]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Jump_1", 0.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Jump_2", 0.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Jump_3", 0.4f)
		});

		public static VoiceArray startTP = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5]
		{
			new VoiceInfo("Play_HoshinoEnforcer_TPStart_1", 1f),
			new VoiceInfo("Play_HoshinoEnforcer_TPStart_3", 1.8f),
			new VoiceInfo("Play_HoshinoEnforcer_TPStart_4", 2.2f),
			new VoiceInfo("Play_HoshinoEnforcer_TPStart_5", 1.4f),
			new VoiceInfo("Play_HoshinoEnforcer_TPStart_6", 1.4f)
		});

		public static VoiceArray defeatTPBoss = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[4]
		{
			new VoiceInfo("Play_HoshinoEnforcer_TPBossDefeat_1", 2.1f),
			new VoiceInfo("Play_HoshinoEnforcer_TPBossDefeat_2", 3.8f),
			new VoiceInfo("Play_HoshinoEnforcer_TPBossDefeat_3", 1.6f),
			new VoiceInfo("Play_HoshinoEnforcer_TPBossDefeat_4", 2.2f)
		});

		public static VoiceArray endTP = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5]
		{
			new VoiceInfo("Play_HoshinoEnforcer_TPEnd_1", 7f),
			new VoiceInfo("Play_HoshinoEnforcer_TPEnd_2", 4.2f),
			new VoiceInfo("Play_HoshinoEnforcer_TPEnd_3", 1.6f),
			new VoiceInfo("Play_HoshinoEnforcer_TPEnd_5", 1.5f),
			new VoiceInfo("Play_HoshinoEnforcer_TPEnd_6", 2f)
		});

		public static VoiceArray getItem = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Item_1", 1.6f),
			new VoiceInfo("Play_HoshinoEnforcer_Item_2", 2f),
			new VoiceInfo("Play_HoshinoEnforcer_Item_3", 2f),
			new VoiceInfo("Play_HoshinoEnforcer_Item_4", 1.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Item_5", 1f)
		});

		public static VoiceArray hurt = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[7]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Hurt_1", 1.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Hurt_2", 0.5f),
			new VoiceInfo("Play_HoshinoEnforcer_Hurt_3", 0.6f),
			new VoiceInfo("Play_HoshinoEnforcer_Hurt_4", 0.9f),
			new VoiceInfo("Play_HoshinoEnforcer_Hurt_5", 0.9f),
			new VoiceInfo("Play_HoshinoEnforcer_Hurt_6", 0.7f),
			new VoiceInfo("Play_HoshinoEnforcer_Hurt_7", 0.7f)
		});

		public static VoiceArray heavyHeal = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[1]
		{
			new VoiceInfo("Play_HoshinoEnforcer_HeavyHeal_1", 1.2f)
		});

		public static VoiceArray leaveStage = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[5]
		{
			new VoiceInfo("Play_HoshinoEnforcer_Teleport_1", 1.3f),
			new VoiceInfo("Play_HoshinoEnforcer_Teleport_2", 0.9f),
			new VoiceInfo("Play_HoshinoEnforcer_Teleport_3", 1.2f),
			new VoiceInfo("Play_HoshinoEnforcer_Teleport_4", 1.4f),
			new VoiceInfo("Play_HoshinoEnforcer_Teleport_5", 2f)
		});

		public static VoiceArray hugeFailShrine = new VoiceArray((VoiceInfo[])(object)new VoiceInfo[1]
		{
			new VoiceInfo("Play_HoshinoEnforcer_LetsGoGambling_1", 2.3f)
		});

		private static void HeavyHealLine(GameObject body, float amount)
		{
			VoiceController val = ((body != null) ? body.GetComponent<VoiceController>() : null);
			if (val != null)
			{
				object obj;
				if (body == null)
				{
					obj = null;
				}
				else
				{
					CharacterBody component = body.GetComponent<CharacterBody>();
					obj = ((component != null) ? component.healthComponent : null);
				}
				HealthComponent val2 = (HealthComponent)obj;
				if ((Object)(object)val2 != (Object)null && amount >= 0.5f * val2.fullCombinedHealth)
				{
					val.TryPlayRandomSoundServer(heavyHeal, body, 1f);
				}
			}
		}

		private static void ShrineSuccessTrack(GameObject body)
		{
			HoshinoController hoshinoController = ((body != null) ? body.GetComponent<HoshinoController>() : null);
			if (hoshinoController != null)
			{
				hoshinoController.consecutiveShrineFails = 0;
			}
			else if (Object.op_Implicit((Object)(object)body))
			{
				body.AddComponent<HoshinoController>();
			}
		}

		private static void ShrineFailureTrack(GameObject body)
		{
			HoshinoController hoshinoController = ((body != null) ? body.GetComponent<HoshinoController>() : null);
			if (hoshinoController != null)
			{
				hoshinoController.consecutiveShrineFails++;
				if (hoshinoController.consecutiveShrineFails % 5 == 0)
				{
					VoiceController val = ((body != null) ? body.GetComponent<VoiceController>() : null);
					if (val != null)
					{
						val.TryPlayRandomSoundServer(hugeFailShrine, body, 1f);
					}
				}
			}
			else if (Object.op_Implicit((Object)(object)body))
			{
				body.AddComponent<HoshinoController>().consecutiveShrineFails = 1;
			}
		}

		public static void Init(object _, HoshinoEnforcerPlugin.SkinAddedArgs skinAddedArgs)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0096: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00bd: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00e4: 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_0104: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0132: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0174: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_01a4: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Expected O, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Expected O, but got Unknown
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Expected O, but got Unknown
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Expected O, but got Unknown
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Expected O, but got Unknown
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Expected O, but got Unknown
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Expected O, but got Unknown
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Expected O, but got Unknown
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Expected O, but got Unknown
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Expected O, but got Unknown
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: 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_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0582: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: 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_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: 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_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: 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_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c0: 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_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0729: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_075e: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Unknown result type (might be due to invalid IL or missing references)
			//IL_0794: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_081f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0820: Unknown result type (might be due to invalid IL or missing references)
			//IL_0841: Unknown result type (might be due to invalid IL or missing references)
			//IL_0842: Unknown result type (might be due to invalid IL or missing references)
			//IL_0863: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Unknown result type (might be due to invalid IL or missing references)
			UpdateIDRS(skinAddedArgs.skinDef);
			SkinDef skinDef = skinAddedArgs.skinDef;
			EventSubOptions val = new EventSubOptions();
			val.boneTransformations = (BoneTransformation[])(object)new BoneTransformation[18]
			{
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleL", Vector3.one, new Vector3(0.13f, 0.04f, 0.15f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleL/upper_armL/lower_armL/handL", Vector3.one * 0.74f, Vector3.zero, (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleL/upper_armL/lower_armL/handL/thumb_L", Vector3.one, new Vector3(0.07f, -0.02f, -0.05f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleL/upper_armL/lower_armL/handL/point_L1", Vector3.one, new Vector3(0f, 0f, -0.05f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleL/upper_armL/lower_armL/handL/mid_L", Vector3.one, new Vector3(0f, 0f, -0.02f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleL/upper_armL/lower_armL/handL/fingerL3/fingerL3_1", Vector3.one, new Vector3(0.02f, 0.02f, 0f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleL/upper_armL/lower_armL/handL/fingerL4/fingerL4_1", Vector3.one, new Vector3(0.04f, 0.04f, 0.02f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleR", Vector3.one, new Vector3(-0.13f, -0.05f, -0.1f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleR/upper_armR/lower_armR/handR", Vector3.one * 0.74f, Vector3.zero, (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleR/upper_armR/lower_armR/handR/thumbR", Vector3.one, new Vector3(-0.07f, 0.02f, 0.05f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleR/upper_armR/lower_armR/handR/fingerR1", Vector3.one, new Vector3(0f, 0f, 0.05f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleR/upper_armR/lower_armR/handR/fingerR2", Vector3.one, new Vector3(0f, -0.01f, 0.01f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleR/upper_armR/lower_armR/handR/fingerR3/fingerR3_1", Vector3.one, new Vector3(0.02f, -0.02f, 0f), (string)null),
				new BoneTransformation("Armature/ROOT/base/stomach/spine/chest/clavicleR/upper_armR/lower_armR/handR/fingerR4/fingerR4_1", Vector3.one, new Vector3(-0.02f, -0.04f, -0.02f), (string)null),
				new BoneTransformation("Armature/ROOT/base/pelvis/thighL", Vector3.one, new Vector3(0f, 0.07f, 0f), (string)null),
				new BoneTransformation("Armature/ROOT/base/pelvis/thighR", Vector3.one, new Vector3(0f, -0.07f, 0f), (string)null),
				new BoneTransformation("Armature/ROOT", Vector3.one * 0.75f, Vector3.zero, (TransformContexts)1, (string)null),
				new BoneTransformation("Armature/ROOT", Vector3.one * 0.75f, new Vector3(0f, -0.2f, 0f), (TransformContexts)(-2), (string)null)
			};
			val.blinkAnimations = (BlendShapeAnimation[])(object)new BlendShapeAnimation[1] { (BlendShapeAnimation)new BlinkBlendShapeAnimation("Enforcer_geo", "e-blink", -1, 0, 0.1f, 0f, 0.1f, false) };
			val.conditionalIdleAnimations = (IdleAnimation[])(object)new IdleAnimation[2]
			{
				new IdleAnimation((BlendShapeAnimation[])(object)new BlendShapeAnimation[2]
				{
					new BlendShapeAnimation("Enforcer_geo", "b-troubled", 1, -2, 0.3f, float.PositiveInfinity, 0.3f, false),
					new BlendShapeAnimation("Enforcer_geo", "m-serious", 2, -2, 0.3f, float.PositiveInfinity, 0.3f, false)
				}, (Func<ExpressionController, bool>)InCombat, true),
				new IdleAnimation((BlendShapeAnimation[])(object)new BlendShapeAnimation[3]
				{
					new BlendShapeAnimation("Enforcer_geo", "e-blink-L", 0, -1, 0.3f, float.PositiveInfinity, 0.3f, true),
					new BlendShapeAnimation("Enforcer_geo", "b-hurt", 1, -1, 0.3f, float.PositiveInfinity, 0.3f, false),
					new BlendShapeAnimation("Enforcer_geo", "m-serious", 2, -1, 0.3f, float.PositiveInfinity, 0.3f, false)
				}, (Func<ExpressionController, bool>)LowHealth, true)
			};
			val.useAnimations = true;
			val.voiceGroups = voiceGroups;
			EventSub val2 = new EventSub(skinDef, val);
			val2.TakeDamage = (Action<GameObject, DamageReport>)Delegate.Combine(val2.TakeDamage, new Action<GameObject, DamageReport>(ExpressionOnHit));
			val2.ShrineFailure = (Action<GameObject>)Delegate.Combine(val2.ShrineFailure, new Action<GameObject>(ExpressionOnShrineFailure));
			val2.LevelUp = (Action<GameObject>)Delegate.Combine(val2.LevelUp, new Action<GameObject>(ExpressionOnHoldoutOnLevelOnMithrix));
			val2.MithrixDefeat = (Action<GameObject>)Delegate.Combine(val2.MithrixDefeat, new Action<GameObject>(ExpressionOnHoldoutOnLevelOnMithrix));
			val2.HoldoutZoneCharged = (Action<GameObject>)Delegate.Combine(val2.HoldoutZoneCharged, new Action<GameObject>(ExpressionOnHoldoutOnLevelOnMithrix));
			val2.GetItem = (Action<GameObject, ItemIndex>)Delegate.Combine(val2.GetItem, new Action<GameObject, ItemIndex>(ExpressionOnItem));
			val2.Death = (Action<GameObject>)Delegate.Combine(val2.Death, new Action<GameObject>(ExpressionOnDeath));
			val2.TakeDamage = (Action<GameObject, DamageReport>)Delegate.Combine(val2.TakeDamage, (Action<GameObject, DamageReport>)delegate(GameObject body, DamageReport damageReport)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(hurt, body, 0.4f);
				}
			});
			val2.Death = (Action<GameObject>)Delegate.Combine(val2.Death, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomSoundServer(death, body, 1f);
				}
			});
			val2.TeleporterStart = (Action<GameObject>)Delegate.Combine(val2.TeleporterStart, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomSoundServer(startTP, body, 1f);
				}
			});
			val2.DefeatBossGroup = (Action<GameObject>)Delegate.Combine(val2.DefeatBossGroup, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(defeatTPBoss, body, 1f);
				}
			});
			val2.TeleporterEnd = (Action<GameObject>)Delegate.Combine(val2.TeleporterEnd, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomSoundServer(endTP, body, 1f);
				}
			});
			val2.LeavePod = (Action<GameObject>)Delegate.Combine(val2.LeavePod, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomSoundServer(leavePod, body, 1f);
				}
			});
			val2.Idle = (Action<GameObject>)Delegate.Combine(val2.Idle, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(idle, body, 1f);
				}
			});
			val2.UseEquipment = (Action<GameObject>)Delegate.Combine(val2.UseEquipment, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(useEquipment, body, 0.8f);
				}
			});
			val2.UseSpecial = (Action<GameObject>)Delegate.Combine(val2.UseSpecial, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(useSpecial, body, 0.4f);
				}
			});
			val2.UseUtility = (Action<GameObject>)Delegate.Combine(val2.UseUtility, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(useUtility, body, 0.4f);
				}
			});
			val2.UseSecondary = (Action<GameObject>)Delegate.Combine(val2.UseSecondary, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(useSecondary, body, 0.2f);
				}
			});
			val2.UsePrimary = (Action<GameObject>)Delegate.Combine(val2.UsePrimary, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(usePrimary, body, 0.04f);
				}
			});
			val2.LeaveStage = (Action<GameObject>)Delegate.Combine(val2.LeaveStage, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(leaveStage, body, 1f);
				}
			});
			val2.Jump = (Action<GameObject>)Delegate.Combine(val2.Jump, (Action<GameObject>)delegate(GameObject body)
			{
				VoiceController val3 = default(VoiceController);
				if (Object.op_Implicit((Object)(object)body) && body.TryGetComponent<VoiceController>(ref val3))
				{
					val3.TryPlayRandomUniqueSoundServer(jump, body, 0.07f);
				}
			});
			val2.Heal = (Action<GameObject, float>)Delegate.Combine(val2.Heal, new Action<GameObject, float>(HeavyHealLine));
			val2.ShrineSuccess = (Action<GameObject>)Delegate.Combine(val2.ShrineSuccess, new Action<GameObject>(ShrineSuccessTrack));
			val2.ShrineFailure = (Action<GameObject>)Delegate.Combine(val2.ShrineFailure, new Action<GameObject>(ShrineFailureTrack));
			val2.Init();
			val2.SkinAppliedLobby = (Action<GameObject>)Delegate.Combine(val2.SkinAppliedLobby, (Action<GameObject>)delegate(GameObject body)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				if (Time.time > nextLobbyLineTime && ((body != null) ? body.GetComponent<VoiceController>() : null) != null)
				{
					object[] voiceLines = skinSelect.voiceLines;
					VoiceInfo val3 = (VoiceInfo)MwUtils.RandomChoice(voiceLines);
					nextLobbyLineTime = Time.time + val3.approxDuration + 0.5f;
					VoiceController.PlaySound(val3, body, (VoiceController)null);
				}
			});
		}

		private static bool InCombat(ExpressionController expressionController)
		{
			CharacterBody characterBody = expressionController.characterBody;
			if (Object.op_Implicit((Object)(object)characterBody))
			{
				return !characterBody.outOfCombat;
			}
			return false;
		}

		private static bool LowHealth(ExpressionController expressionController)
		{
			CharacterBody characterBody = expressionController.characterBody;
			if (Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)characterBody.healthComponent))
			{
				return characterBody.healthComponent.combinedHealthFraction <= 0.25f;
			}
			return false;
		}

		private static void ExpressionOnHit(GameObject body, DamageReport damageReport)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			ExpressionController val = default(ExpressionController);
			if (body.TryGetComponent<ExpressionController>(ref val))
			{
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "f-><", 0, 0, 0f, 0.6f, 0f, true));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "b-hurt", 1, 0, 0.2f, 0.2f, 0.2f, false));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "m-serious", 2, 0, 0.2f, 0.2f, 0.2f, false));
			}
		}

		private static void ExpressionOnShrineFailure(GameObject body)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			ExpressionController val = default(ExpressionController);
			if (body.TryGetComponent<ExpressionController>(ref val))
			{
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "f-calm", 0, 0, 0f, 1.2f, 0f, true));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "b-hurt", 1, 0, 0.2f, 0.8f, 0.2f, false));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "m-angry", 2, 0, 0.2f, 0.8f, 0.2f, false));
			}
		}

		private static void ExpressionOnHoldoutOnLevelOnMithrix(GameObject body)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			ExpressionController val = default(ExpressionController);
			if (body.TryGetComponent<ExpressionController>(ref val))
			{
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "e-blink-L", 0, 0, 0.2f, 0.8f, 0.2f, true));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "m-ha", 2, 0, 0.2f, 0.8f, 0.2f, false));
			}
		}

		private static void ExpressionOnItem(GameObject body, ItemIndex itemIndex)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			ExpressionController val = default(ExpressionController);
			if (body.TryGetComponent<ExpressionController>(ref val))
			{
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "e-surprise", 0, 0, 0.2f, 0.8f, 0.2f, false));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "m-o", 2, 0, 0.2f, 0.8f, 0.2f, false));
			}
		}

		private static void ExpressionOnDeath(GameObject body)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			ExpressionController val = default(ExpressionController);
			if (body.TryGetComponent<ExpressionController>(ref val))
			{
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "f-confused", 0, 2, 0f, float.PositiveInfinity, 0.2f, true));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "m-angry", 2, 2, 0.2f, float.PositiveInfinity, 0.2f, false));
				val.TryPlayAnimation(new BlendShapeAnimation("Enforcer_geo", "h-hide", 3, 2, 0f, float.PositiveInfinity, 0.2f, false));
			}
		}

		private static void UpdateIDRS(SkinDef skinDef)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: 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_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: 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_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: 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_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: 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_03d7: Unknown result type (might be due to invalid IL or missing references)
			DisplayRuleGroup val = new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_CritGlasses.DisplayGlasses_prefab).WaitForCompletion(),
						childName = "Head",
						localPos = new Vector3(-0.04284f, 0.0984f, -0.00064f),
						localAngles = new Vector3(277.9919f, 89.99963f, 0.00043f),
						localScale = new Vector3(0.34405f, 0.40324f, 0.32456f)
					}
				}
			};
			SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_Base_CritGlasses.CritGlasses_asset).WaitForCompletion(), val);
			DisplayRuleGroup val2 = new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_CritGlassesVoid.DisplayGlassesVoid_prefab).WaitForCompletion(),
						childName = "Head",
						localPos = new Vector3(-0.0383f, 0.16295f, -0.00063f),
						localAngles = new Vector3(277.9899f, 90f, 0.00041f),
						localScale = new Vector3(0.30591f, 0.34868f, 0.29443f)
					}
				}
			};
			SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC1_CritGlassesVoid.CritGlassesVoid_asset).WaitForCompletion(), val2);
			DisplayRuleGroup val3 = new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[2]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Hoof.DisplayHoof_prefab).WaitForCompletion(),
						childName = "CalfR",
						localPos = new Vector3(0.39686f, -0.02503f, 0.05094f),
						localAngles = new Vector3(356.2627f, 250.9105f, 96.43379f),
						localScale = new Vector3(0.07076f, 0.06421f, 0.07412f)
					},
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)1,
						limbMask = (LimbFlags)8
					}
				}
			};
			SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_Base_Hoof.Hoof_asset).WaitForCompletion(), val3);
			DisplayRuleGroup val4 = new DisplayRuleGroup
			{
				rules = (ItemDisplayRule[])(object)new ItemDisplayRule[3]
				{
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_LunarSun.DisplaySunHead_prefab).WaitForCompletion(),
						childName = "Head",
						localPos = new Vector3(-0.0647f, 0f, 0f),
						localAngles = new Vector3(0f, 0f, 0f),
						localScale = new Vector3(0.92929f, 0.92929f, 0.92929f)
					},
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_LunarSun.DisplaySunHeadNeck_prefab).WaitForCompletion(),
						childName = "Chest",
						localPos = new Vector3(-0.02286f, 0.20463f, 0.01818f),
						localAngles = new Vector3(0.29198f, 245.2626f, 11.38279f),
						localScale = new Vector3(1.38764f, 1.38764f, 1.38764f)
					},
					new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)1,
						limbMask = (LimbFlags)1
					}
				}
			};
			SkinIDRS.AddGroupOverride(skinDef, (Object)(object)Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC1_LunarSun.LunarSun_asset).WaitForCompletion(), val4);
		}

		public static void CreateVoiceGroups()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(Options.OnLoadFinished));
			voiceGroups = (VoiceGroup[])(object)new VoiceGroup[11]
			{
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { skinSelect }, 10f, 10f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { leavePod }, 0.5f, 0.5f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { idle }, 10f, 20f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { death }, 5f, 5f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { hugeFailShrine }, 5f, 5f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { leaveStage }, 10f, 10f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { heavyHeal }, 30f, 50f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { getItem }, 15f, 60f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[1] { useEquipment }, 45f, 100f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[6] { usePrimary, useSecondary, useUtility, useSpecial, hurt, jump }, 2f, 8f),
				new VoiceGroup((VoiceArray[])(object)new VoiceArray[3] { startTP, defeatTPBoss, endTP }, 5f, 10f)
			};
		}
	}
	public class Options
	{
		private static bool? _rooEnabled;

		public static bool rooEnabled
		{
			get
			{
				if (!_rooEnabled.HasValue)
				{
					_rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
				}
				return _rooEnabled.Value;
			}
		}

		public static ConfigEntry<float> hoshinoVoiceVolume { get; set; }

		private static void HoshinoVoiceVolumeSettingChanged()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			AkSoundEngine.SetRTPCValue("HoshinoEnforcerVoiceVolume", hoshinoVoiceVolume.Value * 50f);
		}

		public static void Init()
		{
			hoshinoVoiceVolume = ((BaseUnityPlugin)HoshinoEnforcerPlugin.Instance).Config.Bind<float>("Sound", "Hoshino Voice Volume", 1f, "How loud Hoshino's voice is relative to other sound effects.");
			hoshinoVoiceVolume.SettingChanged += delegate
			{
				HoshinoVoiceVolumeSettingChanged();
			};
			if (rooEnabled)
			{
				RoOInit();
			}
		}

		public static void OnLoadFinished()
		{
			HoshinoVoiceVolumeSettingChanged();
		}

		private static void RoOInit()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(hoshinoVoiceVolume, new StepSliderConfig
			{
				min = 0f,
				max = 2f,
				increment = 0.01f
			}));
			ModSettingsManager.SetModDescription("Config options relating to the Hoshino Enforcer skin mod.");
			ModSettingsManager.SetModIcon(HoshinoEnforcerPlugin.assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\HoshinoEnforcer\\Icons\\DefHoshinoEnforcerIcon.png"));
		}
	}
}
namespace DynamicSkins
{
	public static class DynamicSkinHelpers
	{
		public static SkinnedMeshRenderer[] GetBaseSkinRenderers(GameObject modelObject)
		{
			SkinnedMeshRenderer[] componentsInChildren = modelObject.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
			SkinnedMeshRenderer[] array = componentsInChildren;
			foreach (SkinnedMeshRenderer val in array)
			{
				if ((Object)(object)((Component)val).transform.parent == (Object)(object)modelObject.transform)
				{
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		public static Transform[] BoneArrayBuilder(Transform NewBoneRoot)
		{
			List<Transform> list = new List<Transform>();
			BoneArrayBuilderHelper(NewBoneRoot, list);
			return list.ToArray();
		}

		public static void BoneArrayBuilderHelper(Transform parent, List<Transform> list)
		{
			if (!((Object)parent).name.EndsWith("_end"))
			{
				list.Add(parent);
			}
			for (int i = 0; i < parent.childCount; i++)
			{
				BoneArrayBuilderHelper(parent.GetChild(i), list);
			}
		}

		public static Transform GetArmature(GameObject obj)
		{
			return GetArmatureHelper(obj);
		}

		public static Transform GetArmatureHelper(GameObject obj)
		{
			if (((Object)obj).name.ToLower().Contains("armature"))
			{
				return obj.transform;
			}
			for (int i = 0; i < obj.transform.childCount; i++)
			{
				Transform armatureHelper = GetArmatureHelper(((Component)obj.transform.GetChild(i)).gameObject);
				if (Object.op_Implicit((Object)(object)armatureHelper))
				{
					return armatureHelper;
				}
			}
			return null;
		}

		public static Transform GetTopParent(Transform obj)
		{
			Transform val = obj;
			while ((Object)(object)val.parent != (Object)null)
			{
				val = val.parent;
			}
			return val;
		}

		public static string GetPrevBoneInList(Transform targetBone, SkinnedMeshRenderer meshRenderer)
		{
			Transform[] bones = meshRenderer.bones;
			for (int i = 0; i <= bones.Length - 1; i++)
			{
				if (((Object)bones[i + 1]).name == ((Object)targetBone).name)
				{
					return ((Object)bones[i]).name;
				}
			}
			return null;
		}

		public static int GetBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer)
		{
			Transform[] bones = meshRenderer.bones;
			for (int i = 0; i <= bones.Length; i++)
			{
				if (((Object)bones[i]).name == ((Object)targetBone).name)
				{
					return i;
				}
			}
			return -1;
		}

		public static int GetPrevBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer)
		{
			Transform[] bones = meshRenderer.bones;
			for (int i = 0; i <= bones.Length - 1; i++)
			{
				if (((Object)bones[i + 1]).name == ((Object)targetBone).name)
				{
					return i;
				}
			}
			return -1;
		}
	}
	internal class DynamicSkinManager
	{
		internal Dictionary<string, SkinDef> SkinDefs = new Dictionary<string, SkinDef>();

		private GameObject LastModelObject;

		internal Dictionary<string, SortedList<int, Modification>> ModificationList = new Dictionary<string, SortedList<int, Modification>>();

		private Dictionary<GameObject, AppliedModifications> ModifiedObjects = new Dictionary<GameObject, AppliedModifications>();

		internal ManualLogSource InstanceLogger;

		internal void AddModification(string skinNameToken, int boneIndex, Modification modification)
		{
			if (!ModificationList.TryGetValue(skinNameToken, out var value))
			{
				value = new SortedList<int, Modification>();
				ModificationList.Add(skinNameToken, value);
			}
			value.Add(boneIndex, modification);
		}

		internal void AddSkinDef(SkinDef skinDef)
		{
			SkinDefs.Add(skinDef.nameToken, skinDef);
		}

		internal IEnumerator SkinDefApply(Func<SkinDef, GameObject, List<AssetReferenceT<Material>>, List<AssetReferenceT<Mesh>>, int, IEnumerator> orig, SkinDef self, GameObject modelObject, List<AssetReferenceT<Material>> loadedMaterials, List<AssetReferenceT<Mesh>> loadedMeshes, int unloadType)
		{
			IEnumerator result = orig(self, modelObject, loadedMaterials, loadedMeshes, unloadType);
			RemoveInvalidModelObjects();
			ModifiedObjects.TryGetValue(modelObject, out var value);
			try
			{
				if (!SkinDefs.TryGetValue(self.nameToken, out var _))
				{
					if (value != null)
					{
						ClearSkinModifications(LastModelObject, value);
					}
					return result;
				}
				if (value == null)
				{
					AppliedModifications appliedModifications = new AppliedModifications();
					ModifiedObjects.Add(modelObject, appliedModifications);
					ApplySkinModifications(self, modelObject, appliedModifications);
				}
			}
			catch (Exception ex)
			{
				InstanceLogger.LogWarning((object)"An error occured while adding accessories to a skin");
				InstanceLogger.LogError((object)ex);
			}
			return result;
		}

		private void RemoveInvalidModelObjects()
		{
			foreach (GameObject item in ModifiedObjects.Keys.Where((GameObject el) => !Object.op_Implicit((Object)(object)el)).ToList())
			{
				ModifiedObjects.Remove(item);
			}
		}

		private void ClearSkinModifications(GameObject modelObject, AppliedModifications modifications)
		{
			while (modifications.BaseModelModifications.Count != 0)
			{
				Modification modification = modifications.BaseModelModifications.Pop();
				clearModification(modification, modelObject, modifications);
			}
			while (modifications.OtherModifications.Count != 0)
			{
				clearModification(modifications.OtherModifications[0], modelObject, modifications);
			}
			ModifiedObjects.Remove(modelObject);
		}

		private void ApplySkinModifications(SkinDef skindef, GameObject modelObject, AppliedModifications modifications)
		{
			CharacterModel component = modelObject.GetComponent<CharacterModel>();
			LastModelObject = modelObject;
			if (!ModificationList.TryGetValue(skindef.nameToken, out var value))
			{
				return;
			}
			foreach (KeyValuePair<int, Modification> item in value)
			{
				ApplyModification(modelObject, component, item.Value, modifications);
			}
		}

		private static void ApplyModification(GameObject modelObject, CharacterModel characterModel, Modification modification, AppliedModifications modifications)
		{
			_ = modification.bodyname;
			string parentname = modification.parentname;
			Transform val = Utils.FindChildInTree(modelObject.transform, parentname);
			GameObject val2;
			if (modification.affectsbasemodel)
			{
				val2 = Object.Instantiate<GameObject>(modification.prefab, val, false);
				((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name);
				modification.instance = val2;
				modification.inst_armature = val2;
				ModificationApplyBones(modelObject, modification, modifications);
			}
			else
			{
				val2 = Object.Instantiate<GameObject>(modification.prefab, modelObject.transform, false);
				((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name);
				modification.instance = val2;
				Transform armature = DynamicSkinHelpers.GetArmature(val2);
				((Component)armature).transform.SetParent(val, false);
				modification.inst_armature = ((Component)armature).gameObject;
			}
			modification.instance = val2;
			if (modification.dynamicBoneData != null)
			{
				ModificationApplyDynamicBones(modelObject, modification);
			}
			ModificationAddRenderers(val2, characterModel);
			modifications.OtherModifications.Add(modification);
		}

		private static void ModificationApplyBones(GameObject modelObject, Modification modification, AppliedModifications modifications)
		{
			SkinnedMeshRenderer[] baseSkinRenderers = DynamicSkinHelpers.GetBaseSkinRenderers(modelObject);
			List<Transform> list = baseSkinRenderers[0].bones.ToList();
			Transform[] array = DynamicSkinHelpers.BoneArrayBuilder(modification.instance.transform);
			list.InsertRange(modification.boneIndex, array);
			modification.boneCount = array.Length;
			SkinnedMeshRenderer[] array2 = baseSkinRenderers;
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i].bones = list.ToArray();
			}
			modifications.BaseModelModifications.Push(modification);
		}

		private static void ModificationApplyDynamicBones(GameObject modelObject, Modification modification)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			DynamicBone val = (modification.inst_dynamicBone = modification.instance.AddComponent<DynamicBone>());
			List<DynamicBoneCollider> list = new List<DynamicBoneCollider>();
			foreach (DynamicBoneColliderData collider in modification.dynamicBoneData.m_Colliders)
			{
				DynamicBoneCollider val2 = ((Component)Utils.FindChildInTree(modelObject.transform, collider.m_parent_name)).gameObject.AddComponent<DynamicBoneCollider>();
				val2.m_Direction = collider.m_Direction;
				val2.m_Center = collider.m_Center;
				val2.m_Bound = collider.m_Bound;
				val2.m_Radius = collider.m_Radius;
				val2.m_Height = collider.m_Height;
				list.Add(val2);
			}
			modification.inst_DB_colliders = list;
			Transform root = (val.m_Root = Utils.FindChildInTree(modification.inst_armature.transform, modification.dynamicBoneData.m_Root));
			val.m_Damping = modification.dynamicBoneData.m_Damping;
			val.m_DampingDistrib = modification.dynamicBoneData.m_DampingDistrib;
			val.m_Elasticity = modification.dynamicBoneData.m_Elasticity;
			val.m_ElasticityDistrib = modification.dynamicBoneData.m_ElasticityDistrib;
			val.m_Stiffness = modification.dynamicBoneData.m_Stiffness;
			val.m_StiffnessDistrib = modification.dynamicBoneData.m_StiffnessDistrib;
			val.m_Inert = modification.dynamicBoneData.m_Inert;
			val.m_InertDistrib = modification.dynamicBoneData.m_InertDistrib;
			val.m_Radius = modification.dynamicBoneData.m_Radius;
			val.m_RadiusDistrib = modification.dynamicBoneData.m_RadiusDistrib;
			val.m_EndLength = modification.dynamicBoneData.m_EndLength;
			val.m_EndOffset = modification.dynamicBoneData.m_EndOffset;
			val.m_Gravity = modification.dynamicBoneData.m_Gravity;
			val.m_Force = modification.dynamicBoneData.m_Force;
			val.m_Colliders = list;
			val.m_Exclusions = new List<Transform>();
			foreach (string exclusion in modification.dynamicBoneData.m_Exclusions)
			{
				Transform val3 = Utils.FindChildInTree(root, exclusion);
				if ((Object)(object)val3 != (Object)null)
				{
					val.m_Exclusions.Add(val3);
				}
				else
				{
					Debug.LogWarning((object)"Tried to exclude a transform that could not be found");
				}
			}
			val.m_FreezeAxis = modification.dynamicBoneData.m_FreezeAxis;
		}

		private static void ModificationAddRenderers(GameObject newPart, CharacterModel characterModel)
		{
			//IL_0044: 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_0076: 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)
			SkinnedMeshRenderer[] componentsInChildren = newPart.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			Array.Resize(ref characterModel.baseRendererInfos, characterModel.baseRendererInfos.Length + componentsInChildren.Length);
			if (componentsInChildren.Length != 0)
			{
				int num = componentsInChildren.Length;
				SkinnedMeshRenderer[] array = componentsInChildren;
				foreach (SkinnedMeshRenderer val in array)
				{
					characterModel.baseRendererInfos[characterModel.baseRendererInfos.Length - num] = new RendererInfo
					{
						renderer = (Renderer)(object)componentsInChildren[^num],
						ignoreOverlays = false,
						defaultShadowCastingMode = (ShadowCastingMode)1,
						defaultMaterial = ((Renderer)val).sharedMaterial
					};
					num--;
				}
			}
		}

		private void clearModification(Modification modification, GameObject modelObject, AppliedModifications modifications)
		{
			if (modification.inst_DB_colliders != null)
			{
				foreach (DynamicBoneCollider inst_DB_collider in modification.inst_DB_colliders)
				{
					Object.Destroy((Object)(object)inst_DB_collider);
				}
			}
			if (modification.affectsbasemodel)
			{
				SkinnedMeshRenderer[] baseSkinRenderers = DynamicSkinHelpers.GetBaseSkinRenderers(modelObject);
				List<Transform> list = baseSkinRenderers[0].bones.ToList();
				list.RemoveRange(modification.boneIndex, modification.boneCount);
				SkinnedMeshRenderer[] array = baseSkinRenderers;
				for (int i = 0; i < array.Length; i++)
				{
					array[i].bones = list.ToArray();
				}
			}
			Object.Destroy((Object)(object)modifications.OtherModifications[0].inst_dynamicBone);
			Object.Destroy((Object)(object)modifications.OtherModifications[0].inst_armature);
			Object.Destroy((Object)(object)modifications.OtherModifications[0].instance);
			if (!modifications.OtherModifications.Remove(modification))
			{
				InstanceLogger.LogError((object)"Skin Modification was not removed");
			}
		}
	}
	internal class Modification
	{
		public string prefabpath;

		public string bodyname;

		public string parentname;

		public GameObject prefab;

		public bool affectsbasemodel;

		public DynamicBoneData dynamicBoneData;

		public string parentSkinToken;

		public int boneIndex;

		public int boneCount;

		public GameObject instance;

		public GameObject inst_armature;

		public DynamicBone inst_dynamicBone;

		public List<DynamicBoneCollider> inst_DB_colliders = new List<DynamicBoneCollider>();

		public Modification(string PrefabPath, string ParentName, string BodyName, string ParentSkinToken, int BoneIndex, bool AffectsBaseModel, AssetBundle assetBundle)
		{
			bodyname = BodyName;
			prefabpath = PrefabPath;
			parentname = ParentName;
			parentSkinToken = ParentSkinToken;
			affectsbasemodel = AffectsBaseModel;
			boneIndex = BoneIndex;
			prefab = assetBundle.LoadAsset<GameObject>(prefabpath);
			if ((Object)(object)prefab == (Object)null)
			{
				Debug.LogWarning((object)("Asset at " + PrefabPath + " was not loaded"));
			}
		}
	}
	internal class AppliedModifications
	{
		public Stack<Modification> BaseModelModifications = new Stack<Modification>();

		public List<Modification> OtherModifications = new List<Modification>();
	}
	internal class DynamicBoneData
	{
		public string m_Root;

		public float m_Damping;

		public AnimationCurve m_DampingDistrib;

		public float m_Elasticity;

		public AnimationCurve m_ElasticityDistrib;

		public float m_Stiffness;

		public AnimationCurve m_StiffnessDistrib;

		public float m_Inert;

		public AnimationCurve m_InertDistrib;

		public float m_Radius;

		public AnimationCurve m_RadiusDistrib;

		public float m_EndLength;

		public Vector3 m_EndOffset;

		public Vector3 m_Gravity;

		public Vector3 m_Force;

		public List<DynamicBoneColliderData> m_Colliders;

		public List<string> m_Exclusions;

		public FreezeAxis m_FreezeAxis;

		public DynamicBoneData(string root, float damping, AnimationCurve damping_dist, float elasticity, AnimationCurve elasticity_dist, float stiffness, AnimationCurve stiffness_dist, float inert, AnimationCurve inert_dist, float radius, AnimationCurve radius_dist, float end_length, Vector3 end_offset, Vector3 gravity, Vector3 force, List<DynamicBoneColliderData> colliders, List<string> exclusions, FreezeAxis freeze_axis)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			m_Root = root;
			m_Damping = damping;
			m_DampingDistrib = damping_dist;
			m_Elasticity = elasticity;
			m_ElasticityDistrib = elasticity_dist;
			m_Stiffness = stiffness;
			m_StiffnessDistrib = stiffness_dist;
			m_Inert = inert;
			m_InertDistrib = inert_dist;
			m_Radius = radius;
			m_RadiusDistrib = radius_dist;
			m_EndLength = end_length;
			m_EndOffset = end_offset;
			m_Gravity = gravity;
			m_Force = force;
			m_Colliders = colliders;
			m_Exclusions = exclusions;
			m_FreezeAxis = freeze_axis;
		}
	}
	internal class DynamicBoneColliderData
	{
		public string m_parent_name;

		public Direction m_Direction;

		public Vector3 m_Center;

		public Bound m_Bound;

		public float m_Radius;

		public float m_Height;

		public DynamicBoneColliderData(string parent_name, Direction direction, Vector3 Center, Bound bound, float radius, float heaight)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			m_parent_name = parent_name;
			m_Direction = direction;
			m_Center = Center;
			m_Bound = bound;
			m_Radius = radius;
			m_Height = heaight;
		}
	}
	internal class Utils
	{
		public static void PrintBodyCatalog()
		{
			Debug.Log((object)"\nBodyCatalog");
			foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs)
			{
				Debug.Log((object)((Object)allBodyPrefab).name);
			}
			Debug.Log((object)"\n");
		}

		public static void ReadChildren(GameObject parent, int tabs, bool includecomponents = true)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			for (int i = 0; i < tabs; i++)
			{
				text += "  ";
			}
			for (int j = 0; j < parent.transform.childCount; j++)
			{
				Transform child = parent.transform.GetChild(j);
				if ((Object)(object)child == (Object)null)
				{
					break;
				}
				string text2 = ((Component)child).gameObject.activeInHierarchy.ToString();
				Debug.Log((object)(text + ((Object)child).name + " " + text2 + " " + ((object)((Component)child).transform.position/*cast due to .constrained prefix*/).ToString()));
				if (includecomponents)
				{
					ReadComponents(((Component)child).gameObject, tabs + 1);
					Debug.Log((object)"");
				}
				ReadChildren(((Component)child).gameObject, tabs + 1, includecomponents);
			}
		}

		public static void readheiarchy(GameObject parent, bool includeComponents = true)
		{
			Debug.Log((object)((Object)parent).name);
			if (includeComponents)
			{
				ReadComponents(parent, 1);
				Debug.Log((object)"");
			}
			ReadChildren(parent, 1, includeComponents);
		}

		public static void ReadComponents(GameObject obj, int tabs)
		{
			string text = "";
			for (int i = 0; i < tabs; i++)
			{
				text += "  ";
			}
			Component[] components = obj.GetComponents(typeof(Component));
			foreach (Component val in components)
			{
				string text2 = "";
				Debug.Log((object)(text + "Comp: " + ((object)val).GetType().ToString() + "  " + text2));
			}
		}

		public static void PrintAllPaths(GameObject parent)
		{
			Debug.Log((object)((Object)parent).name);
			PrintAllPathsInner(parent, ((Object)parent).name);
		}

		private static void PrintAllPathsInner(GameObject parent, string pare