Decompiled source of BurdenGrowth v0.9.5

BurdenGrowth.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HG;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2.SurvivorMannequins;
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.Networking;
using UnityEngine.PlayerLoop;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BurdenGrowth")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BurdenGrowth")]
[assembly: AssemblyTitle("BurdenGrowth")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BurdenGrowth
{
	internal static class Bulge
	{
		public class Made
		{
			public SkinnedMeshRenderer r;

			public Mesh src;

			public Mesh gen;

			public Bounds restBounds;

			public int belly = -1;

			public int toy = -1;

			public int bust = -1;

			public int rear = -1;

			public int thick = -1;

			public int penis = -1;

			public float lastBelly = -1f;

			public float lastToy = -1f;

			public bool Active
			{
				get
				{
					if (Object.op_Implicit((Object)(object)r))
					{
						return (Object)(object)r.sharedMesh == (Object)(object)gen;
					}
					return false;
				}
			}

			public void Undo()
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					if (Active && Object.op_Implicit((Object)(object)src))
					{
						float[] array = Weights(r, src.blendShapeCount);
						r.sharedMesh = src;
						for (int i = 0; i < array.Length; i++)
						{
							r.SetBlendShapeWeight(i, array[i]);
						}
						((Renderer)r).localBounds = restBounds;
					}
				}
				catch (Exception) when (!Object.op_Implicit((Object)(object)r) || !Object.op_Implicit((Object)(object)src))
				{
				}
				if (Object.op_Implicit((Object)(object)gen))
				{
					Object.Destroy((Object)(object)gen);
				}
			}
		}

		public class Toy
		{
			public float sigmaHi;

			public float[] sigmas;

			public float[] stacks;

			public bool place;

			public Vector3 localPos;

			public bool pinned;

			public Vector3 pin;

			public Vector3 pinGrown;

			public Matrix4x4 meshLocal;

			public float lenMul = 1f;

			public float lenGrown = 1f;

			public Vector3 outerC;

			public Vector3 outerPerLen;

			public bool aimed;

			public Quaternion localRot;

			public Vector3 baseShift;

			public Transform spare;

			private static ItemIndex[] herIdx;

			private readonly List<Transform> live = new List<Transform>();

			private static readonly Dictionary<Transform, (float set, float raw)> written = new Dictionary<Transform, (float, float)>();

			public float spareRaw;

			public float ShownLen { get; private set; } = -1f;

			public float LenAt(float buttLevel)
			{
				return QuantLen(Mathf.Lerp(lenMul, lenGrown, buttLevel));
			}

			public void Refresh(CharacterModel cm)
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_003e: Invalid comparison between Unknown and I4
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				live.Clear();
				if (!Object.op_Implicit((Object)(object)cm))
				{
					return;
				}
				if (herIdx == null || herIdx.Length == 0)
				{
					List<ItemIndex> list = new List<ItemIndex>();
					string[] herNames = HerNames;
					for (int i = 0; i < herNames.Length; i++)
					{
						ItemIndex val = ItemCatalog.FindItemIndex(herNames[i]);
						if ((int)val != -1)
						{
							list.Add(val);
						}
					}
					herIdx = list.ToArray();
				}
				ItemIndex[] array = herIdx;
				foreach (ItemIndex val2 in array)
				{
					List<GameObject> itemDisplayObjects = cm.GetItemDisplayObjects(val2);
					if (itemDisplayObjects == null)
					{
						continue;
					}
					foreach (GameObject item in itemDisplayObjects)
					{
						if (Object.op_Implicit((Object)(object)item))
						{
							live.Add(item.transform);
						}
					}
				}
			}

			private static float RawOf(Transform t)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				if (!written.TryGetValue(t, out (float, float) value) || !(Mathf.Abs(t.localScale.x - value.Item1) < 1E-07f))
				{
					return t.localScale.x;
				}
				return value.Item2;
			}

			public float LiveMax()
			{
				float num = (Object.op_Implicit((Object)(object)spare) ? spareRaw : 0f);
				foreach (Transform item in live)
				{
					if (Object.op_Implicit((Object)(object)item))
					{
						num = Mathf.Max(num, RawOf(item));
					}
				}
				return num;
			}

			public void Place(Toy geo, float buttLevel)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				Vector3 pinNow = Vector3.Lerp(geo.pin, geo.pinGrown, buttLevel);
				Vector3 outer = geo.outerC + geo.outerPerLen * ((ShownLen > 0f) ? ShownLen : geo.LenAt(buttLevel));
				foreach (Transform item in live)
				{
					Do(item);
				}
				Do(spare);
				void Do(Transform t)
				{
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_009a: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
					//IL_0057: Unknown result type (might be due to invalid IL or missing references)
					//IL_005d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_007e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0083: Unknown result type (might be due to invalid IL or missing references)
					//IL_0088: Unknown result type (might be due to invalid IL or missing references)
					//IL_008d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					//IL_003a: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
					if (Object.op_Implicit((Object)(object)t))
					{
						if (geo.aimed && Quaternion.Angle(t.localRotation, geo.localRot) > 0.01f)
						{
							t.localRotation = geo.localRot;
						}
						Vector3 val = (geo.pinned ? (pinNow - t.localRotation * (t.localScale.x * ((Matrix4x4)(ref geo.meshLocal)).MultiplyPoint3x4(outer))) : (geo.localPos + t.localRotation * (t.localScale.x * ((Matrix4x4)(ref geo.meshLocal)).MultiplyVector(geo.baseShift))));
						Vector3 val2 = t.localPosition - val;
						if (((Vector3)(ref val2)).sqrMagnitude > 1E-12f)
						{
							t.localPosition = val;
						}
					}
				}
			}

			public void Restyle(float length)
			{
				foreach (Transform item in live)
				{
					Do(item);
				}
				Do(spare);
				ShownLen = length;
				void Do(Transform t)
				{
					if (Object.op_Implicit((Object)(object)t))
					{
						MeshFilter[] componentsInChildren = ((Component)t).GetComponentsInChildren<MeshFilter>(true);
						foreach (MeshFilter val in componentsInChildren)
						{
							Mesh val2 = StretchedToy(val.sharedMesh, length);
							if (Object.op_Implicit((Object)(object)val2) && (Object)(object)val.sharedMesh != (Object)(object)val2)
							{
								val.sharedMesh = val2;
							}
						}
					}
				}
			}

			public void Enlarge(float mul)
			{
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				if (written.Count > 64)
				{
					List<Transform> list = new List<Transform>();
					foreach (Transform key in written.Keys)
					{
						if (!Object.op_Implicit((Object)(object)key))
						{
							list.Add(key);
						}
					}
					foreach (Transform item in list)
					{
						written.Remove(item);
					}
				}
				foreach (Transform item2 in live)
				{
					if (Object.op_Implicit((Object)(object)item2))
					{
						float num = RawOf(item2);
						float num2 = num * mul;
						if (Mathf.Abs(item2.localScale.x - num2) > 1E-07f)
						{
							item2.localScale = Vector3.one * num2;
						}
						written[item2] = (num2, num);
					}
				}
			}
		}

		private class Ctx
		{
			public Transform model;

			public Transform pelvis;

			public Transform chest;

			public HashSet<Transform> torso;

			public bool wantBelly;

			public bool wantBust;

			public bool wantRear;

			public bool bustyOnly;

			public bool ownBust;

			public List<Transform> penisRoots;

			public List<Transform> ownBustBones;

			public List<Transform> ownRearBones;

			public bool genBust;

			public bool genRear;

			public float[] partScale;

			public Torso frame;

			public Lobes lobes;

			public ToyGeom toy;

			public List<(Transform t, Matching.Part part)> grown;

			public int fat;

			public float fatY;

			public float fatR;

			public Legs legs;

			public bool hasButtMid;

			public Vector3 buttMid;

			public List<Vector3> cheekC;

			public List<float> cheekR;

			public float bubbleInward;

			public Vector3[] bodyPv;

			public Vector3[] bodyPn;

			public Lobes cheeks;
		}

		private class Lobes
		{
			public Vector3 bL;

			public Vector3 bR;

			public Vector3 rL;

			public Vector3 rR;

			public float bRad;

			public float rRad;

			public float cleavage;

			public bool bust;

			public bool busty;

			public bool rear;
		}

		private class Torso
		{
			public Vector3 u;

			public Vector3 f;

			public Vector3 side;

			public float Lt;

			public float depth;

			public float width;

			public float normalSign = 1f;

			public float a0;

			public float Rx;

			public float Ry;

			public float A;
		}

		private class Legs
		{
			public readonly Vector3[] hip = (Vector3[])(object)new Vector3[2];

			public readonly Vector3[] axis = (Vector3[])(object)new Vector3[2];

			public readonly float[] len = new float[2];
		}

		private class ToyGeom
		{
			public Matrix4x4 meshLocal;

			public Vector3 localPos;

			public Quaternion localRot;

			public Vector3 endA;

			public Vector3 endB;

			public float meshRadius;

			public float[] sigmas;

			public float[] stacks;

			public float sigmaHi;

			public bool flipped;

			public bool placed;

			public float L0;

			public float lenMul;

			public float lenGrown;

			public bool pinned;

			public Vector3 pin;

			public Vector3 pinGrown;

			public bool aimed;

			public bool hasWomb;

			public Vector3 womb;

			public float buttLevel = 1f;

			public float[] parting;

			public bool titjob;

			public Vector3 exitP;

			public Vector3 exitPGrown;

			public Vector3 Center
			{
				get
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_0027: Unknown result type (might be due to invalid IL or missing references)
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					//IL_0037: Unknown result type (might be due to invalid IL or missing references)
					Vector3 val = endA - endB;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					return endB + normalized * Vector3.Dot(-endB, normalized);
				}
			}

			public Vector3 OuterPerLen => ((flipped ? endA : endB) - Center) / Mathf.Max(L0, 0.0001f);

			public Vector3 BaseShift => EndAt(flipped ? endA : endB, 1f) - OuterEnd;

			public Vector3 OuterEnd => End(flipped ? endA : endB);

			public Vector3 InnerEnd => End(flipped ? endB : endA);

			public Vector3 End(Vector3 e)
			{
				//IL_0001: 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)
				return EndAt(e, QuantLen(Mathf.Lerp(lenMul, lenGrown, buttLevel)));
			}

			private Vector3 EndAt(Vector3 e, float len)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				Vector3 center = Center;
				return center + (e - center) * (len / Mathf.Max(L0, 0.0001f));
			}

			public Vector3 PosFor(float scale)
			{
				//IL_0037: 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_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				if (!pinned)
				{
					return localPos + localRot * (scale * ((Matrix4x4)(ref meshLocal)).MultiplyVector(BaseShift));
				}
				return Vector3.Lerp(pin, pinGrown, buttLevel) - localRot * (scale * ((Matrix4x4)(ref meshLocal)).MultiplyPoint3x4(OuterEnd));
			}

			public void At(float sigma, out Vector3 tip, out Vector3 bas, out float radius)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				Matrix4x4 val = Matrix4x4.TRS(PosFor(sigma), localRot, Vector3.one * sigma) * meshLocal;
				tip = ((Matrix4x4)(ref val)).MultiplyPoint3x4(InnerEnd);
				bas = ((Matrix4x4)(ref val)).MultiplyPoint3x4(OuterEnd);
				Vector3 val2 = ((Matrix4x4)(ref val)).MultiplyVector(MeshPerp(endA - endB));
				radius = ((Vector3)(ref val2)).magnitude * meshRadius;
			}

			private static Vector3 MeshPerp(Vector3 axis)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				Vector3 normalized = ((Vector3)(ref axis)).normalized;
				Vector3 val = Vector3.Cross(normalized, (Mathf.Abs(normalized.x) < 0.9f) ? Vector3.right : Vector3.up);
				return ((Vector3)(ref val)).normalized;
			}
		}

		public class SparePlan
		{
			public GameObject template;

			public Transform pelvis;

			public Vector3 localPos;

			public Quaternion localRot;

			public Matrix4x4 meshLocal;

			public Vector3 tip;

			public Vector3 bas;

			public float radius;

			public float sMax;

			public float step;

			public float maxSize;

			public float Scale(float stacks)
			{
				return sMax * Mathf.Min(1f + Mathf.Max(0f, stacks) * step, maxSize) / maxSize;
			}

			public float StacksFor(float scale)
			{
				if (!(step > 0f))
				{
					return Plugin.MaxStacks.Value;
				}
				return (scale / sMax * maxSize - 1f) / step;
			}
		}

		public const string BellyShape = "BG Stuffed";

		public const string ToyShape = "BG ToyPress";

		public const string BustShape = "BG Bust";

		public const string RearShape = "BG Rear";

		public const string ThickShape = "BG Thick";

		public const string ShaftShape = "BG Length";

		private static readonly Vector3 ToyExtents = new Vector3(2.418f, 6.724f, 6.724f);

		private const float ToyHandle = 0.23f;

		private const float NeckHeight = 1.1f;

		private const float CrystalBaseScale = 0.0125f;

		private static readonly string[] HerNames = new string[6] { "HERBURDEN", "HERRECLUSE", "HERFURY", "HERTORPOR", "HERRANCOR", "HERPANIC" };

		private static GameObject template;

		private static Type templateSize;

		private static bool templateLooked;

		private static Vector3 tTip;

		private static Vector3 tBase;

		private static float tRadius;

		private static readonly Dictionary<(Mesh, float, float), Mesh> stretched = new Dictionary<(Mesh, float, float), Mesh>();

		private static readonly HashSet<Mesh> made = new HashSet<Mesh>();

		private static readonly Dictionary<Mesh, Mesh> sourceOf = new Dictionary<Mesh, Mesh>();

		[ThreadStatic]
		private static float[] partScaleNow;

		[ThreadStatic]
		private static bool aimMid;

		[ThreadStatic]
		private static Vector3 aimMidAt;

		private static readonly string[] PelvisNames = new string[12]
		{
			"pelvis", "hips", "hip", "bip001 pelvis", "bip01 pelvis", "root_pelvis", "c_pelvis", "pelvis_jnt", "j_pelvis", "bone_0002",
			"PlatformBase", "spine.000"
		};

		private static readonly string[] RobotMeshes = new string[6] { "TreebotBotMesh", "TreebotFlowerMesh", "TreebotLeafletMesh", "meshTreebotBotColossus", "rex_mech", "TreeBotMesh" };

		private static readonly string[] ChestNames = new string[19]
		{
			"chest", "upperchest", "upper_chest", "spine2", "spine_02", "spine02", "spine.002", "bip001 spine2", "bip01 spine2", "spine3",
			"spine_03", "ribcage", "spine1", "spine_01", "spine.001", "bip001 spine1", "torso", "bone_0005", "ArmPlatformBase"
		};

		private static bool MeasureToyMesh(Mesh m, out Vector3 endA, out Vector3 endB, out float radius)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: 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_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01df: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (endA = (endB = Vector3.zero));
			radius = 0f;
			Mesh val2 = null;
			Vector3[] array;
			try
			{
				array = (m.isReadable ? m.vertices : (Object.op_Implicit((Object)(object)(val2 = MeshCopy.Make(m, out var _))) ? val2.vertices : null));
			}
			finally
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					Object.Destroy((Object)(object)val2);
				}
			}
			if (array == null || array.Length < 10)
			{
				return false;
			}
			Vector3 val3 = Vector3.zero;
			Vector3[] array2 = array;
			foreach (Vector3 val4 in array2)
			{
				val3 += val4;
			}
			val3 /= (float)array.Length;
			val = new Vector3(0.3f, 0.6f, 0.7f);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			for (int j = 0; j < 40; j++)
			{
				Vector3 val5 = Vector3.zero;
				array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					Vector3 val6 = array2[i] - val3;
					val5 += val6 * Vector3.Dot(val6, normalized);
				}
				if (((Vector3)(ref val5)).sqrMagnitude < 1E-20f)
				{
					return false;
				}
				normalized = ((Vector3)(ref val5)).normalized;
			}
			float num = float.MaxValue;
			float num2 = float.MinValue;
			array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				float num3 = Vector3.Dot(array2[i] - val3, normalized);
				num = Mathf.Min(num, num3);
				num2 = Mathf.Max(num2, num3);
			}
			List<float> list = new List<float>();
			array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				Vector3 val7 = array2[i] - val3;
				float num4 = Vector3.Dot(val7, normalized);
				if (num4 > num + 0.1f * (num2 - num) && num4 < num2 - 0.1f * (num2 - num))
				{
					val = val7 - normalized * num4;
					list.Add(((Vector3)(ref val)).magnitude);
				}
			}
			endA = val3 + normalized * num2;
			endB = val3 + normalized * num;
			radius = Growth.Percentile(list, 0.95f);
			if (radius > 0f)
			{
				return num2 > num;
			}
			return false;
		}

		public static string Apply(Transform model, CharacterBody body, bool wantBelly, bool wantToy, float toyAtLeast, bool wantBust, bool wantRear, bool bustyOnly, bool ownBust, List<Transform> penisRoots, List<(Transform t, Vector3 rest, Matching.Part part)> grownBones, List<Made> made, out Toy toy, List<Transform> ownBustBones = null, List<Transform> ownRearBones = null, bool genBust = true, bool genRear = true, float[] partScale = null)
		{
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Unknown result type (might be due to invalid IL or missing references)
			//IL_061a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			toy = null;
			Stopwatch stopwatch = Stopwatch.StartNew();
			ChildLocator component = ((Component)model).GetComponent<ChildLocator>();
			Transform val = (Object.op_Implicit((Object)(object)component) ? Find(component, "Pelvis", "Hip", "Base") : null) ?? ByName(model, PelvisNames);
			Transform val2 = (Object.op_Implicit((Object)(object)component) ? Find(component, "Chest", "Stomach", "Head") : null);
			if (Object.op_Implicit((Object)(object)val) && (!Object.op_Implicit((Object)(object)val2) || (Object)(object)val2 == (Object)(object)val || !val2.IsChildOf(Object.op_Implicit((Object)(object)val.parent) ? val.parent : val)))
			{
				val2 = null;
			}
			if (!Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val))
			{
				val2 = ByName(model, ChestNames, Object.op_Implicit((Object)(object)val.parent) ? val.parent : val);
			}
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || (Object)(object)val == (Object)(object)val2)
			{
				return "bulge: no Pelvis/Chest bones";
			}
			Ctx ctx = new Ctx
			{
				model = model,
				pelvis = val,
				chest = val2,
				torso = TorsoBones(val, val2),
				wantBelly = wantBelly,
				grown = new List<(Transform, Matching.Part)>(),
				wantBust = wantBust,
				wantRear = wantRear,
				bustyOnly = bustyOnly,
				ownBust = ownBust,
				penisRoots = penisRoots,
				ownBustBones = ownBustBones,
				ownRearBones = ownRearBones,
				genBust = genBust,
				genRear = genRear,
				partScale = partScale
			};
			foreach (var (val3, _, item) in grownBones)
			{
				if (Object.op_Implicit((Object)(object)val3))
				{
					ctx.grown.Add((val3, item));
				}
			}
			string note = "";
			if (wantToy)
			{
				ctx.toy = MakeToy(model, body, component, val, toyAtLeast, out note);
			}
			bool flag = (Plugin.ButtFat.Value > 0f || Plugin.RoundButt.Value > 0f) && ctx.grown.Exists(((Transform t, Matching.Part part) gb) => gb.part == Matching.Part.Butt);
			if (!wantBelly && !wantBust && !wantRear && ctx.toy == null && ownBustBones == null && ownRearBones == null && !flag)
			{
				return "bulge: nothing to build" + note;
			}
			List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
			SkinnedMeshRenderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val4 in componentsInChildren)
			{
				if (((Component)val4).gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)val4.sharedMesh) && !Object.op_Implicit((Object)(object)((Component)val4).GetComponentInParent<ItemDisplay>()))
				{
					list.Add(val4);
				}
			}
			if (list.Count == 0)
			{
				return "bulge: no meshes";
			}
			list.Sort((SkinnedMeshRenderer a, SkinnedMeshRenderer b) => b.sharedMesh.vertexCount.CompareTo(a.sharedMesh.vertexCount));
			List<string> list2 = new List<string>();
			bool wantBelly2 = ctx.wantBelly;
			bool wantBust2 = ctx.wantBust;
			bool wantRear2 = ctx.wantRear;
			ToyGeom toy2 = ctx.toy;
			int num2 = -1;
			string text = null;
			for (int num3 = 0; num3 < Math.Min(list.Count, 8); num3++)
			{
				if (num2 >= 0)
				{
					break;
				}
				Made made2;
				string note2;
				bool notBody;
				try
				{
					made2 = One(list[num3], ctx, main: true, out note2, out notBody);
				}
				catch (Exception ex)
				{
					made2 = null;
					notBody = false;
					note2 = "failed: " + ex.GetType().Name + " " + ex.Message;
				}
				if (made2 != null)
				{
					made.Add(made2);
					num2 = num3;
					list2.Add(((Object)list[num3]).name + " " + note2);
					break;
				}
				text = text ?? (((Object)list[num3].sharedMesh).name + " " + note2);
				ctx.frame = null;
				ctx.lobes = null;
				ctx.cheekC = null;
				ctx.hasButtMid = false;
				ctx.wantBelly = wantBelly2;
				ctx.wantBust = wantBust2;
				ctx.wantRear = wantRear2;
				ctx.toy = toy2;
				if (!notBody)
				{
					break;
				}
			}
			if (num2 < 0)
			{
				return "bulge: main mesh " + text + note;
			}
			for (int num4 = 0; num4 < list.Count; num4++)
			{
				if (num4 != num2)
				{
					Made made3;
					string note3;
					try
					{
						made3 = One(list[num4], ctx, main: false, out note3, out var _);
					}
					catch (Exception ex2)
					{
						made3 = null;
						note3 = "failed: " + ex2.GetType().Name + " " + ex2.Message;
					}
					if (made3 != null)
					{
						made.Add(made3);
						list2.Add(((Object)list[num4]).name + " " + note3);
					}
				}
			}
			if (ctx.toy != null)
			{
				toy = new Toy
				{
					sigmaHi = ctx.toy.sigmaHi,
					sigmas = ctx.toy.sigmas,
					stacks = ctx.toy.stacks,
					place = true,
					localPos = ctx.toy.localPos,
					pinned = ctx.toy.pinned,
					pin = ctx.toy.pin,
					pinGrown = ctx.toy.pinGrown,
					outerC = ctx.toy.Center,
					outerPerLen = ctx.toy.OuterPerLen,
					meshLocal = ctx.toy.meshLocal,
					lenMul = ctx.toy.lenMul,
					lenGrown = ctx.toy.lenGrown,
					aimed = ctx.toy.aimed,
					localRot = ctx.toy.localRot,
					baseShift = ctx.toy.BaseShift
				};
			}
			Torso frame = ctx.frame;
			string text2 = ((frame != null) ? string.Format(" | torso {0:0.###} depth {1:0.###} width {2:0.###}{3}{4}", frame.Lt, frame.depth, frame.width, (frame.normalSign < 0f) ? " (inward normals)" : "", ctx.wantBelly ? $" push {frame.A:0.###}" : "") : "");
			if (ctx.lobes != null)
			{
				text2 += string.Format(" | bust {0} (cleavage {1:0.00})", ctx.lobes.busty ? "found" : "not found", ctx.lobes.cleavage);
			}
			return string.Format("bulge ({0} ms): {1}{2}{3}", stopwatch.ElapsedMilliseconds, string.Join("; ", list2), text2, note);
		}

		private static Made One(SkinnedMeshRenderer r, Ctx c, bool main, out string note, out bool notBody)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: 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)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0800: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0873: Unknown result type (might be due to invalid IL or missing references)
			//IL_087f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c90: Unknown result type (might be due to invalid IL or missing references)
			//IL_1142: Unknown result type (might be due to invalid IL or missing references)
			//IL_1147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0caa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1662: Unknown result type (might be due to invalid IL or missing references)
			//IL_1667: Unknown result type (might be due to invalid IL or missing references)
			//IL_166d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1672: Unknown result type (might be due to invalid IL or missing references)
			//IL_1676: Unknown result type (might be due to invalid IL or missing references)
			//IL_167b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1699: Unknown result type (might be due to invalid IL or missing references)
			//IL_169e: Unknown result type (might be due to invalid IL or missing references)
			//IL_16a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_16ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_16b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_16b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0edd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eeb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef5: Unknown result type (might be due to invalid IL or missing references)
			//IL_16ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_16f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_170b: Unknown result type (might be due to invalid IL or missing references)
			notBody = true;
			Mesh sharedMesh = r.sharedMesh;
			Transform[] bones = r.bones;
			Matrix4x4[] bindposes = sharedMesh.bindposes;
			if (bones == null || bindposes == null || bindposes.Length == 0)
			{
				note = "not skinned";
				return null;
			}
			int num = Array.IndexOf(bones, c.pelvis);
			if (num < 0 || num >= bindposes.Length)
			{
				note = "not skinned to the pelvis";
				return null;
			}
			Matrix4x4 Mp = ((Matrix4x4)(ref bindposes[num])).inverse;
			Matrix4x4 pm = bindposes[num];
			if (!main && c.frame == null)
			{
				note = "no torso";
				return null;
			}
			if (Array.IndexOf(RobotMeshes, ((Object)sharedMesh).name) >= 0 && sharedMesh.vertexCount <= 20000)
			{
				note = "REX's robot body";
				return null;
			}
			string how;
			Mesh val = MeshCopy.Make(sharedMesh, out how);
			if (!Object.op_Implicit((Object)(object)val))
			{
				note = how;
				notBody = false;
				return null;
			}
			try
			{
				Vector3[] vertices = val.vertices;
				Vector3[] normals = val.normals;
				BoneWeight[] boneWeights = val.boneWeights;
				int N = vertices.Length;
				bool flag = normals != null && normals.Length == N;
				bool flag2 = boneWeights != null && boneWeights.Length == N;
				float[] array = Membership(bones, boneWeights, flag2, N, c.torso);
				float num2 = 0f;
				for (int i = 0; i < N; i++)
				{
					num2 += array[i];
				}
				bool flag3 = num2 < 0.02f * (float)N;
				if (flag3)
				{
					for (int j = 0; j < N; j++)
					{
						array[j] = 1f;
					}
				}
				float[] array2 = Shield(bones, boneWeights, flag2, N, c.grown);
				if (array2 != null)
				{
					for (int k = 0; k < N; k++)
					{
						array[k] *= array2[k];
					}
				}
				if (main && c.frame == null)
				{
					c.frame = MeasureTorso(vertices, flag ? normals : null, array, !flag3, bones, bindposes, pm, c, out var why);
					if (c.frame == null)
					{
						Object.Destroy((Object)(object)val);
						note = "torso not found: " + why;
						return null;
					}
				}
				Torso T = c.frame;
				Vector3[] pv = (Vector3[])(object)new Vector3[N];
				Vector3[] array3 = (Vector3[])(object)new Vector3[N];
				Vector3 val2;
				for (int l = 0; l < N; l++)
				{
					pv[l] = ((Matrix4x4)(ref pm)).MultiplyPoint3x4(vertices[l]);
					if (flag)
					{
						int num3 = l;
						float normalSign = T.normalSign;
						val2 = ((Matrix4x4)(ref pm)).MultiplyVector(normals[l]);
						array3[num3] = normalSign * ((Vector3)(ref val2)).normalized;
					}
				}
				int[] triangles = val.triangles;
				List<string> list = new List<string>();
				if (flag3 && !main)
				{
					Object.Destroy((Object)(object)val);
					note = "not on the torso";
					return null;
				}
				if (flag3)
				{
					list.Add("region only");
				}
				if (main && c.wantBust && c.penisRoots != null && c.penisRoots.Count > 0 && flag2 && PenisWeighted(bones, boneWeights, c.penisRoots))
				{
					c.wantBust = false;
					list.Add("penis found, it grows instead of breasts");
				}
				int num4 = Mathf.Max(30, N / 200);
				if (main && c.ownBustBones != null && c.ownBustBones.Count > 0 && flag2)
				{
					if (WeightedCount(bones, boneWeights, c.ownBustBones) < num4)
					{
						if (c.genBust)
						{
							c.wantBust = true;
							c.ownBust = false;
							list.Add("own breast bones barely move the body, breasts generated");
						}
					}
					else if (c.partScale != null && Plugin.BustCatchUp.Value)
					{
						float num5 = PartSize(pv, bones, bindposes, pm, boneWeights, c.ownBustBones) / T.Lt;
						float num6 = Growth.CatchUp(num5, Plugin.MaxBreastScale.Value, Plugin.BustTargetSize.Value);
						c.partScale[1] = num6;
						list.Add($"own breasts {num5:0.00} of torso, grow x{num6:0.00}");
					}
				}
				if (main && c.ownRearBones != null && c.ownRearBones.Count > 0 && flag2 && WeightedCount(bones, boneWeights, c.ownRearBones) < num4 && c.genRear)
				{
					c.wantRear = true;
					list.Add("own butt bones barely move the body, butt generated");
				}
				if (main && (c.wantBust || c.wantRear) && c.lobes == null)
				{
					c.lobes = MeasureLobes(pv, array, T);
					if (c.bustyOnly && !c.lobes.busty && !c.ownBust)
					{
						c.wantBust = (c.wantRear = false);
						list.Add("no bust found, breasts/butt not generated");
					}
					if (!c.lobes.bust)
					{
						c.wantBust = false;
					}
					if (!c.lobes.rear)
					{
						c.wantRear = false;
					}
				}
				Vector3[] array4 = null;
				Vector3[] array5 = null;
				if (c.wantBust && c.lobes != null)
				{
					array4 = LobeDeltas(pv, array, c.lobes.bL, c.lobes.bR, c.lobes.bRad, T.f, out var hit, Plugin.MaxScaleFor(Matching.Part.Breasts, null));
					if (hit > 0)
					{
						Smooth(array4, pv, triangles, 2, 0.5f);
						Shielded(array4, array2);
						list.Add($"bust {hit} v");
					}
					else
					{
						array4 = null;
					}
				}
				if (c.wantRear && c.lobes != null)
				{
					array5 = LobeDeltas(pv, array2, c.lobes.rL, c.lobes.rR, c.lobes.rRad, -T.f, out var hit2, Plugin.ButtCarry());
					if (hit2 > 0)
					{
						Smooth(array5, pv, triangles, 2, 0.5f);
						Shielded(array5, array2);
						list.Add($"rear {hit2} v");
					}
					else
					{
						array5 = null;
					}
				}
				int[] owner = null;
				Vector3[] origins = null;
				Matching.Part[] parts = null;
				bool flag4 = Plugin.ButtFat.Value > 0f;
				bool flag5 = flag2 && !c.wantRear && c.grown.Exists(((Transform t, Matching.Part part) gb) => gb.part == Matching.Part.Butt);
				bool flag6 = Plugin.RoundButt.Value > 0f && ((!main) ? (c.cheekC != null) : (flag5 || (array5 != null && c.lobes != null && c.lobes.rear)));
				if (c.toy != null || flag4 || flag6)
				{
					owner = GrowthOwners(bones, bindposes, pm, c.grown, out origins, out parts);
				}
				if (main && flag4)
				{
					c.fat = 0;
					c.legs = null;
					c.cheeks = null;
					if (c.partScale != null)
					{
						c.partScale[2] = 0f;
					}
					List<Transform> list2 = c.grown.FindAll(((Transform t, Matching.Part part) gb) => gb.part == Matching.Part.Butt && Object.op_Implicit((Object)(object)gb.t)).ConvertAll(((Transform t, Matching.Part part) gb) => gb.t);
					if (array5 != null)
					{
						c.fat = 2;
						c.fatY = 0.5f * (Vector3.Dot(c.lobes.rL, T.u) + Vector3.Dot(c.lobes.rR, T.u));
						c.fatR = c.lobes.rRad;
						c.cheeks = c.lobes;
					}
					else if (list2.Count > 0 && flag2 && WeightedCount(bones, boneWeights, list2) >= num4)
					{
						float num7 = 0f;
						int num8 = 0;
						for (int num9 = 0; num9 < origins.Length; num9++)
						{
							if (parts[num9] == Matching.Part.Butt)
							{
								num7 += Vector3.Dot(origins[num9], T.u);
								num8++;
							}
						}
						c.fat = 1;
						c.fatY = num7 / (float)Mathf.Max(1, num8);
						c.fatR = PartSize(pv, bones, bindposes, pm, boneWeights, list2);
						HashSet<Transform> hashSet = new HashSet<Transform>();
						Transform[] array6 = bones;
						foreach (Transform bone in array6)
						{
							if (Object.op_Implicit((Object)(object)bone) && list2.Exists((Transform t) => bone.IsChildOf(t)))
							{
								hashSet.Add(bone);
							}
						}
						Lobes lobes = MeasureLobes(pv, array, T, Membership(bones, boneWeights, hasWeights: true, N, hashSet));
						if (lobes.rear && c.partScale != null)
						{
							c.cheeks = lobes;
						}
					}
					if (c.fatR <= 0f || T.width <= 0f)
					{
						c.fat = 0;
						c.cheeks = null;
					}
					if (c.fat == 1 && c.cheeks != null)
					{
						c.partScale[2] = Plugin.ButtCarry();
					}
					if (c.fat > 0 && flag2)
					{
						c.legs = MeasureLegs(bones, bindposes, boneWeights, pm, c, T);
					}
				}
				Vector3[] array7 = null;
				if (c.fat > 0)
				{
					float[] upper = (flag2 ? Membership(bones, boneWeights, hasWeights: true, N, UpperBones(bones, bindposes, pm, c, T)) : null);
					array7 = FatDeltas(pv, boneWeights, flag2, upper, owner, origins, parts, c.partScale, array5, c, T, out var hit3);
					if (hit3 > 0)
					{
						Shielded(array7, array2);
						list.Add($"butt fat {hit3} v" + ((!main) ? "" : (" (" + ((c.fat == 1) ? "round its butt bones" : "with the generated butt") + ", " + ((c.cheeks != null) ? string.Format("bubble cheeks {0:0.00} wide, {1} x{2:0.00}, ", c.cheeks.rRad / T.width, (c.fat == 1) ? "bones" : "BG Rear", Plugin.ButtCarry()) : "no bubble (cheeks not found), ") + ((c.legs != null) ? $"legs {c.legs.len[0] / T.width:0.0}/{c.legs.len[1] / T.width:0.0} widths" : "no legs found: no hips/thighs") + $", cheeks {c.fatR / T.width:0.00} wide)")));
					}
					else
					{
						array7 = null;
						if (main && c.partScale != null)
						{
							c.partScale[2] = 0f;
						}
					}
				}
				Vector3[] roundD;
				if (flag6)
				{
					float[] limb = ((flag2 && Object.op_Implicit((Object)(object)c.chest)) ? Membership(bones, boneWeights, hasWeights: true, N, ChestLimbs(c)) : null);
					if (main)
					{
						c.bodyPv = pv;
						c.bodyPn = (flag ? array3 : null);
					}
					if (main && flag5 && c.lobes == null)
					{
						c.lobes = MeasureLobes(pv, array, T);
					}
					roundD = BubbleDeltas(pv, array3, flag, boneWeights, owner, parts, limb, (c.lobes != null && c.lobes.rear) ? c.lobes : null, !flag5, c, T, main, list, out var hit4);
					if (main && c.cheekC != null)
					{
						Vector3 val3 = Vector3.zero;
						foreach (Vector3 item in c.cheekC)
						{
							val3 += item;
						}
						c.hasButtMid = true;
						c.buttMid = val3 / (float)c.cheekC.Count;
						if (c.partScale != null)
						{
							c.partScale[2] = 1f;
						}
					}
					if (hit4 > 0)
					{
						Smooth(roundD, pv, triangles, 2, 0.5f);
						Shielded(roundD, array2);
						int num11 = 0;
						int num12 = 0;
						for (int num13 = 0; num13 + 2 < triangles.Length; num13 += 3)
						{
							int num14 = triangles[num13];
							int num15 = triangles[num13 + 1];
							int num16 = triangles[num13 + 2];
							if (!(roundD[num14] == Vector3.zero) || !(roundD[num15] == Vector3.zero) || !(roundD[num16] == Vector3.zero))
							{
								num11++;
								if (Mathf.Max(Str(num14, num15), Mathf.Max(Str(num15, num16), Str(num16, num14))) > Plugin.MaxButtScale.Value * 2f)
								{
									num12++;
								}
							}
						}
						float num17 = ((num11 > 0) ? ((float)num12 / (float)num11) : 0f);
						int biggest;
						int num18 = Islands(pv, triangles, roundD, out biggest);
						bool flag7 = hit4 < 250;
						if (main && (num17 > 0.15f || flag7))
						{
							list.Add(flag7 ? $"bubble butt skipped: only {hit4} vertices (too coarse for a round ball)" : $"bubble butt skipped: {100f * num17:0}% of {num11} triangles torn");
							c.cheekC = null;
							c.hasButtMid = false;
							hit4 = 0;
							if (c.partScale != null)
							{
								c.partScale[2] = 0f;
							}
						}
						else
						{
							if (array7 == null)
							{
								array7 = roundD;
							}
							else
							{
								for (int num19 = 0; num19 < N; num19++)
								{
									ref Vector3 reference = ref array7[num19];
									reference += roundD[num19];
								}
							}
							list.Add($"bubble butt {hit4} v ({100f * num17:0}% torn, {100f * c.bubbleInward:0}% inward, {num18} pieces, biggest {biggest} v)");
							if (!flag5 && array5 != null)
							{
								array5 = null;
								list.Add("(replaces the generated rear)");
							}
						}
					}
				}
				Vector3[] array8 = array5 ?? array7;
				if (array5 != null && array7 != null)
				{
					array8 = (Vector3[])(object)new Vector3[N];
					for (int num20 = 0; num20 < N; num20++)
					{
						array8[num20] = array5[num20] + array7[num20];
					}
				}
				Vector3[] array9 = null;
				if (c.wantBelly)
				{
					array9 = BellyDeltas(pv, array, T, out var hit5);
					if (hit5 > 0)
					{
						Smooth(array9, pv, triangles, 3, 0.5f);
						Shielded(array9, array2);
					}
					if (main && (hit5 == 0 || hit5 > N / 2))
					{
						list.Add($"belly skipped (hit {hit5}/{N})");
						array9 = null;
						c.wantBelly = false;
					}
					else if (hit5 == 0)
					{
						array9 = null;
					}
					else
					{
						list.Add($"belly {hit5} v");
					}
				}
				List<(float, Vector3[])> list3 = new List<(float, Vector3[])>();
				if (c.toy != null)
				{
					float[] array10 = BreastSides(pv, array, boneWeights, flag2, owner, parts, (array4 != null) ? c.lobes : null, T);
					if (main)
					{
						c.toy.parting = ((array10 != null) ? new float[c.toy.sigmas.Length] : null);
					}
					if (main && !c.toy.placed && Plugin.ToyDepth.Value > 0f)
					{
						PlaceAllTheWayIn(c.toy, T, pv, array, list);
					}
					else if (main && !c.toy.placed)
					{
						aimMid = c.hasButtMid;
						aimMidAt = c.buttMid;
						PlaceFlush(c.toy, T, pv, array3, flag, array, boneWeights, flag2, owner, origins, parts, c.partScale, array9, array8, array4, array10, triangles, list);
					}
					c.toy.placed = true;
					int num21 = 0;
					int num22 = 0;
					float num23 = c.toy.stacks[c.toy.stacks.Length - 1];
					float num24 = 0f;
					float[] array11 = ((flag2 && Object.op_Implicit((Object)(object)c.chest)) ? Membership(bones, boneWeights, hasWeights: true, N, ChestLimbs(c)) : null);
					float[] array12 = array;
					if (array11 != null)
					{
						array12 = new float[N];
						for (int num25 = 0; num25 < N; num25++)
						{
							array12[num25] = array[num25] * (1f - Growth.Smooth01(2f * array11[num25]));
						}
					}
					for (int num26 = 0; num26 < c.toy.sigmas.Length; num26++)
					{
						partScaleNow = c.partScale;
						int hit6;
						int parted;
						Vector3[] array13 = ToyDeltas(pv, array3, flag, array12, boneWeights, flag2, owner, origins, parts, array9, array8, array4, array10, triangles, T, main, flag3, c.toy, num26, out hit6, out parted);
						Shielded(array13, array2);
						num21 = Mathf.Max(num21, hit6);
						num22 = Mathf.Max(num22, parted);
						float num27 = ((num23 > 0f) ? (100f * c.toy.stacks[num26] / num23) : 0f);
						if (hit6 + parted > 0 && num27 > num24)
						{
							list3.Add((num27, array13));
							num24 = num27;
						}
					}
					if (main && (float)num21 > (float)N * Mathf.Min(0.4f * Mathf.Max(1f, Plugin.ToySize.Value), 0.85f))
					{
						list.Add($"toy skipped (hit {num21}/{N})");
						list3.Clear();
						c.toy = null;
					}
					else if (list3.Count > 0)
					{
						list.Add($"toy {num21} v x{list3.Count}" + ((num22 == 0) ? "" : ($", breasts part {num22} v" + (main ? (" by " + string.Join("/", Array.ConvertAll(c.toy.parting, (float x) => (x / T.Lt).ToString("0.00"))) + " torso each") : ""))));
					}
				}
				if (array9 == null && list3.Count == 0 && array4 == null && array5 == null && array7 == null)
				{
					Object.Destroy((Object)(object)val);
					notBody = true;
					note = how + ", nothing in range" + ((list.Count > 0) ? (" (" + string.Join(", ", list) + ")") : "");
					return null;
				}
				float maxDisp = 0f;
				Made made = new Made
				{
					r = r,
					src = sharedMesh,
					gen = val
				};
				if (array9 != null)
				{
					ToMeshSpace(array9);
					val.AddBlendShapeFrame("BG Stuffed", 100f, array9, flag ? NormalDeltas(vertices, array9, normals, triangles) : null, (Vector3[])null);
					made.belly = val.blendShapeCount - 1;
				}
				if (array4 != null)
				{
					ToMeshSpace(array4);
					val.AddBlendShapeFrame("BG Bust", 100f, array4, flag ? NormalDeltas(vertices, array4, normals, triangles) : null, (Vector3[])null);
					made.bust = val.blendShapeCount - 1;
				}
				if (array5 != null)
				{
					ToMeshSpace(array5);
					val.AddBlendShapeFrame("BG Rear", 100f, array5, flag ? NormalDeltas(vertices, array5, normals, triangles) : null, (Vector3[])null);
					made.rear = val.blendShapeCount - 1;
				}
				if (array7 != null)
				{
					ToMeshSpace(array7);
					val.AddBlendShapeFrame("BG Thick", 100f, array7, flag ? NormalDeltas(vertices, array7, normals, triangles) : null, (Vector3[])null);
					made.thick = val.blendShapeCount - 1;
				}
				foreach (var (num28, array14) in list3)
				{
					ToMeshSpace(array14);
					val.AddBlendShapeFrame("BG ToyPress", num28, array14, flag ? NormalDeltas(vertices, array14, normals, triangles) : null, (Vector3[])null);
				}
				if (list3.Count > 0)
				{
					made.toy = val.blendShapeCount - 1;
				}
				val.UploadMeshData(!Plugin.KeepReadable.Value);
				float[] array15 = Weights(r, sharedMesh.blendShapeCount);
				made.restBounds = ((Renderer)r).localBounds;
				Bounds bounds = sharedMesh.bounds;
				val2 = ((Bounds)(ref bounds)).size;
				float num29;
				if (!(((Vector3)(ref val2)).magnitude > 1E-06f))
				{
					num29 = 1f;
				}
				else
				{
					val2 = ((Bounds)(ref made.restBounds)).size;
					float magnitude = ((Vector3)(ref val2)).magnitude;
					bounds = sharedMesh.bounds;
					val2 = ((Bounds)(ref bounds)).size;
					num29 = magnitude / ((Vector3)(ref val2)).magnitude;
				}
				float num30 = num29;
				r.sharedMesh = val;
				for (int num31 = 0; num31 < array15.Length; num31++)
				{
					r.SetBlendShapeWeight(num31, array15[num31]);
				}
				Bounds restBounds = made.restBounds;
				((Bounds)(ref restBounds)).Expand(2f * maxDisp * num30);
				((Renderer)r).localBounds = restBounds;
				note = how + ", " + string.Join(", ", list);
				return made;
				float Str(int u, int v)
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0058: Unknown result type (might be due to invalid IL or missing references)
					//IL_005d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_006e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0073: Unknown result type (might be due to invalid IL or missing references)
					Vector3 val4 = pv[u] - pv[v];
					float magnitude2 = ((Vector3)(ref val4)).magnitude;
					if (!(magnitude2 > 1E-07f))
					{
						return 1f;
					}
					val4 = pv[u] + roundD[u] - pv[v] - roundD[v];
					return ((Vector3)(ref val4)).magnitude / magnitude2;
				}
				void ToMeshSpace(Vector3[] d)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0021: Unknown result type (might be due to invalid IL or missing references)
					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					for (int m = 0; m < N; m++)
					{
						if (d[m] != Vector3.zero)
						{
							d[m] = ((Matrix4x4)(ref Mp)).MultiplyVector(d[m]);
							maxDisp = Mathf.Max(maxDisp, ((Vector3)(ref d[m])).magnitude);
						}
					}
				}
			}
			catch
			{
				Object.Destroy((Object)(object)val);
				notBody = false;
				throw;
			}
		}

		private static Torso MeasureTorso(Vector3[] v, Vector3[] n, float[] member, bool allowWidth, Transform[] bones, Matrix4x4[] bp, Matrix4x4 Pm, Ctx c, out string why)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			why = null;
			if (!ToMesh(bones, bp, c.chest, out var m))
			{
				why = "no chest bone";
				return null;
			}
			Vector3 val = ((Matrix4x4)(ref Pm)).MultiplyPoint3x4(Vector4.op_Implicit(((Matrix4x4)(ref m)).GetColumn(3)));
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude < 1E-05f)
			{
				why = "chest at pelvis";
				return null;
			}
			Vector3 val2 = val / magnitude;
			int num = -1;
			Transform val3 = c.pelvis;
			while (Object.op_Implicit((Object)(object)val3))
			{
				int num2 = Array.IndexOf(bones, val3);
				if (num2 >= 0 && num2 < bp.Length)
				{
					num = num2;
				}
				val3 = val3.parent;
			}
			Matrix4x4 inverse = ((Matrix4x4)(ref bp[num])).inverse;
			Matrix4x4 worldToLocalMatrix = bones[num].worldToLocalMatrix;
			Vector3 val4 = ((Matrix4x4)(ref Pm)).MultiplyVector(((Matrix4x4)(ref inverse)).MultiplyVector(((Matrix4x4)(ref worldToLocalMatrix)).MultiplyVector(c.model.forward)));
			val4 -= val2 * Vector3.Dot(val4, val2);
			if (((Vector3)(ref val4)).sqrMagnitude < 1E-10f)
			{
				why = "forward along the spine";
				return null;
			}
			((Vector3)(ref val4)).Normalize();
			Vector3 val5 = Vector3.Cross(val2, val4);
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			List<float> list = new List<float>();
			List<float> list2 = new List<float>();
			float num3 = 0f;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			int num7 = 0;
			for (int i = 0; i < v.Length; i++)
			{
				if (member[i] < 0.5f)
				{
					continue;
				}
				Vector3 val6 = ((Matrix4x4)(ref Pm)).MultiplyPoint3x4(v[i]);
				float num8 = Vector3.Dot(val6, val2) / magnitude;
				if (num8 < 0f || num8 > 0.6f)
				{
					continue;
				}
				Vector3 val7 = val6 - val2 * Vector3.Dot(val6, val2);
				float magnitude2 = ((Vector3)(ref val7)).magnitude;
				if (magnitude2 < 1E-06f)
				{
					continue;
				}
				list2.Add(Mathf.Abs(Vector3.Dot(val7, normalized)));
				if (Vector3.Dot(val7, normalized) < 0f)
				{
					num5++;
				}
				else
				{
					num6++;
				}
				if (Vector3.Dot(val7, val4) > 0f)
				{
					num7++;
				}
				if (Vector3.Dot(val7, val4) / magnitude2 > 0.8f)
				{
					list.Add(Vector3.Dot(val7, val4));
					if (n != null)
					{
						float num9 = num3;
						val5 = ((Matrix4x4)(ref Pm)).MultiplyVector(n[i]);
						num3 = num9 + Vector3.Dot(((Vector3)(ref val5)).normalized, val7 / magnitude2);
						num4++;
					}
				}
			}
			bool flag = allowWidth && list2.Count >= 50 && (float)num5 > 0.25f * (float)list2.Count && (float)num6 > 0.25f * (float)list2.Count && (float)num7 > 0.25f * (float)list2.Count;
			if (list.Count < 10 && !flag)
			{
				why = "no torso front found";
				return null;
			}
			float num10 = Growth.Percentile(list2, 0.95f);
			Torso torso = Shape(new Torso
			{
				u = val2,
				f = val4,
				side = normalized,
				Lt = magnitude,
				depth = ((list.Count >= 10) ? Growth.Percentile(list, 0.95f) : (0.8f * num10)),
				width = num10
			});
			if (num4 > 0 && num3 / (float)num4 < -0.3f)
			{
				torso.normalSign = -1f;
			}
			return torso;
		}

		private static Torso Shape(Torso T)
		{
			T.a0 = 0.25f;
			T.Rx = Mathf.Max(0.9f * T.width, 0.3f * T.Lt);
			T.Ry = Mathf.Max(0.6f * T.Lt, 0.85f * T.Rx);
			T.A = Mathf.Min(Plugin.BellySize.Value * Mathf.Max(T.depth, 0.3f * T.Lt), 0.8f * Mathf.Min(T.Rx, T.Ry));
			return T;
		}

		private static Vector3[] BellyDeltas(Vector3[] pv, float[] member, Torso B, out int hit)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[pv.Length];
			hit = 0;
			for (int i = 0; i < pv.Length; i++)
			{
				float num = member[i];
				if (num <= 0f)
				{
					continue;
				}
				Vector3 val = pv[i];
				float num2 = Vector3.Dot(val, B.u);
				float num3 = (num2 / B.Lt - B.a0) * B.Lt / B.Ry;
				float num4 = Vector3.Dot(val, B.side) / B.Rx;
				float num5 = Growth.Falloff(Mathf.Sqrt(num4 * num4 + num3 * num3));
				if (num5 <= 0f)
				{
					continue;
				}
				Vector3 val2 = val - B.u * num2;
				float magnitude = ((Vector3)(ref val2)).magnitude;
				if (!(magnitude < 1E-06f))
				{
					Vector3 val3 = val2 / magnitude;
					float num6 = num5 * Growth.Smooth01(Vector3.Dot(val3, B.f) / 0.6f) * num;
					if (!(num6 < 0.001f))
					{
						int num7 = i;
						float num8 = B.A * num6;
						Vector3 val4 = val3 + B.f;
						array[num7] = num8 * ((Vector3)(ref val4)).normalized;
						hit++;
					}
				}
			}
			return array;
		}

		private static void Smooth(Vector3[] d, Vector3[] pos, int[] tris, int iterations, float lambda)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			int num = pos.Length;
			bool[] array = new bool[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = d[i] != Vector3.zero;
			}
			Vector3 val = pos[0];
			Vector3 val2 = pos[0];
			for (int j = 1; j < num; j++)
			{
				val = Vector3.Min(val, pos[j]);
				val2 = Vector3.Max(val2, pos[j]);
			}
			Vector3 val3 = val2 - val;
			float q = 1f / Mathf.Max(1E-06f * ((Vector3)(ref val3)).magnitude, 1E-12f);
			int[] group = new int[num];
			for (int k = 0; k < num; k++)
			{
				group[k] = -1;
			}
			Dictionary<Vector3Int, int> keys = new Dictionary<Vector3Int, int>();
			for (int l = 0; l + 2 < tris.Length; l += 3)
			{
				if (array[tris[l]] || array[tris[l + 1]] || array[tris[l + 2]])
				{
					Assign(tris[l]);
					Assign(tris[l + 1]);
					Assign(tris[l + 2]);
				}
			}
			int count = keys.Count;
			int[] array2 = new int[num];
			Vector3Int key = default(Vector3Int);
			for (int m = 0; m < num; m++)
			{
				array2[m] = -1;
				if (group[m] < 0)
				{
					((Vector3Int)(ref key))..ctor(Mathf.RoundToInt(pos[m].x * q), Mathf.RoundToInt(pos[m].y * q), Mathf.RoundToInt(pos[m].z * q));
					if (keys.TryGetValue(key, out var value))
					{
						array2[m] = value;
					}
				}
			}
			if (count == 0)
			{
				return;
			}
			List<int>[] array3 = new List<int>[count];
			for (int n = 0; n < count; n++)
			{
				array3[n] = new List<int>(6);
			}
			for (int num2 = 0; num2 + 2 < tris.Length; num2 += 3)
			{
				int num3 = group[tris[num2]];
				int num4 = group[tris[num2 + 1]];
				int num5 = group[tris[num2 + 2]];
				if (num3 >= 0 && num4 >= 0 && num5 >= 0)
				{
					array3[num3].Add(num4);
					array3[num3].Add(num5);
					array3[num4].Add(num3);
					array3[num4].Add(num5);
					array3[num5].Add(num3);
					array3[num5].Add(num4);
				}
			}
			Vector3[] array4 = (Vector3[])(object)new Vector3[count];
			int[] array5 = new int[count];
			for (int num6 = 0; num6 < num; num6++)
			{
				if (group[num6] >= 0)
				{
					ref Vector3 reference = ref array4[group[num6]];
					reference += d[num6];
					array5[group[num6]]++;
				}
			}
			for (int num7 = 0; num7 < count; num7++)
			{
				if (array5[num7] > 0)
				{
					ref Vector3 reference2 = ref array4[num7];
					reference2 /= (float)array5[num7];
				}
			}
			Vector3[] array6 = (Vector3[])(object)new Vector3[count];
			for (int num8 = 0; num8 < iterations; num8++)
			{
				for (int num9 = 0; num9 < count; num9++)
				{
					if (array3[num9].Count == 0)
					{
						array6[num9] = array4[num9];
						continue;
					}
					Vector3 val4 = Vector3.zero;
					foreach (int item in array3[num9])
					{
						val4 += array4[item];
					}
					array6[num9] = (1f - lambda) * array4[num9] + lambda * val4 / (float)array3[num9].Count;
				}
				Vector3[] array7 = array4;
				array4 = array6;
				array6 = array7;
			}
			for (int num10 = 0; num10 < num; num10++)
			{
				int num11 = ((group[num10] >= 0) ? group[num10] : array2[num10]);
				if (num11 >= 0 && ((Vector3)(ref array4[num11])).sqrMagnitude > ((Vector3)(ref d[num10])).sqrMagnitude)
				{
					d[num10] = array4[num11];
				}
			}
			void Assign(int num12)
			{
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				if (group[num12] < 0)
				{
					Vector3Int key2 = default(Vector3Int);
					((Vector3Int)(ref key2))..ctor(Mathf.RoundToInt(pos[num12].x * q), Mathf.RoundToInt(pos[num12].y * q), Mathf.RoundToInt(pos[num12].z * q));
					if (!keys.TryGetValue(key2, out var value2))
					{
						value2 = (keys[key2] = keys.Count);
					}
					group[num12] = value2;
				}
			}
		}

		public static string Shafts(Transform model, List<Made> made)
		{
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: 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_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			ChildLocator component = ((Component)model).GetComponent<ChildLocator>();
			Transform val = (Object.op_Implicit((Object)(object)component) ? Find(component, "Pelvis", "Hip", "Base") : null) ?? ByName(model, PelvisNames);
			SkinnedMeshRenderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<SkinnedMeshRenderer>(false);
			foreach (SkinnedMeshRenderer r in componentsInChildren)
			{
				Mesh sharedMesh = r.sharedMesh;
				if (!Object.op_Implicit((Object)(object)sharedMesh) || Object.op_Implicit((Object)(object)((Component)r).GetComponentInParent<ItemDisplay>()) || !Matching.IsShaftName(((Object)sharedMesh).name) || made.Exists((Made m) => (Object)(object)m.r == (Object)(object)r))
				{
					continue;
				}
				string how;
				Mesh val2 = MeshCopy.Make(sharedMesh, out how);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					list.Add(((Object)sharedMesh).name + " " + how);
					continue;
				}
				try
				{
					Vector3[] vertices = val2.vertices;
					int num = vertices.Length;
					if (num < 8)
					{
						Object.Destroy((Object)(object)val2);
						continue;
					}
					Vector3 val3 = Vector3.zero;
					Vector3[] array = vertices;
					foreach (Vector3 val4 in array)
					{
						val3 += val4;
					}
					val3 /= (float)num;
					Vector3 val5 = new Vector3(0.3f, 0.6f, 0.7f);
					Vector3 normalized = ((Vector3)(ref val5)).normalized;
					for (int num3 = 0; num3 < 40; num3++)
					{
						Vector3 val6 = Vector3.zero;
						array = vertices;
						for (int num2 = 0; num2 < array.Length; num2++)
						{
							Vector3 val7 = array[num2] - val3;
							val6 += val7 * Vector3.Dot(val7, normalized);
						}
						if (((Vector3)(ref val6)).sqrMagnitude < 1E-20f)
						{
							break;
						}
						normalized = ((Vector3)(ref val6)).normalized;
					}
					float num4 = float.MaxValue;
					float num5 = float.MinValue;
					array = vertices;
					for (int num2 = 0; num2 < array.Length; num2++)
					{
						float num6 = Vector3.Dot(array[num2] - val3, normalized);
						num4 = Mathf.Min(num4, num6);
						num5 = Mathf.Max(num5, num6);
					}
					Vector3 val8 = val3 + normalized * num5;
					Vector3 val9 = val3 + normalized * num4;
					Vector3 val10 = val9;
					int num7 = (Object.op_Implicit((Object)(object)val) ? Array.IndexOf(r.bones, val) : (-1));
					Matrix4x4[] bindposes = sharedMesh.bindposes;
					if (num7 >= 0 && num7 < bindposes.Length)
					{
						Matrix4x4 inverse = ((Matrix4x4)(ref bindposes[num7])).inverse;
						Vector3 val11 = ((Matrix4x4)(ref inverse)).MultiplyPoint3x4(Vector3.zero);
						val5 = val8 - val11;
						float sqrMagnitude = ((Vector3)(ref val5)).sqrMagnitude;
						val5 = val9 - val11;
						val10 = ((sqrMagnitude < ((Vector3)(ref val5)).sqrMagnitude) ? val8 : val9);
					}
					float num8 = Plugin.MaxBoneScale.Value - 1f;
					Vector3[] array2 = (Vector3[])(object)new Vector3[num];
					float num9 = 0f;
					for (int num10 = 0; num10 < num; num10++)
					{
						array2[num10] = num8 * (vertices[num10] - val10);
						num9 = Mathf.Max(num9, ((Vector3)(ref array2[num10])).magnitude);
					}
					_ = val2.normals;
					val2.AddBlendShapeFrame("BG Length", 100f, array2, (Vector3[])null, (Vector3[])null);
					Made made2 = new Made
					{
						r = r,
						src = sharedMesh,
						gen = val2,
						penis = val2.blendShapeCount - 1
					};
					val2.UploadMeshData(!Plugin.KeepReadable.Value);
					float[] array3 = Weights(r, sharedMesh.blendShapeCount);
					made2.restBounds = ((Renderer)r).localBounds;
					Bounds bounds = sharedMesh.bounds;
					val5 = ((Bounds)(ref bounds)).size;
					float num11;
					if (!(((Vector3)(ref val5)).magnitude > 1E-06f))
					{
						num11 = 1f;
					}
					else
					{
						val5 = ((Bounds)(ref made2.restBounds)).size;
						float magnitude = ((Vector3)(ref val5)).magnitude;
						bounds = sharedMesh.bounds;
						val5 = ((Bounds)(ref bounds)).size;
						num11 = magnitude / ((Vector3)(ref val5)).magnitude;
					}
					float num12 = num11;
					r.sharedMesh = val2;
					for (int num13 = 0; num13 < array3.Length; num13++)
					{
						r.SetBlendShapeWeight(num13, array3[num13]);
					}
					Bounds restBounds = made2.restBounds;
					((Bounds)(ref restBounds)).Expand(2f * num9 * num12);
					((Renderer)r).localBounds = restBounds;
					made.Add(made2);
					list.Add($"{((Object)sharedMesh).name} {how}, length {num} v");
				}
				catch (Exception ex)
				{
					Object.Destroy((Object)(object)val2);
					list.Add(((Object)sharedMesh).name + " failed: " + ex.Message);
				}
			}
			if (list.Count <= 0)
			{
				return "";
			}
			return " | penis mesh: " + string.Join("; ", list);
		}

		private static Lobes MeasureLobes(Vector3[] pv, float[] member, Torso T, float[] rearOnly = null)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			Lobes lobes = new Lobes();
			List<float> list = new List<float>();
			List<float> list2 = new List<float>();
			for (int i = 0; i < pv.Length; i++)
			{
				if (!(member[i] < 0.5f))
				{
					Vector3 val = pv[i];
					float num = Vector3.Dot(val, T.u) / T.Lt;
					float item = Mathf.Abs(Vector3.Dot(val, T.side));
					if (num > 0.55f && num < 1.6f)
					{
						list.Add(item);
					}
					if (num > -1f && num < 0.35f)
					{
						list2.Add(item);
					}
				}
			}
			float num2 = Growth.Percentile(list, 0.9f);
			float num3 = Growth.Percentile(list2, 0.9f);
			List<float> list3 = new List<float>();
			List<float> list4 = new List<float>();
			List<float> list5 = new List<float>();
			for (int j = 0; j < pv.Length; j++)
			{
				if (!(num2 > 0f))
				{
					break;
				}
				if (member[j] < 0.3f)
				{
					continue;
				}
				Vector3 val2 = pv[j];
				float num4 = Vector3.Dot(val2, T.u) / T.Lt;
				if (num4 < 0.55f || num4 > 1.6f)
				{
					continue;
				}
				float num5 = Vector3.Dot(val2, T.side);
				float num6 = Vector3.Dot(val2, T.f);
				if (!(num6 <= 0f))
				{
					if (Ma