Decompiled source of ButterflyKnifeOnShop v0.1.10

plugins/MoreKnives/HowToFish.MoreKnives.dll

Decompiled a day 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.Text;
using BepInEx;
using BepInEx.Logging;
using FishNet.Object;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace HowToFish.MoreKnives;

internal static class EmbeddedKnifeMesh
{
	private const string ButterflyResourceName = "HowToFish.MoreKnives.ButterflyV4";

	private const string ButterflyIconResourceName = "HowToFish.MoreKnives.ButterflyV4Icon";

	private const int FormatVersion = 1;

	public static bool TryLoadButterfly(List<KnifePart> parts, out string error)
	{
		//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_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Expected O, but got Unknown
		//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_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		error = null;
		if (parts == null)
		{
			error = "Destination part list is null.";
			return false;
		}
		try
		{
			using Stream stream = typeof(EmbeddedKnifeMesh).Assembly.GetManifestResourceStream("HowToFish.MoreKnives.ButterflyV4");
			if (stream == null)
			{
				error = "Embedded ButterflyV4 mesh resource is missing.";
				return false;
			}
			using BinaryReader binaryReader = new BinaryReader(stream);
			byte[] array = binaryReader.ReadBytes(4);
			if (array.Length != 4 || array[0] != 77 || array[1] != 75 || array[2] != 66 || array[3] != 70)
			{
				error = "ButterflyV4 mesh header is invalid.";
				return false;
			}
			int num = binaryReader.ReadInt32();
			int num2 = binaryReader.ReadInt32();
			if (num != 1 || num2 <= 0 || num2 > 128)
			{
				error = "Unsupported ButterflyV4 mesh version or part count (" + num + ", " + num2 + ").";
				return false;
			}
			List<KnifePart> list = new List<KnifePart>(num2);
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			int num3 = 0;
			int num4 = 0;
			for (int i = 0; i < num2; i++)
			{
				string text = ReadString(binaryReader);
				string text2 = ReadString(binaryReader);
				int num5 = binaryReader.ReadInt32();
				Vector3 groupPivot = ReadVector3(binaryReader);
				int num6 = binaryReader.ReadInt32();
				int num7 = binaryReader.ReadInt32();
				if (num6 <= 0 || num6 > 500000 || num7 <= 0 || num7 > 2000000 || num7 % 3 != 0)
				{
					throw new InvalidDataException("Unsafe mesh counts in part " + text + ".");
				}
				if (num5 < 0 || num5 > 4)
				{
					throw new InvalidDataException("Unknown material ID in part " + text + ".");
				}
				Vector3[] array2 = (Vector3[])(object)new Vector3[num6];
				Vector3[] array3 = (Vector3[])(object)new Vector3[num6];
				int[] array4 = new int[num7];
				for (int j = 0; j < num6; j++)
				{
					array2[j] = ReadVector3(binaryReader);
				}
				for (int k = 0; k < num6; k++)
				{
					array3[k] = ReadVector3(binaryReader);
				}
				for (int l = 0; l < num7; l++)
				{
					int num8 = binaryReader.ReadInt32();
					if (num8 < 0 || num8 >= num6)
					{
						throw new InvalidDataException("Out-of-range triangle index in part " + text + ".");
					}
					array4[l] = num8;
				}
				Mesh val = new Mesh();
				((Object)val).name = "Butterfly V4 " + text;
				((Object)val).hideFlags = (HideFlags)52;
				if (num6 > 65535)
				{
					val.indexFormat = (IndexFormat)1;
				}
				val.vertices = array2;
				val.normals = array3;
				val.triangles = array4;
				val.RecalculateBounds();
				val.UploadMeshData(false);
				list.Add(new KnifePart
				{
					Name = text,
					Mesh = val,
					Material = (PartMaterial)num5,
					Position = Vector3.zero,
					AnimationGroup = text2,
					GroupPivot = groupPivot
				});
				flag |= text2 == "ButterflyBlade";
				flag2 |= text2 == "ButterflyHandleSafe";
				flag3 |= text2 == "ButterflyHandleBite";
				num3 += num6;
				num4 += num7 / 3;
			}
			if (!flag || !flag2 || !flag3 || stream.Position != stream.Length)
			{
				throw new InvalidDataException("ButterflyV4 hierarchy is incomplete or the payload has trailing data.");
			}
			parts.AddRange(list);
			MoreKnivesPlugin.Log.LogInfo((object)("Loaded Blender Butterfly V4: " + list.Count + " parts, " + num3 + " vertices, " + num4 + " triangles, physical pivots verified."));
			return true;
		}
		catch (Exception ex)
		{
			error = ex.GetType().Name + ": " + ex.Message;
			return false;
		}
	}

	public static Texture2D LoadButterflyIcon()
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		try
		{
			using Stream stream = typeof(EmbeddedKnifeMesh).Assembly.GetManifestResourceStream("HowToFish.MoreKnives.ButterflyV4Icon");
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			int num;
			for (int i = 0; i < array.Length; i += num)
			{
				num = stream.Read(array, i, array.Length - i);
				if (num <= 0)
				{
					return null;
				}
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			((Object)val).name = "More Knives Butterfly V4 Icon";
			((Object)val).hideFlags = (HideFlags)52;
			((Texture)val).filterMode = (FilterMode)1;
			if (!ImageConversion.LoadImage(val, array, true))
			{
				Object.Destroy((Object)(object)val);
				return null;
			}
			return val;
		}
		catch (Exception ex)
		{
			MoreKnivesPlugin.Log.LogWarning((object)("Could not load Butterfly V4 icon: " + ex.Message));
			return null;
		}
	}

	private static string ReadString(BinaryReader reader)
	{
		int num = reader.ReadInt32();
		if (num < 0 || num > 1024)
		{
			throw new InvalidDataException("Unsafe string length in embedded mesh.");
		}
		byte[] array = reader.ReadBytes(num);
		if (array.Length != num)
		{
			throw new EndOfStreamException();
		}
		return Encoding.UTF8.GetString(array);
	}

	private static Vector3 ReadVector3(BinaryReader reader)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
	}
}
internal sealed class KnifePart
{
	public string Name;

	public Mesh Mesh;

	public Vector3 Position = Vector3.zero;

	public Quaternion Rotation = Quaternion.identity;

	public Vector3 Scale = Vector3.one;

	public PartMaterial Material;

	public string AnimationGroup;

	public Vector3 GroupPivot;
}
internal sealed class KnifeAssetSet
{
	public readonly List<KnifePart> Parts = new List<KnifePart>();

	public Mesh InventoryMesh;

	public Material BladeMaterial;

	public Material EdgeMaterial;

	public Material GripMaterial;

	public Material AccentMaterial;

	public Material DarkMaterial;
}
internal static class KnifeAssets
{
	private static readonly Dictionary<byte, KnifeAssetSet> Cache = new Dictionary<byte, KnifeAssetSet>();

	public static void WarmUp()
	{
		foreach (KnifeDefinition definition in KnifeCatalog.Definitions)
		{
			if (!definition.UsesVanillaModel)
			{
				Get(definition);
			}
		}
	}

	public static KnifeAssetSet Get(KnifeDefinition definition)
	{
		if (Cache.TryGetValue(definition.VariantCode, out var value))
		{
			return value;
		}
		value = Build(definition);
		Cache.Add(definition.VariantCode, value);
		return value;
	}

	public static GameObject CreateWorldModel(KnifeDefinition definition, Transform parent, string suffix)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: 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_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: 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)
		//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_0100: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
		KnifeAssetSet knifeAssetSet = Get(definition);
		GameObject val = new GameObject("MoreKnivesModel_" + definition.VariantCode + suffix);
		((Object)val).hideFlags = (HideFlags)52;
		val.transform.SetParent(parent, false);
		Dictionary<string, Transform> dictionary = CreateAnimationGroups(definition, knifeAssetSet.Parts, val.transform, suffix);
		foreach (KnifePart part in knifeAssetSet.Parts)
		{
			Transform val2 = val.transform;
			Vector3 val3 = part.Position;
			if (!string.IsNullOrEmpty(part.AnimationGroup))
			{
				if (!dictionary.TryGetValue(part.AnimationGroup, out var value))
				{
					GameObject val4 = new GameObject(part.AnimationGroup + suffix)
					{
						hideFlags = (HideFlags)52
					};
					val4.transform.SetParent(val.transform, false);
					val4.transform.localPosition = part.GroupPivot;
					value = val4.transform;
					dictionary.Add(part.AnimationGroup, value);
				}
				val2 = value;
				val3 -= part.GroupPivot;
			}
			GameObject val5 = new GameObject(part.Name + suffix)
			{
				hideFlags = (HideFlags)52
			};
			val5.transform.SetParent(val2, false);
			val5.transform.localPosition = val3;
			val5.transform.localRotation = part.Rotation;
			val5.transform.localScale = part.Scale;
			val5.AddComponent<MeshFilter>().sharedMesh = part.Mesh;
			((Renderer)val5.AddComponent<MeshRenderer>()).sharedMaterial = GetMaterial(knifeAssetSet, part.Material);
		}
		SetLayerRecursively(val, ((Component)parent).gameObject.layer);
		return val;
	}

	private static Dictionary<string, Transform> CreateAnimationGroups(KnifeDefinition definition, List<KnifePart> parts, Transform root, string suffix)
	{
		//IL_004c: 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_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>();
		if (definition.Shape != KnifeShape.Butterfly)
		{
			return dictionary;
		}
		if (!TryFindGroupPivot(parts, "ButterflyBlade", out var pivot) || !TryFindGroupPivot(parts, "ButterflyHandleSafe", out var pivot2) || !TryFindGroupPivot(parts, "ButterflyHandleBite", out var pivot3))
		{
			return dictionary;
		}
		Transform value = CreateGroup(root, "ButterflyHandleBite" + suffix, pivot3);
		Transform val = CreateGroup(root, "ButterflyBlade" + suffix, pivot);
		Transform value2 = CreateGroup(val, "ButterflyHandleSafe" + suffix, pivot2 - pivot);
		dictionary.Add("ButterflyHandleBite", value);
		dictionary.Add("ButterflyBlade", val);
		dictionary.Add("ButterflyHandleSafe", value2);
		return dictionary;
	}

	private static Transform CreateGroup(Transform parent, string name, Vector3 localPosition)
	{
		//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_000e: 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)
		GameObject val = new GameObject(name)
		{
			hideFlags = (HideFlags)52
		};
		val.transform.SetParent(parent, false);
		val.transform.localPosition = localPosition;
		return val.transform;
	}

	private static bool TryFindGroupPivot(List<KnifePart> parts, string group, out Vector3 pivot)
	{
		//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_0049: 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)
		foreach (KnifePart part in parts)
		{
			if (part.AnimationGroup == group)
			{
				pivot = part.GroupPivot;
				return true;
			}
		}
		pivot = Vector3.zero;
		return false;
	}

	public static Material GetBladeMaterial(KnifeDefinition definition)
	{
		return Get(definition).BladeMaterial;
	}

	private static KnifeAssetSet Build(KnifeDefinition definition)
	{
		//IL_0022: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		KnifeAssetSet knifeAssetSet = new KnifeAssetSet();
		bool flag = definition.Shape == KnifeShape.Butterfly;
		knifeAssetSet.BladeMaterial = CreateMaterial(definition.DisplayName + " Blade", definition.BladeColor, flag ? 0.94f : 0.88f, flag ? 0.86f : 0.76f, !flag);
		knifeAssetSet.EdgeMaterial = CreateMaterial(definition.DisplayName + " Edge", Color.Lerp(definition.BladeColor, Color.white, 0.46f), 0.98f, 0.94f, !flag);
		knifeAssetSet.GripMaterial = CreateMaterial(definition.DisplayName + " Grip", definition.GripColor, flag ? 0.9f : 0.08f, flag ? 0.78f : 0.28f, !flag);
		knifeAssetSet.AccentMaterial = CreateMaterial(definition.DisplayName + " Accent", definition.AccentColor, flag ? 0.76f : 0.68f, flag ? 0.82f : 0.58f, !flag);
		knifeAssetSet.DarkMaterial = CreateMaterial(definition.DisplayName + " Dark Detail", Color.Lerp(definition.GripColor, Color.black, 0.82f), 0.72f, 0.38f, !flag);
		BuildParts(definition, knifeAssetSet.Parts);
		knifeAssetSet.InventoryMesh = CombineForInventory(definition, knifeAssetSet.Parts);
		return knifeAssetSet;
	}

	private static void BuildParts(KnifeDefinition definition, List<KnifePart> parts)
	{
		//IL_0165: 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_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: 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_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		if (definition.Shape == KnifeShape.Karambit || definition.Shape == KnifeShape.Talon)
		{
			BuildCurvedKnife(definition, parts);
			return;
		}
		if (definition.Shape == KnifeShape.DualDaggers)
		{
			BuildPushDagger(definition, parts);
			return;
		}
		if (definition.Shape == KnifeShape.Butterfly)
		{
			BuildButterfly(definition, parts);
			return;
		}
		if (definition.Shape == KnifeShape.Skeleton)
		{
			BuildSkeleton(definition, parts);
			return;
		}
		float bladeWidth = definition.BladeWidth;
		float lengthScale = definition.LengthScale;
		Vector2[] input = BladePolygon(definition.Shape, bladeWidth, lengthScale);
		Add(parts, "Blade", MeshBuilder.ExtrudePolygon(input, 0.035f, definition.DisplayName + " Blade"), PartMaterial.Blade);
		float num = Mathf.Clamp(bladeWidth * 0.78f, 0.105f, 0.17f);
		if (definition.Shape == KnifeShape.Paracord)
		{
			Add(parts, "ParacordCore", MeshBuilder.Box2D((0f - num) * 0.34f, 0f, num * 0.34f, 0.32f, 0.065f, "Paracord Core"), PartMaterial.Grip);
			for (int i = 0; i < 5; i++)
			{
				float num2 = 0.025f + (float)i * 0.058f;
				Add(parts, "ParacordWrap" + i, MeshBuilder.Box2D((0f - num) * 0.55f, num2, num * 0.55f, num2 + 0.035f, 0.082f, "Paracord Wrap"), PartMaterial.Accent);
			}
		}
		else
		{
			Vector2[] input2 = (Vector2[])(object)new Vector2[6]
			{
				new Vector2((0f - num) * 0.48f, 0f),
				new Vector2(num * 0.48f, 0f),
				new Vector2(num * 0.56f, 0.06f),
				new Vector2(num * 0.48f, 0.31f),
				new Vector2((0f - num) * 0.48f, 0.31f),
				new Vector2((0f - num) * 0.56f, 0.06f)
			};
			Add(parts, "Grip", MeshBuilder.ExtrudePolygon(input2, 0.075f, definition.DisplayName + " Grip"), PartMaterial.Grip);
		}
		AddHandleHardware(definition, parts, num);
		Add(parts, "Guard", MeshBuilder.Box2D((0f - bladeWidth) * 0.66f, 0.285f, bladeWidth * 0.66f, 0.335f, 0.075f, "Guard"), PartMaterial.Accent);
		Add(parts, "Pommel", MeshBuilder.Box2D((0f - num) * 0.58f, -0.018f, num * 0.58f, 0.035f, 0.08f, "Pommel"), PartMaterial.Accent);
		if (definition.Shape == KnifeShape.Bayonet || definition.Shape == KnifeShape.M9Bayonet)
		{
			Add(parts, "GuardRing", MeshBuilder.Torus(0.085f, 0.014f, 22, 7, "Guard Ring"), PartMaterial.Edge, new Vector3(bladeWidth * 0.78f, 0.31f, 0.025f));
		}
		if (definition.Shape == KnifeShape.Gut)
		{
			Vector2[] input3 = (Vector2[])(object)new Vector2[3]
			{
				new Vector2(-0.02f, 0.61f),
				new Vector2(bladeWidth * 0.73f, 0.69f),
				new Vector2(bladeWidth * 0.54f, 0.79f)
			};
			Add(parts, "GutHook", MeshBuilder.ExtrudePolygon(input3, 0.04f, "Gut Hook"), PartMaterial.Accent);
		}
		else if (definition.Shape == KnifeShape.M9Bayonet || definition.Shape == KnifeShape.Survival)
		{
			for (int j = 0; j < 5; j++)
			{
				float num3 = 0.47f + (float)j * 0.07f;
				Vector2[] input4 = (Vector2[])(object)new Vector2[3]
				{
					new Vector2((0f - bladeWidth) * 0.5f, num3),
					new Vector2((0f - bladeWidth) * 0.76f, num3 + 0.035f),
					new Vector2((0f - bladeWidth) * 0.48f, num3 + 0.065f)
				};
				Add(parts, "Serration" + j, MeshBuilder.ExtrudePolygon(input4, 0.04f, "Serration"), PartMaterial.Accent);
			}
		}
		else if (definition.Shape == KnifeShape.Stiletto)
		{
			Add(parts, "CenterRidge", MeshBuilder.Box2D(-0.012f, 0.31f, 0.012f, lengthScale * 0.92f, 0.052f, "Stiletto Ridge"), PartMaterial.Accent);
		}
		else if (definition.Shape == KnifeShape.Nomad || definition.Shape == KnifeShape.Huntsman)
		{
			Add(parts, "Fuller", MeshBuilder.Box2D((0f - bladeWidth) * 0.18f, 0.42f, bladeWidth * 0.18f, lengthScale * 0.82f, 0.043f, "Blade Fuller"), PartMaterial.Accent);
		}
		if (definition.Shape != KnifeShape.Stiletto)
		{
			AddBladeFaceDetail(definition, parts, bladeWidth, lengthScale);
		}
	}

	private static void AddHandleHardware(KnifeDefinition definition, List<KnifePart> parts, float gripWidth)
	{
		//IL_0050: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Max(0.022f, gripWidth * 0.3f);
		Add(parts, "HandlePanel", MeshBuilder.Box2D((0f - gripWidth) * 0.34f, 0.055f, gripWidth * 0.34f, 0.265f, 0.082f, "Handle Panel"), PartMaterial.Accent, new Vector3(0f, 0f, 0.04f));
		Add(parts, "HandlePinTop", MeshBuilder.Torus(0.014f, 0.005f, 14, 6, "Handle Pin"), PartMaterial.Edge, new Vector3(num, 0.245f, 0.048f));
		Add(parts, "HandlePinBottom", MeshBuilder.Torus(0.014f, 0.005f, 14, 6, "Handle Pin"), PartMaterial.Edge, new Vector3(0f - num, 0.065f, 0.048f));
		for (int i = 0; i < 6; i++)
		{
			float num2 = 0.065f + (float)i * 0.036f;
			Add(parts, "GripRidge" + i, MeshBuilder.Box2D((0f - gripWidth) * 0.47f, num2, gripWidth * 0.47f, num2 + 0.013f, 0.088f, "Grip Ridge"), PartMaterial.Accent, new Vector3(0f, 0f, 0.043f));
		}
		if (definition.Shape == KnifeShape.Bowie || definition.Shape == KnifeShape.Huntsman || definition.Shape == KnifeShape.Classic)
		{
			Add(parts, "HandleGroove", MeshBuilder.Box2D((0f - gripWidth) * 0.38f, 0.11f, gripWidth * 0.38f, 0.132f, 0.086f, "Handle Groove"), PartMaterial.Grip, new Vector3(0f, 0f, 0.044f));
		}
	}

	private static void AddBladeFaceDetail(KnifeDefinition definition, List<KnifePart> parts, float width, float tip)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		Vector2[] input = (Vector2[])(object)new Vector2[5]
		{
			new Vector2((0f - width) * 0.1f, 0.39f),
			new Vector2(width * 0.1f, 0.39f),
			new Vector2(width * 0.065f, tip * 0.79f),
			new Vector2(0f, tip * 0.91f),
			new Vector2((0f - width) * 0.065f, tip * 0.79f)
		};
		Add(parts, "BladeFaceGroove", MeshBuilder.ExtrudePolygon(input, 0.01f, "Blade Face Groove"), PartMaterial.Accent, new Vector3(0f, 0f, 0.021f));
		if (definition.Shape == KnifeShape.Bayonet || definition.Shape == KnifeShape.M9Bayonet)
		{
			Add(parts, "BladeLanyardHole", MeshBuilder.Torus(0.026f, 0.008f, 20, 7, "Blade Lanyard Hole"), PartMaterial.Edge, new Vector3(0f, tip * 0.64f, 0.026f));
		}
	}

	private static void BuildCurvedKnife(KnifeDefinition definition, List<KnifePart> parts)
	{
		//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_0038: 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_004e: 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_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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		if (definition.Shape == KnifeShape.Karambit)
		{
			BuildKarambit(parts);
			return;
		}
		Vector2[] centerLine = (Vector2[])(object)new Vector2[6]
		{
			new Vector2(0f, 0.29f),
			new Vector2(0.15f, 0.45f),
			new Vector2(0.23f, 0.64f),
			new Vector2(0.19f, 0.83f),
			new Vector2(0.05f, 1f),
			new Vector2(-0.1f, 1.06f)
		};
		Add(parts, "CurvedBlade", MeshBuilder.Ribbon(centerLine, definition.BladeWidth * 0.42f, 0.035f, definition.DisplayName + " Blade"), PartMaterial.Blade);
		Add(parts, "Grip", MeshBuilder.Box2D(-0.075f, 0.03f, 0.075f, 0.32f, 0.075f, "Curved Grip"), PartMaterial.Grip);
		Add(parts, "FingerRing", MeshBuilder.Torus(0.085f, 0.022f, 20, 7, "Finger Ring"), PartMaterial.Accent, new Vector3(0f, 0.02f, 0f));
		Add(parts, "Guard", MeshBuilder.Box2D(-0.105f, 0.285f, 0.105f, 0.335f, 0.075f, "Curved Guard"), PartMaterial.Accent);
	}

	private static void BuildKarambit(List<KnifePart> parts)
	{
		//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_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_00ad: 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_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_00da: 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_0118: 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_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: 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_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: 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_0292: 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_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: 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_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_031c: 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_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_040e: Unknown result type (might be due to invalid IL or missing references)
		//IL_041f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_043a: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0450: Unknown result type (might be due to invalid IL or missing references)
		//IL_0462: Unknown result type (might be due to invalid IL or missing references)
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0490: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_04be: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0511: Unknown result type (might be due to invalid IL or missing references)
		//IL_0516: Unknown result type (might be due to invalid IL or missing references)
		//IL_0527: Unknown result type (might be due to invalid IL or missing references)
		//IL_052c: Unknown result type (might be due to invalid IL or missing references)
		//IL_053d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0542: Unknown result type (might be due to invalid IL or missing references)
		//IL_0553: Unknown result type (might be due to invalid IL or missing references)
		//IL_0558: Unknown result type (might be due to invalid IL or missing references)
		//IL_0569: Unknown result type (might be due to invalid IL or missing references)
		//IL_056e: Unknown result type (might be due to invalid IL or missing references)
		//IL_057f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0584: Unknown result type (might be due to invalid IL or missing references)
		//IL_0595: Unknown result type (might be due to invalid IL or missing references)
		//IL_059a: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0606: Unknown result type (might be due to invalid IL or missing references)
		//IL_060b: Unknown result type (might be due to invalid IL or missing references)
		//IL_061d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0622: Unknown result type (might be due to invalid IL or missing references)
		//IL_0650: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_070e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0713: Unknown result type (might be due to invalid IL or missing references)
		//IL_0724: Unknown result type (might be due to invalid IL or missing references)
		//IL_0729: Unknown result type (might be due to invalid IL or missing references)
		//IL_075b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0760: Unknown result type (might be due to invalid IL or missing references)
		//IL_0771: Unknown result type (might be due to invalid IL or missing references)
		//IL_0776: Unknown result type (might be due to invalid IL or missing references)
		//IL_0787: Unknown result type (might be due to invalid IL or missing references)
		//IL_078c: Unknown result type (might be due to invalid IL or missing references)
		//IL_079d: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0821: Unknown result type (might be due to invalid IL or missing references)
		//IL_0840: Unknown result type (might be due to invalid IL or missing references)
		//IL_0869: Unknown result type (might be due to invalid IL or missing references)
		//IL_0892: Unknown result type (might be due to invalid IL or missing references)
		//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_092a: Unknown result type (might be due to invalid IL or missing references)
		Vector2[] centerLine = (Vector2[])(object)new Vector2[10]
		{
			new Vector2(0f, 0.3f),
			new Vector2(-0.055f, 0.4f),
			new Vector2(-0.135f, 0.52f),
			new Vector2(-0.245f, 0.64f),
			new Vector2(-0.385f, 0.73f),
			new Vector2(-0.535f, 0.77f),
			new Vector2(-0.675f, 0.74f),
			new Vector2(-0.785f, 0.67f),
			new Vector2(-0.865f, 0.56f),
			new Vector2(-0.915f, 0.44f)
		};
		Add(parts, "KarambitBlade", MeshBuilder.Ribbon(centerLine, 0.118f, 0.052f, "Karambit Blade"), PartMaterial.Blade);
		Vector2[] centerLine2 = (Vector2[])(object)new Vector2[6]
		{
			new Vector2(-0.02f, 0.34f),
			new Vector2(-0.13f, 0.53f),
			new Vector2(-0.29f, 0.67f),
			new Vector2(-0.47f, 0.74f),
			new Vector2(-0.66f, 0.72f),
			new Vector2(-0.81f, 0.63f)
		};
		Add(parts, "KarambitSpineHighlight", MeshBuilder.Ribbon(centerLine2, 0.014f, 0.01f, "Karambit Spine Highlight"), PartMaterial.Edge, new Vector3(0f, 0f, 0.033f));
		Vector2[] centerLine3 = (Vector2[])(object)new Vector2[7]
		{
			new Vector2(-0.025f, 0.38f),
			new Vector2(-0.12f, 0.51f),
			new Vector2(-0.25f, 0.62f),
			new Vector2(-0.4f, 0.69f),
			new Vector2(-0.56f, 0.71f),
			new Vector2(-0.7f, 0.67f),
			new Vector2(-0.8f, 0.59f)
		};
		Add(parts, "KarambitFuller", MeshBuilder.Ribbon(centerLine3, 0.022f, 0.014f, "Karambit Fuller"), PartMaterial.Accent, new Vector3(0f, 0f, 0.034f));
		Vector2[] centerLine4 = (Vector2[])(object)new Vector2[8]
		{
			new Vector2(-0.025f, 0.31f),
			new Vector2(-0.11f, 0.43f),
			new Vector2(-0.22f, 0.56f),
			new Vector2(-0.36f, 0.66f),
			new Vector2(-0.52f, 0.71f),
			new Vector2(-0.68f, 0.69f),
			new Vector2(-0.81f, 0.61f),
			new Vector2(-0.89f, 0.5f)
		};
		Add(parts, "KarambitCuttingEdge", MeshBuilder.Ribbon(centerLine4, 0.014f, 0.012f, "Karambit Cutting Edge"), PartMaterial.Edge, new Vector3(0f, 0f, 0.036f));
		Vector2[] input = (Vector2[])(object)new Vector2[15]
		{
			new Vector2(-0.105f, 0.295f),
			new Vector2(0.105f, 0.295f),
			new Vector2(0.125f, 0.255f),
			new Vector2(0.104f, 0.205f),
			new Vector2(0.126f, 0.155f),
			new Vector2(0.106f, 0.105f),
			new Vector2(0.127f, 0.055f),
			new Vector2(0.105f, -0.005f),
			new Vector2(0.067f, -0.06f),
			new Vector2(-0.064f, -0.06f),
			new Vector2(-0.108f, -0.005f),
			new Vector2(-0.092f, 0.055f),
			new Vector2(-0.112f, 0.105f),
			new Vector2(-0.094f, 0.16f),
			new Vector2(-0.114f, 0.215f)
		};
		Add(parts, "KarambitGrip", MeshBuilder.ExtrudePolygon(input, 0.086f, "Karambit Grip"), PartMaterial.Grip);
		Vector2[] input2 = (Vector2[])(object)new Vector2[13]
		{
			new Vector2(-0.084f, 0.265f),
			new Vector2(0.084f, 0.265f),
			new Vector2(0.099f, 0.215f),
			new Vector2(0.081f, 0.165f),
			new Vector2(0.1f, 0.11f),
			new Vector2(0.08f, 0.055f),
			new Vector2(0.094f, 0.015f),
			new Vector2(0.046f, -0.027f),
			new Vector2(-0.046f, -0.027f),
			new Vector2(-0.082f, 0.02f),
			new Vector2(-0.075f, 0.075f),
			new Vector2(-0.086f, 0.13f),
			new Vector2(-0.073f, 0.2f)
		};
		Add(parts, "KarambitScale", MeshBuilder.ExtrudePolygon(input2, 0.014f, "Karambit Scale"), PartMaterial.Accent, new Vector3(0f, 0f, 0.049f));
		for (int i = 0; i < 4; i++)
		{
			float num = 0.045f + (float)i * 0.053f;
			Add(parts, "KarambitScaleChannel" + i, MeshBuilder.Box2D(-0.066f, num, 0.066f, num + 0.013f, 0.01f, "Karambit Scale Channel"), PartMaterial.Grip, new Vector3(0f, 0f, 0.059f));
		}
		Add(parts, "KarambitGuard", MeshBuilder.ExtrudePolygon((Vector2[])(object)new Vector2[4]
		{
			new Vector2(-0.125f, 0.275f),
			new Vector2(0.125f, 0.275f),
			new Vector2(0.112f, 0.326f),
			new Vector2(-0.112f, 0.326f)
		}, 0.09f, "Karambit Guard"), PartMaterial.Accent);
		Add(parts, "KarambitRingBridge", MeshBuilder.ExtrudePolygon((Vector2[])(object)new Vector2[4]
		{
			new Vector2(-0.07f, -0.08f),
			new Vector2(0.07f, -0.08f),
			new Vector2(0.062f, 0.03f),
			new Vector2(-0.062f, 0.03f)
		}, 0.092f, "Karambit Ring Bridge"), PartMaterial.Grip);
		Add(parts, "FingerRingOuter", MeshBuilder.Torus(0.104f, 0.02f, 32, 10, "Karambit Finger Ring Outer"), PartMaterial.Edge, new Vector3(0f, -0.112f, 0.02f));
		Add(parts, "FingerRingInset", MeshBuilder.Torus(0.082f, 0.009f, 28, 8, "Karambit Finger Ring Inset"), PartMaterial.Accent, new Vector3(0f, -0.112f, 0.042f));
		AddFastener(parts, "KarambitPivot", new Vector3(0.055f, 0.257f, 0.061f), 0.018f, 0.008f);
		AddFastener(parts, "KarambitScalePinA", new Vector3(-0.055f, 0.205f, 0.061f), 0.012f, 0.006f);
		AddFastener(parts, "KarambitScalePinB", new Vector3(0.055f, 0.07f, 0.061f), 0.012f, 0.006f);
		AddFastener(parts, "KarambitRingPin", new Vector3(0.046f, -0.055f, 0.061f), 0.01f, 0.005f);
		for (int j = 0; j < 6; j++)
		{
			float num2 = -0.07f + (float)j * 0.028f;
			Add(parts, "KarambitJimp" + j, MeshBuilder.Box2D(num2, 0.314f, num2 + 0.014f, 0.347f, 0.018f, "Karambit Jimping"), PartMaterial.Accent, new Vector3(0f, 0f, 0.038f));
		}
	}

	private static void AddFastener(List<KnifePart> parts, string name, Vector3 position, float radius, float tube)
	{
		//IL_0028: 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_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)
		Add(parts, name + "Head", MeshBuilder.Cylinder(radius, tube * 2.2f, 20, name + " Head"), PartMaterial.Edge, position);
		Add(parts, name + "Ring", MeshBuilder.Torus(radius, tube, 20, 7, name + " Ring"), PartMaterial.Accent, position + new Vector3(0f, 0f, tube * 1.5f));
	}

	private static void BuildPushDagger(KnifeDefinition definition, List<KnifePart> parts)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: 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_0059: 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)
		Vector2[] input = (Vector2[])(object)new Vector2[5]
		{
			new Vector2(-0.105f, 0.24f),
			new Vector2(0.105f, 0.24f),
			new Vector2(0.075f, 0.57f),
			new Vector2(0f, 0.72f),
			new Vector2(-0.075f, 0.57f)
		};
		Add(parts, "DaggerBlade", MeshBuilder.ExtrudePolygon(input, 0.045f, "Dagger Blade"), PartMaterial.Blade);
		Add(parts, "DaggerGrip", MeshBuilder.Box2D(-0.22f, 0.12f, 0.22f, 0.23f, 0.09f, "Dagger Grip"), PartMaterial.Grip);
		Add(parts, "DaggerGuard", MeshBuilder.Box2D(-0.135f, 0.225f, 0.135f, 0.275f, 0.085f, "Dagger Guard"), PartMaterial.Accent);
	}

	private static void BuildButterfly(KnifeDefinition definition, List<KnifePart> parts)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: 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_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_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: 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_00b7: 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_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_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: 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_0202: 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_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: 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_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: 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_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0371: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: 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_040e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_043a: Unknown result type (might be due to invalid IL or missing references)
		//IL_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0450: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_046e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_0484: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_049f: 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_04b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0515: Unknown result type (might be due to invalid IL or missing references)
		//IL_051f: Unknown result type (might be due to invalid IL or missing references)
		//IL_054c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0556: Unknown result type (might be due to invalid IL or missing references)
		//IL_0588: Unknown result type (might be due to invalid IL or missing references)
		//IL_0592: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_060d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0617: Unknown result type (might be due to invalid IL or missing references)
		//IL_063d: Unknown result type (might be due to invalid IL or missing references)
		//IL_064e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0653: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0681: Unknown result type (might be due to invalid IL or missing references)
		//IL_0692: Unknown result type (might be due to invalid IL or missing references)
		//IL_0697: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0704: Unknown result type (might be due to invalid IL or missing references)
		//IL_0715: Unknown result type (might be due to invalid IL or missing references)
		//IL_071a: 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_0730: Unknown result type (might be due to invalid IL or missing references)
		//IL_0741: Unknown result type (might be due to invalid IL or missing references)
		//IL_0746: Unknown result type (might be due to invalid IL or missing references)
		//IL_0757: Unknown result type (might be due to invalid IL or missing references)
		//IL_075c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0780: Unknown result type (might be due to invalid IL or missing references)
		//IL_078a: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0802: Unknown result type (might be due to invalid IL or missing references)
		//IL_080c: Unknown result type (might be due to invalid IL or missing references)
		//IL_082b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0835: Unknown result type (might be due to invalid IL or missing references)
		//IL_0854: Unknown result type (might be due to invalid IL or missing references)
		//IL_0859: Unknown result type (might be due to invalid IL or missing references)
		//IL_086a: Unknown result type (might be due to invalid IL or missing references)
		//IL_086f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0880: Unknown result type (might be due to invalid IL or missing references)
		//IL_0885: Unknown result type (might be due to invalid IL or missing references)
		//IL_0896: Unknown result type (might be due to invalid IL or missing references)
		//IL_089b: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0923: Unknown result type (might be due to invalid IL or missing references)
		//IL_092d: Unknown result type (might be due to invalid IL or missing references)
		//IL_096d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0977: Unknown result type (might be due to invalid IL or missing references)
		//IL_0989: Unknown result type (might be due to invalid IL or missing references)
		//IL_099b: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_09bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_09eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_09fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a01: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a16: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a20: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a53: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5d: Unknown result type (might be due to invalid IL or missing references)
		if (!EmbeddedKnifeMesh.TryLoadButterfly(parts, out var error))
		{
			MoreKnivesPlugin.Log.LogError((object)("The professional Blender Butterfly V4 could not be loaded; using the emergency fallback. " + error));
			Vector2[] input = (Vector2[])(object)new Vector2[13]
			{
				new Vector2(-0.064f, 0.292f),
				new Vector2(0.064f, 0.292f),
				new Vector2(0.078f, 0.405f),
				new Vector2(0.076f, 0.61f),
				new Vector2(0.064f, 0.79f),
				new Vector2(0.042f, 0.95f),
				new Vector2(0.018f, 1.075f),
				new Vector2(-0.006f, 1.115f),
				new Vector2(-0.03f, 1.08f),
				new Vector2(-0.052f, 0.96f),
				new Vector2(-0.072f, 0.78f),
				new Vector2(-0.084f, 0.58f),
				new Vector2(-0.081f, 0.405f)
			};
			Vector2[] input2 = (Vector2[])(object)new Vector2[7]
			{
				new Vector2(-0.02f, 0.375f),
				new Vector2(0.026f, 0.385f),
				new Vector2(0.024f, 0.63f),
				new Vector2(0.012f, 0.82f),
				new Vector2(-0.002f, 0.96f),
				new Vector2(-0.016f, 0.82f),
				new Vector2(-0.026f, 0.62f)
			};
			Vector2[] centerLine = (Vector2[])(object)new Vector2[5]
			{
				new Vector2(-0.058f, 0.325f),
				new Vector2(-0.067f, 0.47f),
				new Vector2(-0.057f, 0.68f),
				new Vector2(-0.039f, 0.86f),
				new Vector2(-0.02f, 1.015f)
			};
			Vector2[] input3 = (Vector2[])(object)new Vector2[8]
			{
				new Vector2(-0.145f, -0.075f),
				new Vector2(-0.024f, -0.075f),
				new Vector2(-0.017f, 0.16f),
				new Vector2(-0.022f, 0.255f),
				new Vector2(-0.037f, 0.305f),
				new Vector2(-0.127f, 0.305f),
				new Vector2(-0.143f, 0.255f),
				new Vector2(-0.151f, 0.14f)
			};
			Vector2[] input4 = (Vector2[])(object)new Vector2[8]
			{
				new Vector2(0.024f, -0.075f),
				new Vector2(0.145f, -0.075f),
				new Vector2(0.151f, 0.14f),
				new Vector2(0.143f, 0.255f),
				new Vector2(0.127f, 0.305f),
				new Vector2(0.037f, 0.305f),
				new Vector2(0.022f, 0.255f),
				new Vector2(0.017f, 0.16f)
			};
			Vector2[] input5 = (Vector2[])(object)new Vector2[6]
			{
				new Vector2(-0.126f, -0.035f),
				new Vector2(-0.043f, -0.035f),
				new Vector2(-0.037f, 0.18f),
				new Vector2(-0.047f, 0.267f),
				new Vector2(-0.117f, 0.267f),
				new Vector2(-0.131f, 0.18f)
			};
			Vector2[] input6 = (Vector2[])(object)new Vector2[6]
			{
				new Vector2(0.043f, -0.035f),
				new Vector2(0.126f, -0.035f),
				new Vector2(0.131f, 0.18f),
				new Vector2(0.117f, 0.267f),
				new Vector2(0.047f, 0.267f),
				new Vector2(0.037f, 0.18f)
			};
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0f, 0.3f, 0f);
			AddGrouped(parts, "ButterflyBlade", MeshBuilder.ExtrudePolygon(input, 0.05f, "Butterfly Blade"), PartMaterial.Blade, Vector3.zero, "ButterflyBlade", val);
			AddGrouped(parts, "ButterflyBladeFuller", MeshBuilder.ExtrudePolygon(input2, 0.058f, "Butterfly Fuller"), PartMaterial.Accent, new Vector3(0f, 0f, 0.032f), "ButterflyBlade", val);
			AddGrouped(parts, "ButterflyBladeEdge", MeshBuilder.Ribbon(centerLine, 0.012f, 0.012f, "Butterfly Cutting Edge"), PartMaterial.Edge, new Vector3(0f, 0f, 0.037f), "ButterflyBlade", val);
			AddGrouped(parts, "ButterflyTang", MeshBuilder.ExtrudePolygon((Vector2[])(object)new Vector2[4]
			{
				new Vector2(-0.088f, 0.275f),
				new Vector2(0.088f, 0.275f),
				new Vector2(0.075f, 0.342f),
				new Vector2(-0.075f, 0.342f)
			}, 0.068f, "Butterfly Tang"), PartMaterial.Accent, Vector3.zero, "ButterflyBlade", val);
			AddGrouped(parts, "ButterflyHinge", MeshBuilder.Torus(0.072f, 0.016f, 28, 9, "Butterfly Hinge"), PartMaterial.Accent, val + new Vector3(0f, 0f, 0.038f), "ButterflyBlade", val);
			AddGrouped(parts, "ButterflyHingeBolt", MeshBuilder.Cylinder(0.028f, 0.018f, 22, "Butterfly Hinge Bolt"), PartMaterial.Edge, val + new Vector3(0f, 0f, 0.058f), "ButterflyBlade", val);
			AddGrouped(parts, "ButterflyHandleLeftBody", MeshBuilder.ExtrudePolygon(input3, 0.078f, "Butterfly Left Handle"), PartMaterial.Grip, Vector3.zero, "ButterflyHandleLeft", val);
			AddGrouped(parts, "ButterflyHandleLeftLiner", MeshBuilder.ExtrudePolygon((Vector2[])(object)new Vector2[6]
			{
				new Vector2(-0.137f, -0.05f),
				new Vector2(-0.033f, -0.05f),
				new Vector2(-0.028f, 0.17f),
				new Vector2(-0.04f, 0.283f),
				new Vector2(-0.121f, 0.283f),
				new Vector2(-0.137f, 0.18f)
			}, 0.01f, "Butterfly Left Liner"), PartMaterial.Accent, new Vector3(0f, 0f, 0.045f), "ButterflyHandleLeft", val);
			AddGrouped(parts, "ButterflyHandleLeftScale", MeshBuilder.ExtrudePolygon(input5, 0.016f, "Butterfly Left Scale"), PartMaterial.Grip, new Vector3(0f, 0f, 0.055f), "ButterflyHandleLeft", val);
			AddGrouped(parts, "ButterflyHandleLeftInset", MeshBuilder.Box2D(-0.116f, 0.025f, -0.052f, 0.225f, 0.012f, "Butterfly Left Channel"), PartMaterial.Accent, new Vector3(0f, 0f, 0.067f), "ButterflyHandleLeft", val);
			AddGrouped(parts, "ButterflyHandleRightBody", MeshBuilder.ExtrudePolygon(input4, 0.078f, "Butterfly Right Handle"), PartMaterial.Grip, Vector3.zero, "ButterflyHandleRight", val);
			AddGrouped(parts, "ButterflyHandleRightLiner", MeshBuilder.ExtrudePolygon((Vector2[])(object)new Vector2[6]
			{
				new Vector2(0.033f, -0.05f),
				new Vector2(0.137f, -0.05f),
				new Vector2(0.137f, 0.18f),
				new Vector2(0.121f, 0.283f),
				new Vector2(0.04f, 0.283f),
				new Vector2(0.028f, 0.17f)
			}, 0.01f, "Butterfly Right Liner"), PartMaterial.Accent, new Vector3(0f, 0f, 0.045f), "ButterflyHandleRight", val);
			AddGrouped(parts, "ButterflyHandleRightScale", MeshBuilder.ExtrudePolygon(input6, 0.016f, "Butterfly Right Scale"), PartMaterial.Grip, new Vector3(0f, 0f, 0.055f), "ButterflyHandleRight", val);
			AddGrouped(parts, "ButterflyHandleRightInset", MeshBuilder.Box2D(0.052f, 0.025f, 0.116f, 0.225f, 0.012f, "Butterfly Right Channel"), PartMaterial.Accent, new Vector3(0f, 0f, 0.067f), "ButterflyHandleRight", val);
			AddButterflyFasteners(parts, "ButterflyHandleLeft", -1f, val);
			AddButterflyFasteners(parts, "ButterflyHandleRight", 1f, val);
			AddGrouped(parts, "ButterflyLatch", MeshBuilder.ExtrudePolygon((Vector2[])(object)new Vector2[4]
			{
				new Vector2(0.045f, -0.08f),
				new Vector2(0.112f, -0.08f),
				new Vector2(0.108f, -0.02f),
				new Vector2(0.05f, -0.02f)
			}, 0.066f, "Butterfly Latch"), PartMaterial.Accent, Vector3.zero, "ButterflyHandleRight", val);
			AddGrouped(parts, "ButterflyLatchPin", MeshBuilder.Cylinder(0.011f, 0.014f, 16, "Butterfly Latch Pin"), PartMaterial.Edge, new Vector3(0.08f, -0.05f, 0.052f), "ButterflyHandleRight", val);
		}
	}

	private static void AddButterflyFasteners(List<KnifePart> parts, string group, float side, Vector3 pivot)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: 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_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		AddGrouped(parts, group + "PivotBolt", MeshBuilder.Cylinder(0.024f, 0.018f, 20, group + " Pivot Bolt"), PartMaterial.Edge, new Vector3(side * 0.07f, 0.27f, 0.06f), group, pivot);
		AddGrouped(parts, group + "PivotRing", MeshBuilder.Torus(0.025f, 0.006f, 20, 7, group + " Pivot Ring"), PartMaterial.Accent, new Vector3(side * 0.07f, 0.27f, 0.073f), group, pivot);
		AddGrouped(parts, group + "StopPin", MeshBuilder.Cylinder(0.012f, 0.014f, 16, group + " Stop Pin"), PartMaterial.Edge, new Vector3(side * 0.08f, 0.01f, 0.061f), group, pivot);
		AddGrouped(parts, group + "LatchPin", MeshBuilder.Cylinder(0.01f, 0.012f, 16, group + " Latch Pin"), PartMaterial.Edge, new Vector3(side * 0.078f, -0.05f, 0.06f), group, pivot);
		for (int i = 0; i < 7; i++)
		{
			float num = 0.025f + (float)i * 0.034f;
			AddGrouped(parts, group + "Jimp" + i, MeshBuilder.Box2D((side < 0f) ? (-0.134f) : 0.062f, num, (side < 0f) ? (-0.112f) : 0.134f, num + 0.012f, 0.014f, group + " Jimping"), PartMaterial.Accent, new Vector3(0f, 0f, 0.07f), group, pivot);
		}
	}

	private static void BuildSkeleton(KnifeDefinition definition, List<KnifePart> parts)
	{
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		Vector2[] input = BladePolygon(KnifeShape.Skeleton, definition.BladeWidth, definition.LengthScale);
		Add(parts, "SkeletonBlade", MeshBuilder.ExtrudePolygon(input, 0.035f, "Skeleton Blade"), PartMaterial.Blade);
		Add(parts, "SkeletonRailLeft", MeshBuilder.Box2D(-0.075f, 0.02f, -0.045f, 0.31f, 0.06f, "Skeleton Rail"), PartMaterial.Grip);
		Add(parts, "SkeletonRailRight", MeshBuilder.Box2D(0.045f, 0.02f, 0.075f, 0.31f, 0.06f, "Skeleton Rail"), PartMaterial.Grip);
		for (int i = 0; i < 3; i++)
		{
			float num = 0.08f + (float)i * 0.085f;
			Add(parts, "SkeletonRung" + i, MeshBuilder.Box2D(-0.065f, num, 0.065f, num + 0.022f, 0.058f, "Skeleton Rung"), PartMaterial.Accent);
		}
		Add(parts, "SkeletonRing", MeshBuilder.Torus(0.075f, 0.018f, 18, 6, "Skeleton Ring"), PartMaterial.Accent, new Vector3(0f, 0.025f, 0f));
		Add(parts, "SkeletonGuard", MeshBuilder.Box2D(-0.115f, 0.285f, 0.115f, 0.335f, 0.07f, "Skeleton Guard"), PartMaterial.Accent);
	}

	private static Vector2[] BladePolygon(KnifeShape shape, float width, float tip)
	{
		//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_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_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: 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_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: 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_023a: 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_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: 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_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: 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_035d: 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)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		switch (shape)
		{
		case KnifeShape.M9Bayonet:
			return (Vector2[])(object)new Vector2[6]
			{
				new Vector2((0f - width) * 0.48f, 0.31f),
				new Vector2(width * 0.48f, 0.31f),
				new Vector2(width * 0.43f, tip * 0.72f),
				new Vector2(width * 0.18f, tip * 0.91f),
				new Vector2((0f - width) * 0.08f, tip),
				new Vector2((0f - width) * 0.4f, tip * 0.84f)
			};
		case KnifeShape.Flip:
		case KnifeShape.Navaja:
			return (Vector2[])(object)new Vector2[5]
			{
				new Vector2((0f - width) * 0.45f, 0.3f),
				new Vector2(width * 0.45f, 0.3f),
				new Vector2(width * 0.4f, tip * 0.72f),
				new Vector2(0f, tip),
				new Vector2((0f - width) * 0.3f, tip * 0.82f)
			};
		case KnifeShape.Gut:
		case KnifeShape.Falchion:
			return (Vector2[])(object)new Vector2[6]
			{
				new Vector2((0f - width) * 0.5f, 0.3f),
				new Vector2(width * 0.5f, 0.3f),
				new Vector2(width * 0.52f, tip * 0.62f),
				new Vector2(width * 0.3f, tip * 0.88f),
				new Vector2((0f - width) * 0.08f, tip),
				new Vector2((0f - width) * 0.46f, tip * 0.76f)
			};
		case KnifeShape.Huntsman:
		case KnifeShape.Bowie:
			return (Vector2[])(object)new Vector2[6]
			{
				new Vector2((0f - width) * 0.52f, 0.3f),
				new Vector2(width * 0.52f, 0.3f),
				new Vector2(width * 0.48f, tip * 0.7f),
				new Vector2(width * 0.14f, tip * 0.88f),
				new Vector2((0f - width) * 0.16f, tip),
				new Vector2((0f - width) * 0.5f, tip * 0.82f)
			};
		case KnifeShape.Stiletto:
			return (Vector2[])(object)new Vector2[4]
			{
				new Vector2((0f - width) * 0.48f, 0.3f),
				new Vector2(0f, tip),
				new Vector2(width * 0.48f, 0.3f),
				new Vector2(0f, 0.36f)
			};
		case KnifeShape.Ursus:
		case KnifeShape.Survival:
		case KnifeShape.Nomad:
			return (Vector2[])(object)new Vector2[5]
			{
				new Vector2((0f - width) * 0.5f, 0.3f),
				new Vector2(width * 0.5f, 0.3f),
				new Vector2(width * 0.38f, tip * 0.78f),
				new Vector2(0f, tip),
				new Vector2((0f - width) * 0.42f, tip * 0.88f)
			};
		default:
			return (Vector2[])(object)new Vector2[5]
			{
				new Vector2((0f - width) * 0.46f, 0.3f),
				new Vector2(width * 0.46f, 0.3f),
				new Vector2(width * 0.37f, tip * 0.79f),
				new Vector2(0f, tip),
				new Vector2((0f - width) * 0.34f, tip * 0.86f)
			};
		}
	}

	private static void Add(List<KnifePart> parts, string name, Mesh mesh, PartMaterial material)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		Add(parts, name, mesh, material, Vector3.zero);
	}

	private static void Add(List<KnifePart> parts, string name, Mesh mesh, PartMaterial material, Vector3 position)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		parts.Add(new KnifePart
		{
			Name = name,
			Mesh = mesh,
			Material = material,
			Position = position
		});
	}

	private static void AddGrouped(List<KnifePart> parts, string name, Mesh mesh, PartMaterial material, Vector3 position, string group, Vector3 pivot)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		parts.Add(new KnifePart
		{
			Name = name,
			Mesh = mesh,
			Material = material,
			Position = position,
			AnimationGroup = group,
			GroupPivot = pivot
		});
	}

	private static Mesh CombineForInventory(KnifeDefinition definition, List<KnifePart> parts)
	{
		//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_0025: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: 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_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_00ab: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Expected O, but got Unknown
		CombineInstance[] array = (CombineInstance[])(object)new CombineInstance[parts.Count];
		Matrix4x4 val = Matrix4x4.Rotate(Quaternion.Euler(90f, 0f, 0f));
		for (int i = 0; i < parts.Count; i++)
		{
			KnifePart knifePart = parts[i];
			int num = i;
			CombineInstance val2 = default(CombineInstance);
			((CombineInstance)(ref val2)).mesh = knifePart.Mesh;
			((CombineInstance)(ref val2)).transform = val * Matrix4x4.TRS(knifePart.Position, knifePart.Rotation, knifePart.Scale);
			array[num] = val2;
		}
		Mesh val3 = new Mesh
		{
			name = "MoreKnives_" + definition.DisplayName.Replace(" ", string.Empty),
			hideFlags = (HideFlags)52,
			indexFormat = (IndexFormat)1
		};
		val3.CombineMeshes(array, true, true, false);
		val3.RecalculateBounds();
		return val3;
	}

	private static Material GetMaterial(KnifeAssetSet assets, PartMaterial partMaterial)
	{
		return (Material)(partMaterial switch
		{
			PartMaterial.Grip => assets.GripMaterial, 
			PartMaterial.Edge => assets.EdgeMaterial, 
			PartMaterial.Accent => assets.AccentMaterial, 
			PartMaterial.Dark => assets.DarkMaterial, 
			_ => assets.BladeMaterial, 
		});
	}

	private static Material CreateMaterial(string name, Color color, float metallic, float smoothness, bool createNormalMap = true)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0051: 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)
		Shader val = Shader.Find("Universal Render Pipeline/Lit");
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = Shader.Find("Standard");
		}
		Material val2 = new Material(val);
		((Object)val2).name = "MoreKnives " + name;
		((Object)val2).hideFlags = (HideFlags)52;
		if (val2.HasProperty("_BaseColor"))
		{
			val2.SetColor("_BaseColor", color);
		}
		if (val2.HasProperty("_Color"))
		{
			val2.SetColor("_Color", color);
		}
		if (val2.HasProperty("_Metallic"))
		{
			val2.SetFloat("_Metallic", metallic);
		}
		if (val2.HasProperty("_Smoothness"))
		{
			val2.SetFloat("_Smoothness", smoothness);
		}
		if (val2.HasProperty("_Glossiness"))
		{
			val2.SetFloat("_Glossiness", smoothness);
		}
		if (val2.HasProperty("_ClearCoatMask"))
		{
			val2.SetFloat("_ClearCoatMask", (metallic > 0.7f) ? 0.72f : 0.18f);
			val2.SetFloat("_ClearCoatSmoothness", Mathf.Clamp01(smoothness + 0.08f));
			val2.EnableKeyword("_CLEARCOAT");
		}
		Texture2D val3 = CreateSurfaceTexture(name, metallic > 0.5f);
		if (val2.HasProperty("_BaseMap"))
		{
			val2.SetTexture("_BaseMap", (Texture)(object)val3);
		}
		if (val2.HasProperty("_MainTex"))
		{
			val2.SetTexture("_MainTex", (Texture)(object)val3);
		}
		if (createNormalMap && val2.HasProperty("_BumpMap"))
		{
			val2.SetTexture("_BumpMap", (Texture)(object)CreateNormalTexture(name, metallic > 0.5f));
			val2.EnableKeyword("_NORMALMAP");
		}
		return val2;
	}

	private static Texture2D CreateSurfaceTexture(string name, bool metal)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
		((Object)val).name = "MoreKnives Surface " + name;
		((Texture)val).wrapMode = (TextureWrapMode)0;
		((Texture)val).filterMode = (FilterMode)1;
		Color32[] array = (Color32[])(object)new Color32[16384];
		int hashCode = name.GetHashCode();
		for (int i = 0; i < 128; i++)
		{
			for (int j = 0; j < 128; j++)
			{
				float num = Mathf.Sin((float)j * 0.73f + (float)i * 0.17f + (float)hashCode * 0.001f) * 0.035f;
				float num2 = Mathf.Sin((float)j * 4.7f + (float)i * 3.1f + (float)hashCode * 0.0003f) * (metal ? 0.018f : 0.045f);
				float num3 = Mathf.Clamp01(1f + num + num2);
				if (!metal)
				{
					num3 = Mathf.Lerp(num3, 0.86f, 0.22f);
				}
				array[i * 128 + j] = Color32.op_Implicit(new Color(num3, num3, num3, 1f));
			}
		}
		val.SetPixels32(array);
		val.Apply(false, true);
		return val;
	}

	private static Texture2D CreateNormalTexture(string name, bool metal)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
		((Object)val).name = "MoreKnives Normal " + name;
		((Texture)val).wrapMode = (TextureWrapMode)0;
		((Texture)val).filterMode = (FilterMode)1;
		Color32[] array = (Color32[])(object)new Color32[16384];
		int hashCode = name.GetHashCode();
		for (int i = 0; i < 128; i++)
		{
			for (int j = 0; j < 128; j++)
			{
				float num = Mathf.Sin((float)j * 0.63f + (float)i * 0.29f + (float)hashCode * 0.0011f);
				float num2 = Mathf.Sin((float)j * 5.1f + (float)i * 3.7f + (float)hashCode * 0.00017f);
				float num3 = (metal ? 0.018f : 0.03f) * num + (metal ? 0.008f : 0.012f) * num2;
				array[i * 128 + j] = Color32.op_Implicit(new Color(0.5f + num3, 0.5f - num3, 1f, 1f));
			}
		}
		val.SetPixels32(array);
		val.Apply(false, true);
		return val;
	}

	private static void SetLayerRecursively(GameObject gameObject, int layer)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		gameObject.layer = layer;
		foreach (Transform item in gameObject.transform)
		{
			SetLayerRecursively(((Component)item).gameObject, layer);
		}
	}
}
internal static class MeshBuilder
{
	public static Mesh Box2D(float xMin, float yMin, float xMax, float yMax, float thickness, string name)
	{
		//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_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_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_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		return ExtrudePolygon((Vector2[])(object)new Vector2[4]
		{
			new Vector2(xMin, yMin),
			new Vector2(xMax, yMin),
			new Vector2(xMax, yMax),
			new Vector2(xMin, yMax)
		}, thickness, name);
	}

	public static Mesh Ribbon(Vector2[] centerLine, float halfWidth, float thickness, string name)
	{
		//IL_0024: 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)
		//IL_0035: 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_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: 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_010f: Unknown result type (might be due to invalid IL or missing references)
		List<Vector2> list = new List<Vector2>();
		Vector2[] array = (Vector2[])(object)new Vector2[centerLine.Length];
		Vector2[] array2 = (Vector2[])(object)new Vector2[centerLine.Length];
		Vector2 val2 = default(Vector2);
		for (int i = 0; i < centerLine.Length; i++)
		{
			Vector2 val = ((i != 0) ? ((i != centerLine.Length - 1) ? (centerLine[i + 1] - centerLine[i - 1]) : (centerLine[i] - centerLine[i - 1])) : (centerLine[1] - centerLine[0]));
			((Vector2)(ref val)).Normalize();
			((Vector2)(ref val2))..ctor(0f - val.y, val.x);
			float num = Mathf.Lerp(1f, 0.12f, (float)i / (float)(centerLine.Length - 1));
			array[i] = centerLine[i] + val2 * halfWidth * num;
			array2[i] = centerLine[i] - val2 * halfWidth * num;
		}
		list.AddRange(array);
		for (int num2 = array2.Length - 1; num2 >= 0; num2--)
		{
			list.Add(array2[num2]);
		}
		return ExtrudePolygon(list.ToArray(), thickness, name);
	}

	public static Mesh Torus(float radius, float tube, int segments, int sides, string name)
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		List<Vector3> list = new List<Vector3>();
		List<int> list2 = new List<int>();
		for (int i = 0; i < segments; i++)
		{
			float num = (float)i / (float)segments * (float)Math.PI * 2f;
			float num2 = Mathf.Cos(num);
			float num3 = Mathf.Sin(num);
			for (int j = 0; j < sides; j++)
			{
				float num4 = (float)j / (float)sides * (float)Math.PI * 2f;
				float num5 = radius + tube * Mathf.Cos(num4);
				list.Add(new Vector3(num2 * num5, num3 * num5, tube * Mathf.Sin(num4)));
			}
		}
		for (int k = 0; k < segments; k++)
		{
			int num6 = (k + 1) % segments;
			for (int l = 0; l < sides; l++)
			{
				int num7 = (l + 1) % sides;
				int item = k * sides + l;
				int item2 = num6 * sides + l;
				int item3 = num6 * sides + num7;
				int item4 = k * sides + num7;
				list2.Add(item);
				list2.Add(item2);
				list2.Add(item3);
				list2.Add(item);
				list2.Add(item3);
				list2.Add(item4);
			}
		}
		return Finish(name, list, list2);
	}

	public static Mesh Cylinder(float radius, float depth, int sides, string name)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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)
		sides = Mathf.Max(8, sides);
		List<Vector3> list = new List<Vector3>(sides * 2 + 2);
		List<int> list2 = new List<int>(sides * 12);
		float num = depth * 0.5f;
		list.Add(new Vector3(0f, 0f, 0f - num));
		list.Add(new Vector3(0f, 0f, num));
		for (int i = 0; i < sides; i++)
		{
			float num2 = (float)i / (float)sides * (float)Math.PI * 2f;
			float num3 = Mathf.Cos(num2) * radius;
			float num4 = Mathf.Sin(num2) * radius;
			list.Add(new Vector3(num3, num4, 0f - num));
			list.Add(new Vector3(num3, num4, num));
		}
		for (int j = 0; j < sides; j++)
		{
			int num5 = (j + 1) % sides;
			int num6 = 2 + j * 2;
			int num7 = 2 + num5 * 2;
			int item = num6 + 1;
			int item2 = num7 + 1;
			list2.Add(num6);
			list2.Add(num7);
			list2.Add(item2);
			list2.Add(num6);
			list2.Add(item2);
			list2.Add(item);
			list2.Add(0);
			list2.Add(num7);
			list2.Add(num6);
			list2.Add(1);
			list2.Add(item);
			list2.Add(item2);
		}
		return Finish(name, list, list2);
	}

	public static Mesh ExtrudePolygon(Vector2[] input, float thickness, string name)
	{
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: 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)
		if (input == null || input.Length < 3)
		{
			throw new ArgumentException("A polygon needs at least three points.", "input");
		}
		List<Vector2> list = new List<Vector2>(input);
		if (SignedArea(list) < 0f)
		{
			list.Reverse();
		}
		List<int> list2 = Triangulate(list);
		List<Vector3> vertices = new List<Vector3>();
		List<int> list3 = new List<int>();
		float num = thickness * 0.5f;
		float num2 = Mathf.Clamp(thickness * 0.24f, 0.0025f, 0.018f);
		float num3 = Mathf.Clamp(Mathf.Max(0.006f, thickness * 0.42f), 0.004f, 0.02f);
		Vector2 val = Vector2.zero;
		foreach (Vector2 item in list)
		{
			val += item;
		}
		val /= (float)list.Count;
		int num4 = AddRing(vertices, list, val, 1f, 0f - num);
		int num5 = AddRing(vertices, list, val, 1f - num3, 0f - num + num2);
		int num6 = AddRing(vertices, list, val, 1f - num3, num - num2);
		int num7 = AddRing(vertices, list, val, 1f, num);
		for (int i = 0; i < list2.Count; i += 3)
		{
			int num8 = list2[i];
			int num9 = list2[i + 1];
			int num10 = list2[i + 2];
			list3.Add(num6 + num8);
			list3.Add(num6 + num10);
			list3.Add(num6 + num9);
			list3.Add(num5 + num8);
			list3.Add(num5 + num9);
			list3.Add(num5 + num10);
		}
		AddRingFaces(list3, num7, num6, list.Count, reverse: true);
		AddRingFaces(list3, num5, num4, list.Count, reverse: true);
		AddRingFaces(list3, num4, num7, list.Count, reverse: false);
		return Finish(name, vertices, list3);
	}

	private static int AddRing(List<Vector3> vertices, List<Vector2> polygon, Vector2 centroid, float scale, float z)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_002b: 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_0033: 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)
		int count = vertices.Count;
		foreach (Vector2 item in polygon)
		{
			Vector2 val = centroid + (item - centroid) * scale;
			vertices.Add(new Vector3(val.x, val.y, z));
		}
		return count;
	}

	private static void AddRingFaces(List<int> triangles, int first, int second, int count, bool reverse)
	{
		for (int i = 0; i < count; i++)
		{
			int num = (i + 1) % count;
			int item = first + i;
			int item2 = first + num;
			int item3 = second + num;
			int item4 = second + i;
			if (reverse)
			{
				triangles.Add(item);
				triangles.Add(item3);
				triangles.Add(item2);
				triangles.Add(item);
				triangles.Add(item4);
				triangles.Add(item3);
			}
			else
			{
				triangles.Add(item);
				triangles.Add(item2);
				triangles.Add(item3);
				triangles.Add(item);
				triangles.Add(item3);
				triangles.Add(item4);
			}
		}
	}

	private static Mesh Finish(string name, List<Vector3> vertices, List<int> triangles)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//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_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_0064: Unknown result type (might be due to invalid IL or missing references)
		Mesh val = new Mesh();
		((Object)val).name = "MoreKnives " + name;
		((Object)val).hideFlags = (HideFlags)52;
		val.SetVertices(vertices);
		val.SetTriangles(triangles, 0);
		List<Vector2> list = new List<Vector2>(vertices.Count);
		foreach (Vector3 vertex in vertices)
		{
			list.Add(new Vector2(vertex.x * 8f, vertex.y * 8f));
		}
		val.SetUVs(0, list);
		val.RecalculateNormals();
		val.RecalculateBound