Decompiled source of Risque Fem Mercenary Skin v1.1.2

RisqueFemMerc12G.dll

Decompiled 6 months ago
using System;
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.Configuration;
using BepInEx.Logging;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using RoR2;
using RuneFoxMods;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace RuneFoxMods
{
	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_0097: 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 + " " + ((Component)child).transform.position));
				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));
			Component[] array = components;
			foreach (Component val in array)
			{
				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 parent_string)
		{
			int childCount = parent.transform.childCount;
			for (int i = 0; i < childCount; i++)
			{
				Transform child = parent.transform.GetChild(i);
				if (((Object)child).name.EndsWith("_end"))
				{
					break;
				}
				string text = parent_string + "/" + ((Object)child).name;
				Debug.Log((object)("  " + ((Object)child).name + "\t\t" + text));
				PrintAllPathsInner(((Component)child).gameObject, text);
			}
		}

		public static void PrintDynamicBone(DynamicBone DB)
		{
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Root: " + DB.m_Root));
			Debug.Log((object)("Damping: " + DB.m_Damping));
			Debug.Log((object)("Damping Dist: " + DB.m_DampingDistrib));
			Debug.Log((object)("Elasticity: " + DB.m_Elasticity));
			Debug.Log((object)("Elasticity Dist: " + DB.m_ElasticityDistrib));
			Debug.Log((object)("Stiffness: " + DB.m_Stiffness));
			Debug.Log((object)("Stiffness Dist: " + DB.m_StiffnessDistrib));
			Debug.Log((object)("Inert: " + DB.m_Inert));
			Debug.Log((object)("Inert Dist: " + DB.m_InertDistrib));
			Debug.Log((object)("Radius: " + DB.m_Radius));
			Debug.Log((object)("Radius Dist: " + DB.m_RadiusDistrib));
			Debug.Log((object)("End Length: " + DB.m_EndLength));
			Debug.Log((object)("End Offset: " + DB.m_EndOffset));
			Debug.Log((object)("Gravity: " + DB.m_Gravity));
			Debug.Log((object)("Force: " + DB.m_Force));
			Debug.Log((object)("FreezeAxis: " + DB.m_FreezeAxis));
			Debug.Log((object)("Colliders: " + DB.m_Colliders.Count));
			foreach (DynamicBoneCollider collider in DB.m_Colliders)
			{
				Debug.Log((object)("\t Parent: " + ((Object)((Component)collider).transform).name));
				Debug.Log((object)("\t Direction: " + collider.m_Direction));
				Debug.Log((object)("\t Center " + collider.m_Center));
				Debug.Log((object)("\t Bound " + collider.m_Bound));
				Debug.Log((object)("\t Radius " + collider.m_Radius));
				Debug.Log((object)("\t Height " + collider.m_Height));
			}
			Debug.Log((object)("Exclusions: " + DB.m_Exclusions.Count));
			foreach (Transform exclusion in DB.m_Exclusions)
			{
				Debug.Log((object)("\t Transform: " + ((Object)exclusion).name));
			}
		}

		public static ChildLocator GetChildLocator(GameObject body)
		{
			ChildLocator val = null;
			Transform child = body.transform.GetChild(0);
			if (Object.op_Implicit((Object)(object)child))
			{
				Transform child2 = child.GetChild(0);
				if (Object.op_Implicit((Object)(object)child2))
				{
					val = ((Component)child2).GetComponent<ChildLocator>();
					if (Object.op_Implicit((Object)(object)val))
					{
						Debug.Log((object)"Locator Found");
					}
				}
			}
			return val;
		}

		public static Transform FindChildInTree(Transform Root, string name)
		{
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(Root);
			while (queue.Count != 0)
			{
				Transform val = queue.Dequeue();
				if (((Object)val).name == name)
				{
					return val;
				}
				for (int i = 0; i < val.childCount; i++)
				{
					Transform child = val.GetChild(i);
					queue.Enqueue(child);
				}
			}
			return null;
		}

		public static string RemoveCloneNaming(string str)
		{
			return str.Remove(str.Length - 7);
		}
	}
}
namespace RisqueFemMerc12G
{
	[BepInPlugin("com.12GaugeAwayFromFace.RisqueFemMerc12G", "Risque Fem Merc 12G", "1.1.0")]
	public class RisqueFemMerc12GPlugin : BaseUnityPlugin
	{
		private class Modification
		{
			public string prefabpath;

			public string bodyname;

			public string parentname;

			public GameObject prefab;

			public bool affectsbasemodel;

			public DynamicBoneData dynamicBoneData;

			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, bool AffectsBaseModel, AssetBundle assetBundle)
			{
				bodyname = BodyName;
				prefabpath = PrefabPath;
				parentname = ParentName;
				affectsbasemodel = AffectsBaseModel;
				prefab = assetBundle.LoadAsset<GameObject>(prefabpath);
				if ((Object)(object)prefab == (Object)null)
				{
					Debug.Log((object)("Asset at " + PrefabPath + " was not loaded"));
				}
			}
		}

		private class AppliedModifications
		{
			public Stack<Modification> BaseModelModifications = new Stack<Modification>();

			public List<Modification> OtherModifications = new List<Modification>();
		}

		private 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_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				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;
			}
		}

		private 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_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: 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)
				m_parent_name = parent_name;
				m_Direction = direction;
				m_Center = Center;
				m_Bound = bound;
				m_Radius = radius;
				m_Height = heaight;
			}
		}

		private class FieldException : Exception
		{
			public FieldException(string message, Exception innerException)
				: base(message, innerException)
			{
			}
		}

		private Modification ModButtPhy;

		private Modification ModPenisPhy;

		private Modification ModBallsPhy;

		public static int skinCount = 12;

		private static GameObject LastModelObject;

		private static List<Modification> ModificationList = new List<Modification>();

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

		private static AssetBundle assetBundle;

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

		public static SkinDef SkinDef1 { get; private set; }

		public static SkinDef SkinDef2 { get; private set; }

		public static SkinDef SkinDef3 { get; private set; }

		public static SkinDef SkinDef4 { get; private set; }

		public static SkinDef SkinDef5 { get; private set; }

		public static SkinDef SkinDef6 { get; private set; }

		public static SkinDef SkinDef7 { get; private set; }

		public static SkinDef SkinDef8 { get; private set; }

		public static SkinDef SkinDef9 { get; private set; }

		public static SkinDef SkinDef10 { get; private set; }

		public static SkinDef SkinDef11 { get; private set; }

		public static SkinDef SkinDef12 { get; private set; }

		public static ConfigEntry<bool> enableHeartOrnament { get; set; }

		public static ConfigEntry<bool> enableDefaultSkin { get; set; }

		public static ConfigEntry<bool> enableMonsoonSkin { get; set; }

		public static ConfigEntry<bool> enableAquamarineSkin { get; set; }

		public static ConfigEntry<bool> enableBlankSkin { get; set; }

		public static ConfigEntry<bool> enableCanarySkin { get; set; }

		public static ConfigEntry<bool> enableForestSkin { get; set; }

		internal static RisqueFemMerc12GPlugin Instance { get; private set; }

		internal static ManualLogSource InstanceLogger
		{
			get
			{
				RisqueFemMerc12GPlugin instance = Instance;
				return (instance != null) ? ((BaseUnityPlugin)instance).Logger : null;
			}
		}

		private static void SkinDefApply(Action<SkinDef, GameObject> orig, SkinDef self, GameObject modelObject)
		{
			orig(self, modelObject);
			RemoveInvalidModelObjects();
			ModifiedObjects.TryGetValue(modelObject, out var value);
			try
			{
				if ((Object)(object)self != (Object)(object)SkinDef1 && (Object)(object)self != (Object)(object)SkinDef2 && (Object)(object)self != (Object)(object)SkinDef3 && (Object)(object)self != (Object)(object)SkinDef4 && (Object)(object)self != (Object)(object)SkinDef5 && (Object)(object)self != (Object)(object)SkinDef6 && (Object)(object)self != (Object)(object)SkinDef7 && (Object)(object)self != (Object)(object)SkinDef8 && (Object)(object)self != (Object)(object)SkinDef9 && (Object)(object)self != (Object)(object)SkinDef10 && (Object)(object)self != (Object)(object)SkinDef11 && (Object)(object)self != (Object)(object)SkinDef12)
				{
					if (value != null)
					{
						ClearSkinModifications(LastModelObject, value);
					}
				}
				else if (value == null)
				{
					AppliedModifications appliedModifications = new AppliedModifications();
					ModifiedObjects.Add(modelObject, appliedModifications);
					ApplySkinModifications(modelObject, appliedModifications);
				}
			}
			catch (Exception ex)
			{
				InstanceLogger.LogWarning((object)"An error occured while adding accessories to a skin");
				InstanceLogger.LogError((object)ex);
			}
		}

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

		private static 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 static void ApplySkinModifications(GameObject modelObject, AppliedModifications modifications)
		{
			CharacterModel component = modelObject.GetComponent<CharacterModel>();
			LastModelObject = modelObject;
			foreach (Modification modification in ModificationList)
			{
				ApplyModification(modelObject, component, modification, modifications);
			}
		}

		private static void ApplyModification(GameObject modelObject, CharacterModel characterModel, Modification modification, AppliedModifications modifications)
		{
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			string bodyname = 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;
				SkinnedMeshRenderer[] baseSkinRenderers = GetBaseSkinRenderers(modelObject);
				List<Transform> list = baseSkinRenderers[0].bones.ToList();
				int num = FindBoneIndex2(val, list);
				Transform[] array = BoneArrayBuilder(modification.instance.transform);
				list.InsertRange(num, array);
				modification.boneIndex = num;
				modification.boneCount = array.Length;
				SkinnedMeshRenderer[] array2 = baseSkinRenderers;
				foreach (SkinnedMeshRenderer val3 in array2)
				{
					val3.bones = list.ToArray();
				}
				modifications.BaseModelModifications.Push(modification);
			}
			else
			{
				val2 = Object.Instantiate<GameObject>(modification.prefab, modelObject.transform, false);
				((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name);
				modification.instance = val2;
				Transform armature = GetArmature(val2);
				((Component)armature).transform.SetParent(val, false);
				modification.inst_armature = ((Component)armature).gameObject;
			}
			modification.instance = val2;
			if (modification.dynamicBoneData != null)
			{
				DynamicBone val4 = (modification.inst_dynamicBone = modification.instance.AddComponent<DynamicBone>());
				List<DynamicBoneCollider> list2 = new List<DynamicBoneCollider>();
				foreach (DynamicBoneColliderData collider in modification.dynamicBoneData.m_Colliders)
				{
					Transform val5 = Utils.FindChildInTree(modelObject.transform, collider.m_parent_name);
					DynamicBoneCollider val6 = ((Component)val5).gameObject.AddComponent<DynamicBoneCollider>();
					val6.m_Direction = collider.m_Direction;
					val6.m_Center = collider.m_Center;
					val6.m_Bound = collider.m_Bound;
					val6.m_Radius = collider.m_Radius;
					val6.m_Height = collider.m_Height;
					list2.Add(val6);
				}
				modification.inst_DB_colliders = list2;
				Transform root = (val4.m_Root = Utils.FindChildInTree(modification.inst_armature.transform, modification.dynamicBoneData.m_Root));
				val4.m_Damping = modification.dynamicBoneData.m_Damping;
				val4.m_DampingDistrib = modification.dynamicBoneData.m_DampingDistrib;
				val4.m_Elasticity = modification.dynamicBoneData.m_Elasticity;
				val4.m_ElasticityDistrib = modification.dynamicBoneData.m_ElasticityDistrib;
				val4.m_Stiffness = modification.dynamicBoneData.m_Stiffness;
				val4.m_StiffnessDistrib = modification.dynamicBoneData.m_StiffnessDistrib;
				val4.m_Inert = modification.dynamicBoneData.m_Inert;
				val4.m_InertDistrib = modification.dynamicBoneData.m_InertDistrib;
				val4.m_Radius = modification.dynamicBoneData.m_Radius;
				val4.m_RadiusDistrib = modification.dynamicBoneData.m_RadiusDistrib;
				val4.m_EndLength = modification.dynamicBoneData.m_EndLength;
				val4.m_EndOffset = modification.dynamicBoneData.m_EndOffset;
				val4.m_Gravity = modification.dynamicBoneData.m_Gravity;
				val4.m_Force = modification.dynamicBoneData.m_Force;
				val4.m_Colliders = list2;
				val4.m_Exclusions = new List<Transform>();
				foreach (string exclusion in modification.dynamicBoneData.m_Exclusions)
				{
					Transform val7 = Utils.FindChildInTree(root, exclusion);
					if ((Object)(object)val7 != (Object)null)
					{
						val4.m_Exclusions.Add(val7);
					}
					else
					{
						Debug.Log((object)"Tried to exclude a transform that could not be found");
					}
				}
				val4.m_FreezeAxis = modification.dynamicBoneData.m_FreezeAxis;
			}
			SkinnedMeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			Array.Resize(ref characterModel.baseRendererInfos, characterModel.baseRendererInfos.Length + componentsInChildren.Length);
			if (componentsInChildren.Length != 0)
			{
				int num2 = componentsInChildren.Length;
				SkinnedMeshRenderer[] array3 = componentsInChildren;
				foreach (SkinnedMeshRenderer val8 in array3)
				{
					characterModel.baseRendererInfos[characterModel.baseRendererInfos.Length - num2] = new RendererInfo
					{
						renderer = (Renderer)(object)componentsInChildren[^num2],
						ignoreOverlays = false,
						defaultShadowCastingMode = (ShadowCastingMode)1,
						defaultMaterial = ((Renderer)val8).sharedMaterial
					};
					num2--;
				}
			}
			modifications.OtherModifications.Add(modification);
		}

		private static 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 = GetBaseSkinRenderers(modelObject);
				List<Transform> list = baseSkinRenderers[0].bones.ToList();
				list.RemoveRange(modification.boneIndex, modification.boneCount);
				SkinnedMeshRenderer[] array = baseSkinRenderers;
				foreach (SkinnedMeshRenderer val in array)
				{
					val.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");
			}
		}

		private static int FindBoneIndex(Transform targetBone, List<Transform> BoneList)
		{
			if (((Object)targetBone.parent).name.Contains("Armature"))
			{
				return BoneList.Count;
			}
			Transform parent = targetBone.parent;
			int siblingIndex = targetBone.GetSiblingIndex();
			int childCount = parent.childCount;
			if (siblingIndex == childCount - 1)
			{
				return FindBoneIndex(targetBone.parent, BoneList);
			}
			Transform nextBone = targetBone.parent.GetChild(siblingIndex + 1);
			int num = BoneList.FindIndex((Transform x) => (Object)(object)x == (Object)(object)nextBone);
			if (num == -1)
			{
				FindBoneIndex(nextBone, BoneList);
			}
			return num;
		}

		private static int FindBoneIndex2(Transform targetBone, List<Transform> BoneList)
		{
			Dictionary<Transform, bool> dictionary = new Dictionary<Transform, bool>();
			int num = 99999;
			for (int i = 0; i < BoneList.Count; i++)
			{
				Transform val = BoneList[i];
				if (((Object)val).name == "ROOT")
				{
					dictionary.Add(val, value: false);
					continue;
				}
				if ((Object)(object)val == (Object)(object)targetBone)
				{
					num = i;
				}
				Transform parent = ((Component)val).transform.parent;
				if ((Object)(object)parent == (Object)(object)targetBone)
				{
					dictionary.Add(val, value: true);
				}
				else
				{
					if (!dictionary.ContainsKey(parent))
					{
						continue;
					}
					if (dictionary[parent])
					{
						dictionary.Add(val, value: true);
						continue;
					}
					dictionary.Add(val, value: false);
					if (i > num)
					{
						return i;
					}
				}
			}
			return BoneList.Count - 1;
		}

		private 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();
		}

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

		private 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);
			}
		}

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

		private 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;
		}

		private void Start()
		{
			enableHeartOrnament = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable the Heart Ornament on the Helmet", "Select true or false", false, "False) Default Ornament / True) Heart Ornament");
			enableDefaultSkin = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable the Sellsword Skin", "Select true or false", true, "True) On / False) Off");
			enableMonsoonSkin = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable the Crimson Blade Skin", "Select true or false", true, "True) On / False) Off");
			enableAquamarineSkin = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable the Wave Ripper Skin", "Select true or false", true, "True) On / False) Off");
			enableBlankSkin = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable the Grand Army Skin", "Select true or false", true, "True) On / False) Off");
			enableCanarySkin = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable the Swift Canary Skin", "Select true or false", true, "True) On / False) Off");
			enableForestSkin = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable the Armed Forces Skin", "Select true or false", true, "True) On / False) Off");
			Instance = this;
			BeforeStart();
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RisqueFemMerc12G.12gaugeawayfromfacerisquefemmerc12g"))
			{
				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()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			for (int i = 0; i < skinCount; i++)
			{
				new Hook((MethodBase)typeof(SkinDef).GetMethod("Apply"), (Delegate)new Action<Action<SkinDef, GameObject>, SkinDef, GameObject>(SkinDefApply)).Apply();
			}
		}

		private void AfterStart()
		{
			//IL_005e: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			ModButtPhy = new Modification("buttRoot.prefab", "pelvis", "MercBody", AffectsBaseModel: true, assetBundle);
			ModButtPhy.dynamicBoneData = new DynamicBoneData("buttRoot", 0.111f, null, 0.05f, null, 0.759f, null, 0.713f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "buttRoot" }, (FreezeAxis)0);
			ModificationList.Add(ModButtPhy);
			ModBallsPhy = new Modification("ballRoot.prefab", "pelvis", "MercBody", AffectsBaseModel: true, assetBundle);
			ModBallsPhy.dynamicBoneData = new DynamicBoneData("ballRoot", 0.142f, null, 0.05f, null, 0.654f, null, 0.623f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, -0.1f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "ballRoot" }, (FreezeAxis)0);
			ModificationList.Add(ModBallsPhy);
			ModPenisPhy = new Modification("penisRoot.prefab", "pelvis", "MercBody", AffectsBaseModel: true, assetBundle);
			ModPenisPhy.dynamicBoneData = new DynamicBoneData("penisRoot", 0.277f, null, 0.05f, null, 0.418f, null, 0.711f, null, 0.05f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, -0.1f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "penisRoot" }, (FreezeAxis)0);
			ModificationList.Add(ModPenisPhy);
		}

		private static void ReplaceShaders()
		{
			LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/Assets/merc/Risque Fem Merc/matFemMerc.mat", "Assets/Assets/merc/Risque Fem Merc/matFemMercMonsoon.mat", "Assets/Assets/merc/Risque Fem Merc/matFemMercAquamarine.mat", "Assets/Assets/merc/Risque Fem Merc/matFemMercBlank.mat", "Assets/Assets/merc/Risque Fem Merc/matFemMercCanary.mat", "Assets/Assets/merc/Risque Fem Merc/matFemMercForest.mat");
		}

		private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			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("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCSKINDEF_NAME", "Sellsword");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCMONSOONSKINDEF_NAME", "Crimson Wind");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCAQUAMARINESKINDEF_NAME", "Wave Ripper");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCBLANKSKINDEF_NAME", "Grand Army");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCCANARYSKINDEF_NAME", "Swift Canary");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCFORESTSKINDEF_NAME", "Armed Forces");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCHEARTSKINDEF_NAME", "Sellsword");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCMONSOONHEARTSKINDEF_NAME", "Crimson Wind");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCAQUAMARINEHEARTSKINDEF_NAME", "Wave Ripper");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCBLANKHEARTSKINDEF_NAME", "Grand Army");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCCANARYHEARTSKINDEF_NAME", "Swift Canary");
			self.SetStringByToken("12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCFORESTHEARTSKINDEF_NAME", "Armed Forces");
		}

		private static void Nothing(Action<SkinDef> orig, SkinDef self)
		{
		}

		private static void BodyCatalogInit()
		{
			MethodInfo method = typeof(SkinDef).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic);
			HookEndpointManager.Add((MethodBase)method, (Delegate)new Action<Action<SkinDef>, SkinDef>(Nothing));
			if (!enableHeartOrnament.Value)
			{
				if (enableDefaultSkin.Value)
				{
					AddMercBodyRisqueFemMercSkinDefSkin();
				}
				if (enableMonsoonSkin.Value)
				{
					AddMercBodyRisqueFemMercMonsoonSkinDefSkin();
				}
				if (enableAquamarineSkin.Value)
				{
					AddMercBodyRisqueFemMercAquamarineSkinDefSkin();
				}
				if (enableBlankSkin.Value)
				{
					AddMercBodyRisqueFemMercBlankSkinDefSkin();
				}
				if (enableCanarySkin.Value)
				{
					AddMercBodyRisqueFemMercCanarySkinDefSkin();
				}
				if (enableForestSkin.Value)
				{
					AddMercBodyRisqueFemMercForestSkinDefSkin();
				}
			}
			if (enableHeartOrnament.Value)
			{
				if (enableDefaultSkin.Value)
				{
					AddMercBodyRisqueFemMercHeartSkinDefSkin();
				}
				if (enableMonsoonSkin.Value)
				{
					AddMercBodyRisqueFemMercMonsoonHeartSkinDefSkin();
				}
				if (enableAquamarineSkin.Value)
				{
					AddMercBodyRisqueFemMercAquamarineHeartSkinDefSkin();
				}
				if (enableBlankSkin.Value)
				{
					AddMercBodyRisqueFemMercBlankHeartSkinDefSkin();
				}
				if (enableCanarySkin.Value)
				{
					AddMercBodyRisqueFemMercCanaryHeartSkinDefSkin();
				}
				if (enableForestSkin.Value)
				{
					AddMercBodyRisqueFemMercForestHeartSkinDefSkin();
				}
			}
			HookEndpointManager.Remove((MethodBase)method, (Delegate)new Action<Action<SkinDef>, SkinDef>(Nothing));
		}

		private static void MercBodyRisqueFemMercSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef1 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMerc.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMerc.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercMonsoonSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef2 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercMonsoonSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercMonsoonSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercMonsoonSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCMONSOONSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercMonsoon.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercMonsoon.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercMonsoonSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercAquamarineSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef3 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercAquamarineSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercAquamarineSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercAquamarineSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCAQUAMARINESKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercAquamarine.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercAquamarine.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercAquamarineSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercBlankSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef4 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercBlankSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercBlankSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercBlankSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCBLANKSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercBlank.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercBlank.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercBlankSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercCanarySkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef5 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercCanarySkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercCanarySkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercCanarySkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCCANARYSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercCanary.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercCanary.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercCanarySkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercForestSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef6 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercForestSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercForestSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercForestSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCFORESTSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercForest.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercForest.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercForestSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercHeartSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef7 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercHeartSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercHeartSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercHeartSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCHEARTSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMerc.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMerc.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final Heart.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercHeartSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercMonsoonHeartSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef8 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercMonsoonHeartSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercMonsoonHeartSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercMonsoonHeartSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCMONSOONHEARTSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercMonsoon.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercMonsoon.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final Heart.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercMonsoonHeartSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercAquamarineHeartSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef9 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercAquamarineHeartSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercAquamarineHeartSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercAquamarineHeartSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCAQUAMARINEHEARTSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercAquamarine.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercAquamarine.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercAquamarineHeartSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercBlankHeartSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef10 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercBlankHeartSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercBlankHeartSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercBlankHeartSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCBLANKHEARTSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercBlank.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercBlank.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercBlankHeartSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercCanaryHeartSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef11 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercCanaryHeartSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercCanaryHeartSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercCanaryHeartSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCCANARYHEARTSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercCanary.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercCanary.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\Fem Merc Body Final.mesh"),
							renderer = renderers[8]
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\RisqueFemMerc12G\\Meshes\\SwordNew.mesh"),
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins;
				MercBodyRisqueFemMercCanaryHeartSkinDefSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				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 ex2)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex2);
			}
		}

		private static void MercBodyRisqueFemMercForestHeartSkinDefSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SkinDef12 = skinDef;
		}

		private static void AddMercBodyRisqueFemMercForestHeartSkinDefSkin()
		{
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			string text = "MercBody";
			string text2 = "RisqueFemMercForestHeartSkinDef";
			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);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\RisqueFemMerc12G\\Icons\\RisqueFemMercForestHeartSkinDefIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "12GAUGEAWAYFROMFACE_SKIN_RISQUEFEMMERCFORESTHEARTSKINDEF_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[1] };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skin.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_0091: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercForest.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[8]
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Assets/merc/Risque Fem Merc/matFemMercForest.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)1,
							ignoreOverlays = false,
							renderer = renderers[7]
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
					skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshRep