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 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 list = new List(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 Parts = new List(); 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 Cache = new Dictionary(); 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 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().sharedMesh = part.Mesh; ((Renderer)val5.AddComponent()).sharedMaterial = GetMaterial(knifeAssetSet, part.Material); } SetLayerRecursively(val, ((Component)parent).gameObject.layer); return val; } private static Dictionary CreateAnimationGroups(KnifeDefinition definition, List 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 dictionary = new Dictionary(); 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 list = new List(); 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 list = new List(); List list2 = new List(); 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 list = new List(sides * 2 + 2); List list2 = new List(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 list = new List(input); if (SignedArea(list) < 0f) { list.Reverse(); } List list2 = Triangulate(list); List vertices = new List(); List list3 = new List(); 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 vertices, List 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 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 vertices, List 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 list = new List(vertices.Count); foreach (Vector3 vertex in vertices) { list.Add(new Vector2(vertex.x * 8f, vertex.y * 8f)); } val.SetUVs(0, list); val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static float SignedArea(List polygon) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) float num = 0f; for (int i = 0; i < polygon.Count; i++) { Vector2 val = polygon[i]; Vector2 val2 = polygon[(i + 1) % polygon.Count]; num += val.x * val2.y - val2.x * val.y; } return num * 0.5f; } private static List Triangulate(List polygon) { //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_008c: 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_00ca: 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_00da: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i < polygon.Count; i++) { list.Add(i); } List list2 = new List(); int num = polygon.Count * polygon.Count; while (list.Count > 3 && num-- > 0) { bool flag = false; for (int j = 0; j < list.Count; j++) { int num2 = list[(j + list.Count - 1) % list.Count]; int num3 = list[j]; int num4 = list[(j + 1) % list.Count]; if (!IsConvex(polygon[num2], polygon[num3], polygon[num4])) { continue; } bool flag2 = false; for (int k = 0; k < list.Count; k++) { int num5 = list[k]; if (num5 != num2 && num5 != num3 && num5 != num4 && PointInTriangle(polygon[num5], polygon[num2], polygon[num3], polygon[num4])) { flag2 = true; break; } } if (!flag2) { list2.Add(num2); list2.Add(num3); list2.Add(num4); list.RemoveAt(j); flag = true; break; } } if (!flag) { break; } } if (list.Count == 3) { list2.Add(list[0]); list2.Add(list[1]); list2.Add(list[2]); } else if (list2.Count == 0) { for (int l = 1; l < polygon.Count - 1; l++) { list2.Add(0); list2.Add(l); list2.Add(l + 1); } } return list2; } private static bool IsConvex(Vector2 a, Vector2 b, Vector2 c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return Cross(b - a, c - b) > 1E-06f; } private static bool PointInTriangle(Vector2 point, Vector2 a, Vector2 b, Vector2 c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_001c: 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_0028: 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_002f: 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) float num = Cross(b - a, point - a); float num2 = Cross(c - b, point - b); float num3 = Cross(a - c, point - c); bool flag = num < 0f || num2 < 0f || num3 < 0f; bool flag2 = num > 0f || num2 > 0f || num3 > 0f; return !(flag && flag2); } private static float Cross(Vector2 a, Vector2 b) { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return a.x * b.y - a.y * b.x; } } internal static class KnifeCatalog { public const byte VanillaKnifeId = 63; public const int VanillaKnifeCost = 45; public const byte FirstPurchaseId = 200; public const byte FirstVariantCode = 128; private static readonly Color Steel = new Color(0.62f, 0.68f, 0.72f); private static readonly Color DarkSteel = new Color(0.27f, 0.31f, 0.34f); private static readonly Color Black = new Color(0.055f, 0.065f, 0.075f); private static readonly Color Tan = new Color(0.34f, 0.25f, 0.16f); private static readonly Color Green = new Color(0.16f, 0.25f, 0.16f); private static readonly Color Blue = new Color(0.1f, 0.19f, 0.28f); private static readonly Color Red = new Color(0.38f, 0.08f, 0.07f); private static readonly Color ButterflyBlade = new Color(0.3f, 0.33f, 0.82f); private static readonly Color ButterflyTitanium = new Color(0.48f, 0.19f, 0.78f); private static readonly Color ButterflyCyan = new Color(0.34f, 0.8f, 0.96f); private static readonly List DefinitionsInternal = new List { new KnifeDefinition(63, byte.MaxValue, "M9 Bayonet (Original)", 45, KnifeShape.M9Bayonet, InspectStyle.M9BayonetSpin, DarkSteel, Black, Steel, 0.175f, 1.05f, dual: false, usesVanillaModel: true), new KnifeDefinition(206, 134, "Butterfly Knife", 45, KnifeShape.Butterfly, InspectStyle.ButterflyFlourish, ButterflyBlade, ButterflyTitanium, ButterflyCyan, 0.135f, 0.92f) }; private static readonly Dictionary ByPurchaseId = BuildPurchaseLookup(); private static readonly Dictionary ByVariantCode = BuildVariantLookup(); public static IList Definitions => DefinitionsInternal; public static bool TryGetByPurchaseId(byte id, out KnifeDefinition definition) { return ByPurchaseId.TryGetValue(id, out definition); } public static bool TryGetByVariantCode(byte code, out KnifeDefinition definition) { return ByVariantCode.TryGetValue(code, out definition); } public static bool TryGet(Item item, out KnifeDefinition definition) { definition = null; if (!Object.op_Implicit((Object)(object)item)) { return false; } if (!TryGetByVariantCode(item.CurSkin, out definition)) { return TryGetByPurchaseId(item.ID, out definition); } return true; } private static KnifeDefinition New(int index, string name, int price, KnifeShape shape, InspectStyle inspect, Color blade, Color grip, Color accent, float width, float length, bool dual = false) { //IL_0015: 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_0019: Unknown result type (might be due to invalid IL or missing references) return new KnifeDefinition((byte)(200 + index), (byte)(128 + index), name, price, shape, inspect, blade, grip, accent, width, length, dual); } private static Dictionary BuildPurchaseLookup() { Dictionary dictionary = new Dictionary(); foreach (KnifeDefinition item in DefinitionsInternal) { dictionary.Add(item.PurchaseId, item); } return dictionary; } private static Dictionary BuildVariantLookup() { Dictionary dictionary = new Dictionary(); foreach (KnifeDefinition item in DefinitionsInternal) { dictionary.Add(item.VariantCode, item); } return dictionary; } } internal enum KnifeShape { Bayonet, M9Bayonet, Flip, Gut, Karambit, Huntsman, Butterfly, Falchion, DualDaggers, Bowie, Navaja, Stiletto, Ursus, Talon, Classic, Paracord, Survival, Nomad, Skeleton } internal enum InspectStyle { BayonetPresentation, M9BayonetSpin, FlipKnifeSnap, GutKnifeRoll, KarambitTwirl, HuntsmanEdgeCheck, ButterflyFlourish, FalchionBalance, ShadowDaggersFlourish, BowiePresentation, NavajaFingerFlip, StilettoSnap, UrsusTurnover, TalonRingRoll, ClassicInspection, ParacordRoll, SurvivalReverseGrip, NomadThumbRoll, SkeletonRingRoll } internal enum PartMaterial { Blade, Edge, Grip, Accent, Dark } internal sealed class KnifeDefinition { public byte PurchaseId { get; private set; } public byte VariantCode { get; private set; } public string DisplayName { get; private set; } public int Price { get; private set; } public KnifeShape Shape { get; private set; } public InspectStyle InspectStyle { get; private set; } public Color BladeColor { get; private set; } public Color GripColor { get; private set; } public Color AccentColor { get; private set; } public float BladeWidth { get; private set; } public float LengthScale { get; private set; } public bool Dual { get; private set; } public bool UsesVanillaModel { get; private set; } public KnifeDefinition(byte purchaseId, byte variantCode, string displayName, int price, KnifeShape shape, InspectStyle inspectStyle, Color bladeColor, Color gripColor, Color accentColor, float bladeWidth, float lengthScale, bool dual = false, bool usesVanillaModel = false) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) PurchaseId = purchaseId; VariantCode = variantCode; DisplayName = displayName; Price = price; Shape = shape; InspectStyle = inspectStyle; BladeColor = bladeColor; GripColor = gripColor; AccentColor = accentColor; BladeWidth = bladeWidth; LengthScale = lengthScale; Dual = dual; UsesVanillaModel = usesVanillaModel; } } internal sealed class KnifeSelectionMenu : MonoBehaviour { private const float Margin = 20f; private const float Gap = 10f; private const int PreviewLayer = 30; private static KnifeSelectionMenu _instance; private static ItemPurchasable _purchaseSource; private static Player _purchasePlayer; private static KnifeDefinition _purchaseDefinition; private ItemPurchasable _source; private Player _player; private bool _previewOnly; private KnifeDefinition _selected; private Vector2 _scroll; private Texture2D[] _icons; private GameObject _previewRig; private Transform _previewStage; private GameObject _previewModel; private Camera _previewCamera; private Light _previewKeyLight; private Light _previewFillLight; private RenderTexture _selectedPreview; private float _nextPreviewRender; private GUIStyle _panelStyle; private GUIStyle _titleStyle; private GUIStyle _subtitleStyle; private GUIStyle _sectionStyle; private GUIStyle _cardStyle; private GUIStyle _cardHoverStyle; private GUIStyle _cardSelectedStyle; private GUIStyle _cardNameStyle; private GUIStyle _cardPriceStyle; private GUIStyle _previewNameStyle; private GUIStyle _previewPriceStyle; private GUIStyle _bodyStyle; private GUIStyle _buyStyle; private GUIStyle _closeStyle; private GUIStyle _footerStyle; private Texture2D _accentTexture; private Texture2D _dividerTexture; public static bool IsOpen { get { if (Object.op_Implicit((Object)(object)_instance)) { return Object.op_Implicit((Object)(object)_instance._source); } return false; } } private bool IsVisible { get { if (!Object.op_Implicit((Object)(object)_source)) { return _previewOnly; } return true; } } public static int EntryCount => KnifeCatalog.Definitions.Count; public static void Create() { //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_001d: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_instance)) { GameObject val = new GameObject("More Knives - Selection Menu"); Object.DontDestroyOnLoad((Object)val); _instance = val.AddComponent(); } } public static bool TryOpen(ItemPurchasable source, Player player) { //IL_004f: 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) if (!IsVanillaKnifeShop(source) || !Object.op_Implicit((Object)(object)player) || (Object)(object)player != (Object)(object)Player.LocalPlayer) { return false; } Create(); if (PauseManager.IsPaused || PlayerThinking.IsThinking) { return true; } _instance._source = source; _instance._player = player; _instance._scroll = Vector2.zero; if (_instance._selected == null && KnifeCatalog.Definitions.Count > 0) { _instance._selected = KnifeCatalog.Definitions[0]; } _instance.EnsurePreviewResources(); _instance.SetPreviewKnife(_instance._selected); PlayerCamera.ToggleMouse(true); MoreKnivesPlugin.Log.LogInfo((object)"Opened the redesigned knife selection menu."); return true; } public static bool TryGetPurchase(ItemPurchasable source, Player player, out KnifeDefinition definition) { definition = null; if (!Object.op_Implicit((Object)(object)_purchaseSource) || (Object)(object)_purchaseSource != (Object)(object)source || !Object.op_Implicit((Object)(object)_purchasePlayer) || (Object)(object)_purchasePlayer != (Object)(object)player || _purchaseDefinition == null) { return false; } definition = _purchaseDefinition; return true; } public static void Close() { if (Object.op_Implicit((Object)(object)_instance)) { _instance.CloseInternal(restoreMouse: true); } } public static void OpenPreviewForTest() { Create(); _instance._previewOnly = true; if (_instance._selected == null && KnifeCatalog.Definitions.Count > 0) { _instance._selected = KnifeCatalog.Definitions[0]; } _instance.EnsurePreviewResources(); _instance.SetPreviewKnife(_instance._selected); } private static bool IsVanillaKnifeShop(ItemPurchasable source) { if (!Object.op_Implicit((Object)(object)source)) { return false; } Item val = ReflectionUtil.Get(source, "_itemToPurchase"); if (Object.op_Implicit((Object)(object)val)) { return val.ID == 63; } return false; } private void Update() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!IsVisible) { return; } if (_previewOnly) { UpdatePreviewModel(); return; } if (!Object.op_Implicit((Object)(object)_player) || !Object.op_Implicit((Object)(object)Server.Instance) || PauseManager.IsPaused || PlayerThinking.IsThinking) { CloseInternal(!PauseManager.IsPaused); return; } if ((int)Cursor.lockState != 0 || !Cursor.visible) { PlayerCamera.ToggleMouse(true); } UpdatePreviewModel(); } private void OnGUI() { //IL_0019: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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_0316: 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_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Invalid comparison between Unknown and I4 //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Invalid comparison between Unknown and I4 if (!IsVisible) { return; } EnsureStyles(); GUI.depth = -10000; Color color = GUI.color; GUI.color = new Color(0.008f, 0.01f, 0.016f, 0.94f); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture); GUI.color = color; float num = Mathf.Min(1360f, (float)Screen.width - 40f); float num2 = Mathf.Min(820f, (float)Screen.height - 40f); Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2); GUI.Box(val, GUIContent.none, _panelStyle); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 4f), (Texture)(object)_accentTexture); GUI.DrawTexture(new Rect(((Rect)(ref val)).x + 28f, ((Rect)(ref val)).y + 88f, ((Rect)(ref val)).width - 56f, 1f), (Texture)(object)_dividerTexture); float num3 = ((Rect)(ref val)).x + 28f; float num4 = ((Rect)(ref val)).width - 56f; GUI.Label(new Rect(num3, ((Rect)(ref val)).y + 18f, num4 - 70f, 42f), "KNIFE COLLECTION", _titleStyle); GUI.Label(new Rect(num3, ((Rect)(ref val)).y + 57f, num4, 28f), "Choose a knife, check its model preview, then confirm the purchase", _subtitleStyle); if (GUI.Button(new Rect(((Rect)(ref val)).xMax - 70f, ((Rect)(ref val)).y + 20f, 40f, 38f), "X", _closeStyle)) { CloseInternal(restoreMouse: true); return; } float num5 = ((((Rect)(ref val)).width >= 1000f) ? 430f : 340f); float num6 = 24f; float num7 = num4 - num5 - num6; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num3, ((Rect)(ref val)).y + 100f, num7, ((Rect)(ref val)).height - 160f); Rect panel = default(Rect); ((Rect)(ref panel))..ctor(((Rect)(ref val2)).xMax + num6, ((Rect)(ref val2)).y, num5, ((Rect)(ref val2)).height); GUI.Label(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width - 150f, 28f), KnifeCatalog.Definitions.Count + " AVAILABLE KNIVES", _sectionStyle); GUI.Label(new Rect(((Rect)(ref val2)).xMax - 150f, ((Rect)(ref val2)).y + 2f, 150f, 24f), "ALL MODELS / $45", _footerStyle); DrawKnifeGrid(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y + 36f, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height - 36f)); DrawSelectedPreview(panel); GUI.Label(new Rect(num3, ((Rect)(ref val)).yMax - 43f, num4, 24f), "Click a card to preview | Buy only after confirming | Esc closes the menu", _footerStyle); Event current = Event.current; if (current != null && (int)current.type == 4 && (int)current.keyCode == 27) { current.Use(); CloseInternal(restoreMouse: true); } } private void DrawKnifeGrid(Rect area) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_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_0107: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_023b: 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) int num = ((((Rect)(ref area)).width >= 700f) ? 4 : ((((Rect)(ref area)).width >= 480f) ? 3 : 2)); float num2 = ((Rect)(ref area)).width - 18f; float num3 = (num2 - 10f * (float)(num - 1)) / (float)num; int num4 = Mathf.CeilToInt((float)KnifeCatalog.Definitions.Count / (float)num); float num5 = Mathf.Max(((Rect)(ref area)).height - 2f, (float)num4 * 148f + (float)(num4 - 1) * 10f); Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, num2, num5); _scroll = GUI.BeginScrollView(area, _scroll, val, false, num5 > ((Rect)(ref area)).height); Rect val2 = default(Rect); for (int i = 0; i < KnifeCatalog.Definitions.Count; i++) { KnifeDefinition knifeDefinition = KnifeCatalog.Definitions[i]; int num6 = i % num; int num7 = i / num; ((Rect)(ref val2))..ctor((float)num6 * (num3 + 10f), (float)num7 * 158f, num3, 148f); bool flag = _selected == knifeDefinition; bool flag2 = ((Rect)(ref val2)).Contains(Event.current.mousePosition); GUI.Box(val2, GUIContent.none, flag ? _cardSelectedStyle : (flag2 ? _cardHoverStyle : _cardStyle)); if (_icons != null && i < _icons.Length && Object.op_Implicit((Object)(object)_icons[i])) { GUI.DrawTexture(new Rect(((Rect)(ref val2)).x + 7f, ((Rect)(ref val2)).y + 6f, ((Rect)(ref val2)).width - 14f, 88f), (Texture)(object)_icons[i], (ScaleMode)2, true); } GUI.Label(new Rect(((Rect)(ref val2)).x + 7f, ((Rect)(ref val2)).y + 96f, ((Rect)(ref val2)).width - 14f, 25f), knifeDefinition.DisplayName, _cardNameStyle); GUI.Label(new Rect(((Rect)(ref val2)).x + 7f, ((Rect)(ref val2)).y + 121f, ((Rect)(ref val2)).width - 14f, 22f), "$" + knifeDefinition.Price, _cardPriceStyle); if (GUI.Button(val2, GUIContent.none, GUIStyle.none)) { _selected = knifeDefinition; SetPreviewKnife(knifeDefinition); } } GUI.EndScrollView(); } private void DrawSelectedPreview(Rect panel) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) GUI.Box(panel, GUIContent.none, _cardStyle); if (_selected != null) { GUI.Label(new Rect(((Rect)(ref panel)).x + 22f, ((Rect)(ref panel)).y + 18f, ((Rect)(ref panel)).width - 44f, 38f), _selected.DisplayName, _previewNameStyle); GUI.Label(new Rect(((Rect)(ref panel)).x + 22f, ((Rect)(ref panel)).y + 56f, ((Rect)(ref panel)).width - 44f, 30f), "$" + _selected.Price, _previewPriceStyle); GUI.Label(new Rect(((Rect)(ref panel)).x + 22f, ((Rect)(ref panel)).y + 83f, ((Rect)(ref panel)).width - 44f, 18f), "INSPECT PREVIEW", _footerStyle); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref panel)).x + 18f, ((Rect)(ref panel)).y + 106f, ((Rect)(ref panel)).width - 36f, Mathf.Min(292f, ((Rect)(ref panel)).height * 0.44f)); Color color = GUI.color; GUI.color = new Color(0.025f, 0.03f, 0.042f, 1f); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.color = color; if (Object.op_Implicit((Object)(object)_selectedPreview) && Object.op_Implicit((Object)(object)_previewModel)) { GUI.DrawTexture(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 18f, ((Rect)(ref val)).width - 28f, ((Rect)(ref val)).height - 36f), (Texture)(object)_selectedPreview, (ScaleMode)2, true); } else if (_selected.UsesVanillaModel) { GUI.Label(new Rect(((Rect)(ref val)).x + 28f, ((Rect)(ref val)).y + 90f, ((Rect)(ref val)).width - 56f, 90f), "ORIGINAL GAME MODEL\n\nUses the detailed M9 Bayonet already built into How to Fish.", _bodyStyle); } float num = ((Rect)(ref val)).yMax + 17f; GUI.Label(new Rect(((Rect)(ref panel)).x + 24f, num, ((Rect)(ref panel)).width - 48f, 65f), "Unique inspect: " + InspectLabel(_selected.InspectStyle) + (_selected.UsesVanillaModel ? "\nNative mesh • Native hands and inspect" : "\nOriginal authored mesh • Native hands + safe pivot motion"), _bodyStyle); if (GUI.Button(new Rect(((Rect)(ref panel)).x + 24f, ((Rect)(ref panel)).yMax - 92f, ((Rect)(ref panel)).width - 48f, 60f), "BUY FOR $" + _selected.Price, _buyStyle)) { Buy(_selected); } } } private void Buy(KnifeDefinition definition) { ItemPurchasable source = _source; Player player = _player; if (!Object.op_Implicit((Object)(object)source) || !Object.op_Implicit((Object)(object)player) || definition == null) { CloseInternal(restoreMouse: true); return; } _purchaseSource = source; _purchasePlayer = player; _purchaseDefinition = definition; CloseInternal(restoreMouse: false); try { ((Interactable)source).Interact(player); } finally { _purchaseSource = null; _purchasePlayer = null; _purchaseDefinition = null; PlayerCamera.ToggleMouse(false); } } private void CloseInternal(bool restoreMouse) { //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) bool num = Object.op_Implicit((Object)(object)_source); _source = null; _player = null; _previewOnly = false; _scroll = Vector2.zero; if (Object.op_Implicit((Object)(object)_previewRig)) { _previewRig.SetActive(false); } if (Object.op_Implicit((Object)(object)_previewCamera)) { ((Behaviour)_previewCamera).enabled = false; } if (num && restoreMouse) { PlayerCamera.ToggleMouse(false); } } private void UpdatePreviewModel() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_previewModel)) { float num = Mathf.Sin(Time.unscaledTime * 0.72f) * 18f; _previewModel.transform.localRotation = Quaternion.Euler(10f, num, -68f); if (Time.unscaledTime >= _nextPreviewRender) { RenderSelectedPreview(); _nextPreviewRender = Time.unscaledTime + 1f / 30f; } } } private void EnsurePreviewResources() { try { if (_icons == null || _icons.Length != KnifeCatalog.Definitions.Count) { BuildKnifeIcons(); } } catch (Exception ex) { MoreKnivesPlugin.Log.LogWarning((object)("Could not build knife UI previews: " + ex)); } } private void EnsurePreviewRig() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_013d: 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_0162: Expected O, but got Unknown //IL_018e: 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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_previewRig)) { _previewRig = new GameObject("More Knives - UI Preview Rig"); ((Object)_previewRig).hideFlags = (HideFlags)52; _previewRig.transform.SetParent(((Component)this).transform, false); _previewRig.transform.position = new Vector3(0f, -10000f, 0f); _previewRig.layer = 30; GameObject val = new GameObject("Stage"); val.transform.SetParent(_previewRig.transform, false); val.layer = 30; _previewStage = val.transform; GameObject val2 = new GameObject("Camera"); val2.transform.SetParent(_previewRig.transform, false); val2.layer = 30; _previewCamera = val2.AddComponent(); ((Behaviour)_previewCamera).enabled = false; _previewCamera.orthographic = true; _previewCamera.nearClipPlane = 0.05f; _previewCamera.farClipPlane = 20f; _previewCamera.clearFlags = (CameraClearFlags)2; _previewCamera.backgroundColor = new Color(0f, 0f, 0f, 0f); _previewCamera.cullingMask = 1073741824; GameObject val3 = new GameObject("Key Light"); val3.transform.SetParent(_previewRig.transform, false); val3.transform.localRotation = Quaternion.Euler(32f, -28f, 0f); val3.layer = 30; _previewKeyLight = val3.AddComponent(); _previewKeyLight.type = (LightType)1; _previewKeyLight.intensity = 1.45f; _previewKeyLight.color = new Color(1f, 0.88f, 0.72f); _previewKeyLight.cullingMask = 1073741824; GameObject val4 = new GameObject("Fill Light"); val4.transform.SetParent(_previewRig.transform, false); val4.transform.localRotation = Quaternion.Euler(-24f, 145f, 0f); val4.layer = 30; _previewFillLight = val4.AddComponent(); _previewFillLight.type = (LightType)1; _previewFillLight.intensity = 0.72f; _previewFillLight.color = new Color(0.42f, 0.62f, 1f); _previewFillLight.cullingMask = 1073741824; _selectedPreview = new RenderTexture(640, 400, 24, (RenderTextureFormat)0); ((Object)_selectedPreview).name = "More Knives Selected Preview"; ((Object)_selectedPreview).hideFlags = (HideFlags)52; _selectedPreview.Create(); _previewCamera.targetTexture = _selectedPreview; } } private void BuildKnifeIcons() { _icons = (Texture2D[])(object)new Texture2D[KnifeCatalog.Definitions.Count]; for (int i = 0; i < KnifeCatalog.Definitions.Count; i++) { if (!KnifeCatalog.Definitions[i].UsesVanillaModel) { _icons[i] = BuildIconTexture(KnifeCatalog.Definitions[i], 512, 256); } } } private Texture2D GetSelectedIcon() { if (_icons == null || _selected == null) { return null; } for (int i = 0; i < KnifeCatalog.Definitions.Count && i < _icons.Length; i++) { if (KnifeCatalog.Definitions[i] == _selected) { return _icons[i]; } } return null; } private void SetPreviewKnife(KnifeDefinition definition) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_previewRig) && definition != null) { if (Object.op_Implicit((Object)(object)_previewModel)) { _previewModel.SetActive(false); Object.Destroy((Object)(object)_previewModel); _previewModel = null; } if (!definition.UsesVanillaModel) { _previewModel = CreatePreviewModel(definition, "_Selected"); _previewModel.transform.localRotation = Quaternion.Euler(10f, 0f, -68f); FitPreviewCamera(_previewModel, (float)((Texture)_selectedPreview).width / (float)((Texture)_selectedPreview).height, 1.32f); RenderSelectedPreview(); } } } private GameObject CreatePreviewModel(KnifeDefinition definition, string suffix) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Preview - " + definition.DisplayName + suffix); ((Object)val).hideFlags = (HideFlags)52; val.transform.SetParent(_previewStage, false); val.layer = 30; KnifeAssets.CreateWorldModel(definition, val.transform, suffix + "A").transform.localPosition = (Vector3)(definition.Dual ? new Vector3(-0.13f, 0f, 0f) : Vector3.zero); if (definition.Dual) { GameObject obj = KnifeAssets.CreateWorldModel(definition, val.transform, suffix + "B"); obj.transform.localPosition = new Vector3(0.13f, 0f, 0f); obj.transform.localRotation = Quaternion.Euler(0f, 0f, 180f); } SetLayerRecursively(val, 30); return val; } private void FitPreviewCamera(GameObject model, float aspect, float padding) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren(true); if (componentsInChildren.Length != 0) { Bounds bounds = componentsInChildren[0].bounds; for (int i = 1; i < componentsInChildren.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[i].bounds); } float y = ((Bounds)(ref bounds)).extents.y; float num = ((Bounds)(ref bounds)).extents.x / Mathf.Max(0.1f, aspect); _previewCamera.orthographicSize = Mathf.Max(0.18f, Mathf.Max(y, num) * padding); ((Component)_previewCamera).transform.position = ((Bounds)(ref bounds)).center + new Vector3(0f, 0f, -4f); ((Component)_previewCamera).transform.rotation = Quaternion.identity; } } private void RenderSelectedPreview() { if (Object.op_Implicit((Object)(object)_previewCamera) && Object.op_Implicit((Object)(object)_selectedPreview) && Object.op_Implicit((Object)(object)_previewModel) && _previewRig.activeInHierarchy) { _previewCamera.targetTexture = _selectedPreview; ((Behaviour)_previewCamera).enabled = true; } } private static Texture2D BuildIconTexture(KnifeDefinition definition, int width, int height) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_00aa: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00cc: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0333: 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_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0396: 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_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: 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_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) if (definition.Shape == KnifeShape.Butterfly) { Texture2D val = EmbeddedKnifeMesh.LoadButterflyIcon(); if (Object.op_Implicit((Object)(object)val)) { return val; } } KnifeAssetSet knifeAssetSet = KnifeAssets.Get(definition); float num = Mathf.Cos((float)Math.PI * -2f / 5f); float num2 = Mathf.Sin((float)Math.PI * -2f / 5f); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(float.MaxValue, float.MaxValue); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(float.MinValue, float.MinValue); Vector2 val7 = default(Vector2); foreach (KnifePart part in knifeAssetSet.Parts) { Matrix4x4 val4 = Matrix4x4.TRS(part.Position, part.Rotation, part.Scale); Vector3[] vertices = part.Mesh.vertices; foreach (Vector3 val5 in vertices) { Vector3 val6 = ((Matrix4x4)(ref val4)).MultiplyPoint3x4(val5); ((Vector2)(ref val7))..ctor(val6.x * num - val6.y * num2, val6.x * num2 + val6.y * num); val2 = Vector2.Min(val2, val7); val3 = Vector2.Max(val3, val7); } } Vector2 val8 = val3 - val2; float scale = Mathf.Min(((float)width - 26f) / Mathf.Max(0.001f, val8.x), ((float)height - 20f) / Mathf.Max(0.001f, val8.y)); Vector2 center = (val2 + val3) * 0.5f; Color32[] array = (Color32[])(object)new Color32[width * height]; Color32 color = default(Color32); for (int j = 0; j < 2; j++) { foreach (KnifePart part2 in knifeAssetSet.Parts) { Color val9 = Color.Lerp((Color)(part2.Material switch { PartMaterial.Grip => definition.GripColor, PartMaterial.Accent => definition.AccentColor, PartMaterial.Dark => Color.Lerp(definition.GripColor, Color.black, 0.82f), _ => definition.BladeColor, }), Color.white, (part2.Material == PartMaterial.Blade) ? 0.2f : 0.08f); Vector2 val10 = (Vector2)((j == 0) ? new Vector2(3f, -3f) : Vector2.zero); Matrix4x4 transform = Matrix4x4.TRS(part2.Position, part2.Rotation, part2.Scale); Vector3[] vertices2 = part2.Mesh.vertices; int[] triangles = part2.Mesh.triangles; for (int k = 0; k + 2 < triangles.Length; k += 3) { if (j == 0) { ((Color32)(ref color))..ctor((byte)0, (byte)0, (byte)0, (byte)165); } else { Vector3 val11 = ((Matrix4x4)(ref transform)).MultiplyPoint3x4(vertices2[triangles[k]]); Vector3 val12 = ((Matrix4x4)(ref transform)).MultiplyPoint3x4(vertices2[triangles[k + 1]]); Vector3 val13 = ((Matrix4x4)(ref transform)).MultiplyPoint3x4(vertices2[triangles[k + 2]]); Vector3 val14 = Vector3.Cross(val12 - val11, val13 - val11); Vector3 normalized = ((Vector3)(ref val14)).normalized; val14 = new Vector3(-0.28f, 0.52f, 0.81f); Vector3 normalized2 = ((Vector3)(ref val14)).normalized; float num3 = Mathf.Clamp01(Vector3.Dot(normalized, normalized2)); float num4 = Mathf.Lerp(0.62f, 1.18f, num3); color = Color32.op_Implicit(val9 * num4); } Vector2 a = ProjectIconPoint(vertices2[triangles[k]], transform, num, num2, center, scale, width, height) + val10; Vector2 b = ProjectIconPoint(vertices2[triangles[k + 1]], transform, num, num2, center, scale, width, height) + val10; Vector2 c = ProjectIconPoint(vertices2[triangles[k + 2]], transform, num, num2, center, scale, width, height) + val10; FillTriangle(array, width, height, a, b, c, color, j == 0); } } } Texture2D val15 = new Texture2D(width, height, (TextureFormat)4, false) { name = "More Knives Icon - " + definition.DisplayName, filterMode = (FilterMode)1 }; val15.SetPixels32(array); val15.Apply(); return val15; } private static Vector2 ProjectIconPoint(Vector3 vertex, Matrix4x4 transform, float cos, float sin, Vector2 center, float scale, int width, int height) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_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_0068: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Matrix4x4)(ref transform)).MultiplyPoint3x4(vertex); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(val.x * cos - val.y * sin, val.x * sin + val.y * cos); return new Vector2((val2.x - center.x) * scale + (float)width * 0.5f, (val2.y - center.y) * scale + (float)height * 0.5f); } private static void FillTriangle(Color32[] pixels, int width, int height, Vector2 a, Vector2 b, Vector2 c, Color32 color, bool shadow) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_001f: 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_0046: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0180: 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) float num = Edge(a, b, c); if (Mathf.Abs(num) < 0.01f) { return; } int num2 = Mathf.Clamp(Mathf.FloorToInt(Mathf.Min(a.x, Mathf.Min(b.x, c.x))), 0, width - 1); int num3 = Mathf.Clamp(Mathf.CeilToInt(Mathf.Max(a.x, Mathf.Max(b.x, c.x))), 0, width - 1); int num4 = Mathf.Clamp(Mathf.FloorToInt(Mathf.Min(a.y, Mathf.Min(b.y, c.y))), 0, height - 1); int num5 = Mathf.Clamp(Mathf.CeilToInt(Mathf.Max(a.y, Mathf.Max(b.y, c.y))), 0, height - 1); bool flag = num > 0f; Vector2 point = default(Vector2); for (int i = num4; i <= num5; i++) { for (int j = num2; j <= num3; j++) { ((Vector2)(ref point))..ctor((float)j + 0.5f, (float)i + 0.5f); float num6 = Edge(a, b, point); float num7 = Edge(b, c, point); float num8 = Edge(c, a, point); if ((flag && num6 >= 0f && num7 >= 0f && num8 >= 0f) || (!flag && num6 <= 0f && num7 <= 0f && num8 <= 0f)) { int num9 = i * width + j; if (!shadow || pixels[num9].a == 0) { pixels[num9] = color; } } } } } private static float Edge(Vector2 a, Vector2 b, Vector2 point) { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) return (point.x - a.x) * (b.y - a.y) - (point.y - a.y) * (b.x - a.x); } private static string InspectLabel(InspectStyle style) { return style switch { InspectStyle.BayonetPresentation => "blade presentation", InspectStyle.M9BayonetSpin => "M9 palm spin", InspectStyle.FlipKnifeSnap => "snap flip", InspectStyle.GutKnifeRoll => "hooked-blade roll", InspectStyle.KarambitTwirl => "ring twirl", InspectStyle.HuntsmanEdgeCheck => "heavy edge check", InspectStyle.ButterflyFlourish => "multi-stage balisong flourish", InspectStyle.FalchionBalance => "palm balance", InspectStyle.ShadowDaggersFlourish => "mirrored dual flourish", InspectStyle.BowiePresentation => "Bowie presentation", InspectStyle.NavajaFingerFlip => "compact finger flip", InspectStyle.StilettoSnap => "axial snap spin", InspectStyle.UrsusTurnover => "underhand turnover", InspectStyle.TalonRingRoll => "reverse ring roll", InspectStyle.ClassicInspection => "classic side inspection", InspectStyle.ParacordRoll => "overhand roll", InspectStyle.SurvivalReverseGrip => "reverse-grip turnover", InspectStyle.NomadThumbRoll => "thumb roll", InspectStyle.SkeletonRingRoll => "skeleton ring roll", _ => "custom inspect", }; } private void EnsureStyles() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_003d: 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_0060: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_00a8: 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_00c7: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_017e: 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_01a1: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown //IL_02ce: 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_02ed: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected O, but got Unknown //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Expected O, but got Unknown //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Expected O, but got Unknown //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) if (_panelStyle == null) { _panelStyle = new GUIStyle(GUI.skin.box); _panelStyle.normal.background = MakeTexture(new Color(0.043f, 0.05f, 0.067f, 0.995f)); _panelStyle.border = new RectOffset(1, 1, 1, 1); _titleStyle = new GUIStyle(GUI.skin.label); _titleStyle.fontSize = 32; _titleStyle.fontStyle = (FontStyle)1; _titleStyle.normal.textColor = new Color(1f, 0.47f, 0.1f); _subtitleStyle = new GUIStyle(GUI.skin.label); _subtitleStyle.fontSize = 17; _subtitleStyle.normal.textColor = new Color(0.72f, 0.77f, 0.84f); _sectionStyle = new GUIStyle(GUI.skin.label); _sectionStyle.fontSize = 18; _sectionStyle.fontStyle = (FontStyle)1; _sectionStyle.normal.textColor = new Color(0.9f, 0.92f, 0.96f); _cardStyle = new GUIStyle(GUI.skin.box); _cardStyle.normal.background = MakeTexture(new Color(0.075f, 0.087f, 0.112f, 1f)); _cardStyle.border = new RectOffset(1, 1, 1, 1); _cardHoverStyle = new GUIStyle(_cardStyle); _cardHoverStyle.normal.background = MakeTexture(new Color(0.125f, 0.105f, 0.08f, 1f)); _cardHoverStyle.border = new RectOffset(2, 2, 2, 2); _cardSelectedStyle = new GUIStyle(_cardStyle); _cardSelectedStyle.normal.background = MakeTexture(new Color(0.29f, 0.125f, 0.035f, 1f)); _cardSelectedStyle.border = new RectOffset(2, 2, 2, 2); _cardNameStyle = new GUIStyle(GUI.skin.label); _cardNameStyle.fontSize = 14; _cardNameStyle.fontStyle = (FontStyle)1; _cardNameStyle.alignment = (TextAnchor)4; _cardNameStyle.normal.textColor = Color.white; _cardPriceStyle = new GUIStyle(_cardNameStyle); _cardPriceStyle.fontSize = 14; _cardPriceStyle.normal.textColor = new Color(1f, 0.55f, 0.16f); _previewNameStyle = new GUIStyle(GUI.skin.label); _previewNameStyle.fontSize = 26; _previewNameStyle.fontStyle = (FontStyle)1; _previewNameStyle.alignment = (TextAnchor)4; _previewNameStyle.normal.textColor = Color.white; _previewPriceStyle = new GUIStyle(_previewNameStyle); _previewPriceStyle.fontSize = 22; _previewPriceStyle.normal.textColor = new Color(1f, 0.52f, 0.12f); _bodyStyle = new GUIStyle(GUI.skin.label); _bodyStyle.fontSize = 16; _bodyStyle.wordWrap = true; _bodyStyle.alignment = (TextAnchor)1; _bodyStyle.normal.textColor = new Color(0.75f, 0.8f, 0.87f); _buyStyle = new GUIStyle(GUI.skin.button); _buyStyle.fontSize = 22; _buyStyle.fontStyle = (FontStyle)1; _buyStyle.normal.textColor = Color.white; _buyStyle.hover.textColor = Color.white; _buyStyle.active.textColor = Color.white; _buyStyle.normal.background = MakeTexture(new Color(0.8f, 0.3f, 0.055f, 1f)); _buyStyle.hover.background = MakeTexture(new Color(1f, 0.41f, 0.07f, 1f)); _buyStyle.active.background = MakeTexture(new Color(0.62f, 0.2f, 0.03f, 1f)); _closeStyle = new GUIStyle(_buyStyle); _closeStyle.fontSize = 18; _footerStyle = new GUIStyle(GUI.skin.label); _footerStyle.fontSize = 15; _footerStyle.alignment = (TextAnchor)4; _footerStyle.normal.textColor = new Color(0.6f, 0.65f, 0.72f); _accentTexture = MakeTexture(new Color(1f, 0.36f, 0.06f, 1f)); _dividerTexture = MakeTexture(new Color(0.16f, 0.19f, 0.25f, 1f)); } } private static Texture2D MakeTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false) { name = "MoreKnives UI Color" }; val.SetPixel(0, 0, color); val.Apply(); 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 sealed class KnifeVisualController : MonoBehaviour { private struct RigProfile { public Vector3 rootPosition; public Vector3 rootRotation; public Vector3 handPosition; public Vector3 handRotation; public float spin; public RigProfile(Vector3 rootPos, Vector3 rootRot, Vector3 handPos, Vector3 handRot, float turn) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) rootPosition = rootPos; rootRotation = rootRot; handPosition = handPos; handRotation = handRot; spin = turn; } } private const string CustomInspectClipName = "MoreKnivesInspect"; private KnifeDefinition _definition; private GameObject _rightModel; private GameObject _leftModel; private GameObject _leftAnchor; private Renderer[] _vanillaKnifeRenderers; private bool[] _vanillaRendererStates; private Animation _vanillaAnimation; private AnimationClip _customInspectClip; private Transform _animated; private Transform _rightIk; private Transform _leftIk; private Transform _rightThumbLow; private Transform _rightIndexLow; private Transform _rightIndexMid; private Transform _rightMiddleLow; private Transform _rightRingLow; private Transform _rightPinkyLow; private Coroutine _inspectRoutine; private bool _inspectPoseCaptured; private Vector3 _rightIkStartPosition; private Quaternion _rightIkStartRotation; private Vector3 _leftIkStartPosition; private Quaternion _leftIkStartRotation; private Quaternion _rightIndexStartRotation; private Transform _rightButterflyBlade; private Transform _rightButterflyHandleA; private Transform _rightButterflyHandleB; private Transform _leftButterflyBlade; private Transform _leftButterflyHandleA; private Transform _leftButterflyHandleB; private Quaternion _rightBladeRotation; private Quaternion _rightHandleARotation; private Quaternion _rightHandleBRotation; private Quaternion _leftBladeRotation; private Quaternion _leftHandleARotation; private Quaternion _leftHandleBRotation; private Vector3 _animatedStartPosition; private Vector3 _animatedStartEuler; private bool _usingRigClip; private bool _butterflyFingerAccentActive; private float _butterflyFingerAccentTime; private static readonly Quaternion FirstPersonMeshRotation = Quaternion.Euler(90f, 0f, 0f); private static readonly Quaternion ButterflyGripRotation = Quaternion.Euler(0f, 90f, 0f); private static readonly float[] ButterflyTrackTimes = new float[10] { 0f, 0.06f, 0.16f, 0.3f, 0.44f, 0.52f, 0.66f, 0.8f, 0.9f, 1f }; private static readonly float[] ButterflyBladeAngles = new float[10] { 0f, 0f, 4f, -6f, 0f, 0f, 8f, -5f, 0f, 0f }; private static readonly float[] ButterflySafeHandleAngles = new float[10] { 0f, 0f, 90f, 245f, 360f, 360f, 205f, -25f, 0f, 0f }; private static readonly float[] ButterflyBladeClearance = new float[10] { 0f, 0f, 3f, 6f, 2f, 0f, -4f, -2f, 0f, 0f }; private static readonly float[] ButterflyHandleClearance = new float[10] { 0f, 0f, 10f, 20f, 8f, 0f, -16f, -8f, 0f, 0f }; public KnifeDefinition Definition => _definition; public int VanillaRendererCount { get { if (_vanillaKnifeRenderers != null) { return _vanillaKnifeRenderers.Length; } return 0; } } public int VisibleVanillaRendererCount { get { int num = 0; if (_vanillaKnifeRenderers != null) { Renderer[] vanillaKnifeRenderers = _vanillaKnifeRenderers; foreach (Renderer val in vanillaKnifeRenderers) { if (Object.op_Implicit((Object)(object)val) && val.enabled) { num++; } } } return num; } } public bool ButterflyGroupsReady { get { if (_definition != null && _definition.Shape == KnifeShape.Butterfly && Object.op_Implicit((Object)(object)_rightButterflyBlade) && Object.op_Implicit((Object)(object)_rightButterflyHandleA)) { return Object.op_Implicit((Object)(object)_rightButterflyHandleB); } return false; } } public bool ValidateRigAnimation(out float rootMotion, out float handMotion) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0167: Unknown result type (might be due to invalid IL or missing references) rootMotion = 0f; handMotion = 0f; if (!Object.op_Implicit((Object)(object)_animated) || !Object.op_Implicit((Object)(object)_rightIk) || !Object.op_Implicit((Object)(object)_vanillaAnimation) || _definition == null) { return false; } CancelInspect(); PrepareCustomInspectPose(); _vanillaAnimation.Stop(); AnimationClip clip = _vanillaAnimation.GetClip("Inspect"); AnimationState val = _vanillaAnimation["Inspect"]; if (!Object.op_Implicit((Object)(object)clip) || clip.length < 3f) { ResetPoseAndResumeIdle(); return false; } bool flag = (TrackedReference)(object)val != (TrackedReference)null && _vanillaAnimation.Play("Inspect"); if ((TrackedReference)(object)val != (TrackedReference)null) { val.time = val.length * 0.5f; _vanillaAnimation.Sample(); } rootMotion = Vector3.Distance(_animated.localPosition, _animatedStartPosition) + Quaternion.Angle(Quaternion.Euler(_animatedStartEuler), _animated.localRotation) * 0.001f; handMotion = Vector3.Distance(_rightIk.localPosition, _rightIkStartPosition) + Quaternion.Angle(_rightIkStartRotation, _rightIk.localRotation) * 0.001f; float num = (Object.op_Implicit((Object)(object)_rightIndexLow) ? Quaternion.Angle(_rightIndexStartRotation, _rightIndexLow.localRotation) : 0f); bool num2 = rootMotion > 0.0001f && handMotion > 0.0001f && num > 0.01f; bool flag2 = true; if (!num2) { MoreKnivesPlugin.Log.LogInfo((object)("Native Inspect prefab sample diagnostic: started=" + flag + " root=" + rootMotion.ToString("F6") + " hand=" + handMotion.ToString("F6") + " finger=" + num.ToString("F3") + " active=" + ((Component)this).gameObject.activeInHierarchy)); } if (_definition.Shape == KnifeShape.Butterfly) { flag2 &= ValidateButterflyMechanics(out var diagnostic); MoreKnivesPlugin.Log.LogInfo((object)("Butterfly V4 mechanics validation: " + diagnostic + " nativeFingerTurn=" + num.ToString("F1"))); } ResetPoseAndResumeIdle(); return flag2; } private bool ValidateButterflyMechanics(out string diagnostic) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00a3: 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_00c1: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) if (!ButterflyGroupsReady || !Object.op_Implicit((Object)(object)_rightModel)) { diagnostic = "missing butterfly rig groups"; return false; } bool flag = (Object)(object)_rightButterflyHandleA.parent == (Object)(object)_rightButterflyBlade && (Object)(object)_rightButterflyHandleB.parent == (Object)(object)_rightModel.transform; Vector3 localPosition = _rightModel.transform.localPosition; Quaternion localRotation = _rightModel.transform.localRotation; float num = 0f; float num2 = 0f; bool flag2 = true; bool flag3 = true; for (int i = 0; i <= 60; i++) { ApplyInspectPose((float)i / 60f); num = Mathf.Max(num, Quaternion.Angle(_rightHandleARotation, _rightButterflyHandleA.localRotation)); num2 = Mathf.Max(num2, Quaternion.Angle(_rightBladeRotation, _rightButterflyBlade.localRotation)); flag2 &= IsFinite(_rightButterflyBlade.localPosition) && IsFinite(_rightButterflyHandleA.localPosition) && IsFinite(_rightButterflyHandleB.localPosition); flag3 &= Vector3.Distance(localPosition, _rightModel.transform.localPosition) < 1E-05f && Quaternion.Angle(localRotation, _rightModel.transform.localRotation) < 0.001f; } bool flag4 = Quaternion.Angle(_rightHandleBRotation, _rightButterflyHandleB.localRotation) < 0.01f; bool flag5 = num > 150f && num2 <= 12f; ResetGeneratedPose(); diagnostic = "chain=" + flag + " safeTurn=" + num.ToString("F1") + " bladeTurn=" + num2.ToString("F1") + " held=" + flag4 + " finite=" + flag2 + " stationaryRoot=" + flag3; return flag && flag5 && flag4 && flag2 && flag3; } private static bool IsFinite(Vector3 value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(value.x) && !float.IsNaN(value.y) && !float.IsNaN(value.z) && !float.IsInfinity(value.x) && !float.IsInfinity(value.y)) { return !float.IsInfinity(value.z); } return false; } public static KnifeVisualController Ensure(Item item, KnifeDefinition definition) { KnifeVisualController knifeVisualController = ((Component)item).GetComponent(); if (!Object.op_Implicit((Object)(object)knifeVisualController)) { knifeVisualController = ((Component)item).gameObject.AddComponent(); } knifeVisualController.Apply(definition); return knifeVisualController; } public static void ApplyOrClear(Item item) { if (!Object.op_Implicit((Object)(object)item)) { return; } if (KnifeCatalog.TryGetByVariantCode(item.CurSkin, out var definition)) { Ensure(item, definition); return; } KnifeVisualController component = ((Component)item).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.Clear(); } } public void Apply(KnifeDefinition definition) { //IL_013b: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) if (definition == null) { Clear(); return; } if (definition.UsesVanillaModel) { Clear(); return; } if (_definition != null && _definition.VariantCode == definition.VariantCode && Object.op_Implicit((Object)(object)_rightModel)) { EnforceVisualState(); return; } CancelInspect(); ClearGeneratedModels(); _definition = definition; Transform val = (_animated = FindDeepChild(((Component)this).transform, "KnifeAnimated")); _rightIk = (Object.op_Implicit((Object)(object)val) ? FindDeepChild(val, "r_IK") : null); _leftIk = (Object.op_Implicit((Object)(object)val) ? FindDeepChild(val, "l_IK") : null); Transform val2 = (Object.op_Implicit((Object)(object)_rightIk) ? FindDirectChild(_rightIk, "Knife") : null); if (!Object.op_Implicit((Object)(object)val2)) { MoreKnivesPlugin.Log.LogWarning((object)("Could not find the vanilla knife bone on " + ((Object)((Component)this).gameObject).name)); return; } _vanillaAnimation = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent() : null); CacheFingerBones(); CacheVanillaKnifeRenderers(val); EnforceVisualState(); _rightModel = KnifeAssets.CreateWorldModel(definition, val2, "_R"); _rightModel.transform.localPosition = Vector3.zero; _rightModel.transform.localRotation = GetFirstPersonMeshRotation(); _rightModel.transform.localScale = Vector3.one * (definition.Dual ? 7.8f : 9.43f); if (definition.Dual && Object.op_Implicit((Object)(object)_leftIk)) { _leftAnchor = new GameObject("MoreKnivesLeftAnchor"); ((Object)_leftAnchor).hideFlags = (HideFlags)52; _leftAnchor.transform.SetParent(_leftIk, false); Vector3 localPosition = val2.localPosition; localPosition.z = 0f - localPosition.z; _leftAnchor.transform.localPosition = localPosition; _leftAnchor.transform.localRotation = Quaternion.Inverse(val2.localRotation); _leftModel = KnifeAssets.CreateWorldModel(definition, _leftAnchor.transform, "_L"); _leftModel.transform.localPosition = Vector3.zero; _leftModel.transform.localRotation = GetFirstPersonMeshRotation(); _leftModel.transform.localScale = Vector3.one * 7.8f; } Melee component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { ReflectionUtil.Set(component, "_useBothHands", definition.Dual); } CacheAnimatedParts(); ResetGeneratedPose(); EnforceVisualState(); } public void EnforceVisualState() { if (_definition == null || _vanillaKnifeRenderers == null) { return; } Renderer[] vanillaKnifeRenderers = _vanillaKnifeRenderers; foreach (Renderer val in vanillaKnifeRenderers) { if (Object.op_Implicit((Object)(object)val) && val.enabled) { val.enabled = false; } } } private Quaternion GetFirstPersonMeshRotation() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (_definition == null || _definition.Shape != KnifeShape.Butterfly) { return FirstPersonMeshRotation; } return ButterflyGripRotation; } public void PlayInspect() { if (_definition != null && Object.op_Implicit((Object)(object)_rightModel) && ((Component)this).gameObject.activeInHierarchy) { CancelInspect(); PrepareCustomInspectPose(); if (Object.op_Implicit((Object)(object)_vanillaAnimation)) { _vanillaAnimation.Stop(); } _usingRigClip = Object.op_Implicit((Object)(object)_vanillaAnimation) && _vanillaAnimation.Play("Inspect"); _inspectRoutine = ((MonoBehaviour)this).StartCoroutine(InspectAnimation()); } } public void CancelInspect() { if (_inspectRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_inspectRoutine); _inspectRoutine = null; } ResetPoseAndResumeIdle(); } public void Clear() { CancelInspect(); ClearGeneratedModels(); RestoreVanillaRenderers(); Melee component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { ReflectionUtil.Set(component, "_useBothHands", false); } _definition = null; } private void LateUpdate() { EnforceVisualState(); if (_butterflyFingerAccentActive) { ApplyButterflyFingerAccents(_butterflyFingerAccentTime); } } private void CacheVanillaKnifeRenderers(Transform animated) { if (!Object.op_Implicit((Object)(object)animated) || _vanillaKnifeRenderers != null) { return; } List list = new List(); SkinnedMeshRenderer[] componentsInChildren = ((Component)animated).GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { string text = (Object.op_Implicit((Object)(object)val.sharedMesh) ? ((Object)val.sharedMesh).name : string.Empty); if (((Object)((Component)val).gameObject).name == "Knife" || text == "Knife" || text.StartsWith("Knife ")) { list.Add((Renderer)(object)val); } } } _vanillaKnifeRenderers = list.ToArray(); _vanillaRendererStates = new bool[_vanillaKnifeRenderers.Length]; for (int j = 0; j < _vanillaKnifeRenderers.Length; j++) { _vanillaRendererStates[j] = Object.op_Implicit((Object)(object)_vanillaKnifeRenderers[j]) && _vanillaKnifeRenderers[j].enabled; } MoreKnivesPlugin.Log.LogInfo((object)("Captured " + _vanillaKnifeRenderers.Length + " vanilla knife renderer(s) on " + ((Object)((Component)this).gameObject).name + ".")); } private void RestoreVanillaRenderers() { if (_vanillaKnifeRenderers == null || _vanillaRendererStates == null) { return; } for (int i = 0; i < _vanillaKnifeRenderers.Length; i++) { if (Object.op_Implicit((Object)(object)_vanillaKnifeRenderers[i])) { _vanillaKnifeRenderers[i].enabled = _vanillaRendererStates[i]; } } } private void PrepareCustomInspectPose() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_vanillaAnimation)) { _vanillaAnimation.Stop(); if (Object.op_Implicit((Object)(object)_vanillaAnimation.GetClip("Idle"))) { _vanillaAnimation.Play("Idle"); _vanillaAnimation.Sample(); _vanillaAnimation.Stop(); } } if (Object.op_Implicit((Object)(object)_rightIk)) { _rightIkStartPosition = _rightIk.localPosition; _rightIkStartRotation = _rightIk.localRotation; } if (Object.op_Implicit((Object)(object)_rightIndexLow)) { _rightIndexStartRotation = _rightIndexLow.localRotation; } if (Object.op_Implicit((Object)(object)_animated)) { _animatedStartPosition = _animated.localPosition; _animatedStartEuler = _animated.localEulerAngles; } if (Object.op_Implicit((Object)(object)_leftIk)) { _leftIkStartPosition = _leftIk.localPosition; _leftIkStartRotation = _leftIk.localRotation; } _inspectPoseCaptured = true; } private void BuildCustomInspectClip() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01b6: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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_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_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_030a: 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_0327: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04af: 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) if (!Object.op_Implicit((Object)(object)_animated) || _definition == null) { return; } if (Object.op_Implicit((Object)(object)_customInspectClip)) { if (Object.op_Implicit((Object)(object)_vanillaAnimation)) { _vanillaAnimation.RemoveClip("MoreKnivesInspect"); } Object.Destroy((Object)(object)_customInspectClip); } float duration = InspectDuration(_definition.InspectStyle); _customInspectClip = new AnimationClip(); ((Object)_customInspectClip).name = "MoreKnivesInspect_" + _definition.VariantCode; _customInspectClip.legacy = true; _customInspectClip.wrapMode = (WrapMode)1; ((Object)_customInspectClip).hideFlags = (HideFlags)52; RigProfile rigProfile = GetRigProfile(_definition.InspectStyle); float[] array = new float[7] { 0f, 0.1f, 0.24f, 0.5f, 0.74f, 0.9f, 1f }; float[] array2 = new float[array.Length]; float[] array3 = new float[array.Length]; float[] array4 = new float[array.Length]; float[] array5 = new float[array.Length]; float[] array6 = new float[array.Length]; float[] array7 = new float[array.Length]; float[] array8 = new float[array.Length]; float[] array9 = new float[array.Length]; float[] array10 = new float[array.Length]; float[] array11 = new float[array.Length]; float[] array12 = new float[array.Length]; float[] array13 = new float[array.Length]; for (int i = 0; i < array.Length; i++) { float num = array[i]; float num2 = Mathf.Sin((float)Math.PI * num); float num3 = Mathf.Sin((float)Math.PI * 2f * num); float num4 = rigProfile.spin * Smooth01(num); Vector3 val = rigProfile.rootPosition * num2; Vector3 val2 = rigProfile.rootRotation * num2; Vector3 val3 = rigProfile.handPosition * num2; Vector3 val4 = rigProfile.handRotation * num2; val4.z += num4; array2[i] = _animatedStartPosition.x + val.x; array3[i] = _animatedStartPosition.y + val.y + num3 * rigProfile.rootPosition.z; array4[i] = _animatedStartPosition.z + val.z; array5[i] = _animatedStartEuler.x + val2.x; array6[i] = _animatedStartEuler.y + val2.y; array7[i] = _animatedStartEuler.z + val2.z; if (Object.op_Implicit((Object)(object)_rightIk)) { array8[i] = _rightIkStartPosition.x + val3.x; array9[i] = _rightIkStartPosition.y + val3.y + num3 * rigProfile.handPosition.z; array10[i] = _rightIkStartPosition.z + val3.z; array11[i] = ((Quaternion)(ref _rightIkStartRotation)).eulerAngles.x + val4.x; array12[i] = ((Quaternion)(ref _rightIkStartRotation)).eulerAngles.y + val4.y; array13[i] = ((Quaternion)(ref _rightIkStartRotation)).eulerAngles.z + val4.z; } } AddCurves(_customInspectClip, "", duration, "localPosition.x", array2, array); AddCurves(_customInspectClip, "", duration, "localPosition.y", array3, array); AddCurves(_customInspectClip, "", duration, "localPosition.z", array4, array); AddCurves(_customInspectClip, "", duration, "localEulerAnglesRaw.x", array5, array); AddCurves(_customInspectClip, "", duration, "localEulerAnglesRaw.y", array6, array); AddCurves(_customInspectClip, "", duration, "localEulerAnglesRaw.z", array7, array); if (Object.op_Implicit((Object)(object)_rightIk)) { AddCurves(_customInspectClip, "Hands/r_IK", duration, "localPosition.x", array8, array); AddCurves(_customInspectClip, "Hands/r_IK", duration, "localPosition.y", array9, array); AddCurves(_customInspectClip, "Hands/r_IK", duration, "localPosition.z", array10, array); AddCurves(_customInspectClip, "Hands/r_IK", duration, "localEulerAnglesRaw.x", array11, array); AddCurves(_customInspectClip, "Hands/r_IK", duration, "localEulerAnglesRaw.y", array12, array); AddCurves(_customInspectClip, "Hands/r_IK", duration, "localEulerAnglesRaw.z", array13, array); } if (_definition.Dual && Object.op_Implicit((Object)(object)_leftIk)) { AddMirroredCurves(_customInspectClip, "Hands/l_IK", duration, array, _leftIkStartPosition, _leftIkStartRotation, rigProfile.handPosition, rigProfile.handRotation, rigProfile.spin); } } private static void AddCurves(AnimationClip clip, string path, float duration, string property, float[] values, float[] normalizedTimes) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) AnimationCurve val = new AnimationCurve(); Keyframe val2 = default(Keyframe); for (int i = 0; i < normalizedTimes.Length; i++) { ((Keyframe)(ref val2))..ctor(normalizedTimes[i] * duration, values[i]); ((Keyframe)(ref val2)).inTangent = 0f; ((Keyframe)(ref val2)).outTangent = 0f; val.AddKey(val2); } clip.SetCurve(path, typeof(Transform), property, val); } private static void AddMirroredCurves(AnimationClip clip, string path, float duration, float[] times, Vector3 startPosition, Quaternion startRotation, Vector3 positionAmplitude, Vector3 rotationAmplitude, float spin) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0084: 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_0098: 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_00ac: 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_00c2: 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_00d8: 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_00ee: Unknown result type (might be due to invalid IL or missing references) Vector3 eulerAngles = ((Quaternion)(ref startRotation)).eulerAngles; float[] array = new float[times.Length]; float[] array2 = new float[times.Length]; float[] array3 = new float[times.Length]; float[] array4 = new float[times.Length]; float[] array5 = new float[times.Length]; float[] array6 = new float[times.Length]; for (int i = 0; i < times.Length; i++) { float num = Mathf.Sin((float)Math.PI * times[i]); float num2 = Mathf.Sin((float)Math.PI * 2f * times[i]); array[i] = startPosition.x - positionAmplitude.x * num; array2[i] = startPosition.y + positionAmplitude.y * num + num2 * positionAmplitude.z; array3[i] = startPosition.z + positionAmplitude.z * num; array4[i] = eulerAngles.x - rotationAmplitude.x * num; array5[i] = eulerAngles.y - rotationAmplitude.y * num; array6[i] = eulerAngles.z - rotationAmplitude.z * num - spin * Smooth01(times[i]); } AddCurves(clip, path, duration, "localPosition.x", array, times); AddCurves(clip, path, duration, "localPosition.y", array2, times); AddCurves(clip, path, duration, "localPosition.z", array3, times); AddCurves(clip, path, duration, "localEulerAnglesRaw.x", array4, times); AddCurves(clip, path, duration, "localEulerAnglesRaw.y", array5, times); AddCurves(clip, path, duration, "localEulerAnglesRaw.z", array6, times); } private IEnumerator InspectAnimation() { float duration = GetInspectDuration(); float start = Time.unscaledTime; while (Time.unscaledTime - start < duration) { float time = Mathf.Clamp01((Time.unscaledTime - start) / duration); ApplyInspectPose(time); EnforceVisualState(); yield return null; } _inspectRoutine = null; ResetPoseAndResumeIdle(); } private void ApplyInspectPose(float time) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: 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_03a9: 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_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_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_0908: Unknown result type (might be due to invalid IL or missing references) //IL_0909: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_0930: Unknown result type (might be due to invalid IL or missing references) //IL_0931: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0981: Unknown result type (might be due to invalid IL or missing references) //IL_0986: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_0999: Unknown result type (might be due to invalid IL or missing references) //IL_099e: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_09a5: Unknown result type (might be due to invalid IL or missing references) //IL_09e3: Unknown result type (might be due to invalid IL or missing references) //IL_09e8: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) //IL_09f7: Unknown result type (might be due to invalid IL or missing references) //IL_09fe: Unknown result type (might be due to invalid IL or missing references) //IL_0a03: Unknown result type (might be due to invalid IL or missing references) //IL_0a14: Unknown result type (might be due to invalid IL or missing references) //IL_0a19: Unknown result type (might be due to invalid IL or missing references) //IL_0a21: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Unknown result type (might be due to invalid IL or missing references) //IL_0a31: Unknown result type (might be due to invalid IL or missing references) //IL_0a36: Unknown result type (might be due to invalid IL or missing references) float num = Smooth01(time); float num2 = Mathf.Sin((float)Math.PI * time); Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; Vector3 zero3 = Vector3.zero; Vector3 zero4 = default(Vector3); ((Vector3)(ref zero4))..ctor(0.01f * num2, 0.014f * num2, -0.018f * num2); Vector3 zero5 = default(Vector3); ((Vector3)(ref zero5))..ctor(-7f * num2, 10f * num2, -5f * num2); float bladeAngle = 0f; float angleA = 0f; float angleB = 0f; float bladeTilt = 0f; float handleTilt = 0f; switch (_definition.InspectStyle) { case InspectStyle.BayonetPresentation: ((Vector3)(ref zero2))..ctor(-28f * num2, 118f * num2, 16f * Mathf.Sin((float)Math.PI * 2f * time)); ((Vector3)(ref zero))..ctor(-0.012f * num2, 0.025f * num2, -0.025f * num2); ((Vector3)(ref zero5))..ctor(-12f * num2, 18f * num2, 8f * num2); break; case InspectStyle.M9BayonetSpin: ((Vector3)(ref zero2))..ctor(16f * num2, 360f * num, -34f * num2); ((Vector3)(ref zero))..ctor(0.018f * Mathf.Sin((float)Math.PI * 2f * time), 0.02f * num2, -0.012f * num2); ((Vector3)(ref zero5))..ctor(-8f * num2, 14f * num2, -18f * num2); break; case InspectStyle.FlipKnifeSnap: ((Vector3)(ref zero2))..ctor(360f * num, 68f * num2, 180f * Segment(time, 0.18f, 0.48f) - 180f * Segment(time, 0.52f, 0.82f)); ((Vector3)(ref zero))..ctor(0.023f * Mathf.Sin((float)Math.PI * 2f * time), 0.024f * num2, 0f); ((Vector3)(ref zero5))..ctor(12f * num2, -12f * num2, 15f * num2); break; case InspectStyle.GutKnifeRoll: ((Vector3)(ref zero2))..ctor(-115f * num2, 150f * num2, 360f * num); ((Vector3)(ref zero))..ctor(-0.022f * num2, 0.03f * num2, -0.014f * num2); ((Vector3)(ref zero5))..ctor(-18f * num2, 6f * num2, 20f * num2); break; case InspectStyle.KarambitTwirl: ((Vector3)(ref zero2))..ctor(4f * num2, 7f * num2, 12f * Mathf.Sin((float)Math.PI * 2f * time)); ((Vector3)(ref zero))..ctor(0.004f * Mathf.Sin((float)Math.PI * 2f * time), -0.002f * num2, 0.001f * num2); zero5 = Vector3.zero; break; case InspectStyle.HuntsmanEdgeCheck: ((Vector3)(ref zero2))..ctor(-52f * num2, 168f * num2, -28f * Mathf.Sin((float)Math.PI * 2f * time)); ((Vector3)(ref zero))..ctor(-0.028f * num2, 0.038f * num2, -0.032f * num2); ((Vector3)(ref zero5))..ctor(-20f * num2, 20f * num2, -8f * num2); break; case InspectStyle.ButterflyFlourish: bladeAngle = EvaluateTrack(time, ButterflyTrackTimes, ButterflyBladeAngles); angleA = EvaluateTrack(time, ButterflyTrackTimes, ButterflySafeHandleAngles); angleB = 0f; bladeTilt = EvaluateTrack(time, ButterflyTrackTimes, ButterflyBladeClearance); handleTilt = EvaluateTrack(time, ButterflyTrackTimes, ButterflyHandleClearance); zero2 = Vector3.zero; zero = Vector3.zero; zero4 = Vector3.zero; zero5 = Vector3.zero; break; case InspectStyle.FalchionBalance: ((Vector3)(ref zero2))..ctor(-78f * num2, 105f * num2, 52f * Mathf.Sin((float)Math.PI * 2f * time)); ((Vector3)(ref zero))..ctor(0.028f * num2, 0.042f * num2, 0f); ((Vector3)(ref zero5))..ctor(-22f * num2, -4f * num2, 16f * num2); break; case InspectStyle.ShadowDaggersFlourish: ((Vector3)(ref zero2))..ctor(42f * num2, 360f * num, 95f * num2); ((Vector3)(ref zero3))..ctor(-42f * num2, -360f * num, -95f * num2); ((Vector3)(ref zero))..ctor(0.026f * num2, 0.008f * Mathf.Sin((float)Math.PI * 2f * time), -0.012f * num2); ((Vector3)(ref zero5))..ctor(-8f * num2, 8f * num2, 18f * num2); break; case InspectStyle.BowiePresentation: ((Vector3)(ref zero2))..ctor(-38f * num2, 185f * num2, -18f * Mathf.Sin((float)Math.PI * 2f * time)); ((Vector3)(ref zero))..ctor(-0.035f * num2, 0.028f * num2, -0.045f * num2); ((Vector3)(ref zero5))..ctor(-24f * num2, 28f * num2, -6f * num2); break; case InspectStyle.NavajaFingerFlip: ((Vector3)(ref zero2))..ctor(540f * num, -45f * num2, 360f * num); ((Vector3)(ref zero))..ctor(0.018f * Mathf.Sin((float)Math.PI * 4f * time), 0.022f * num2, 0.004f * num2); ((Vector3)(ref zero5))..ctor(10f * num2, -14f * num2, 22f * num2); break; case InspectStyle.StilettoSnap: ((Vector3)(ref zero2))..ctor(18f * num2, 720f * Segment(time, 0.06f, 0.56f), -22f * num2); ((Vector3)(ref zero))..ctor(0f, 0.034f * num2, -0.01f * num2); ((Vector3)(ref zero5))..ctor(-6f * num2, 26f * num2, -14f * num2); break; case InspectStyle.UrsusTurnover: ((Vector3)(ref zero2))..ctor(180f * Segment(time, 0.12f, 0.38f) - 180f * Segment(time, 0.62f, 0.88f), 215f * num2, -45f * num2); ((Vector3)(ref zero))..ctor(-0.018f * num2, 0.032f * num2, -0.02f * num2); ((Vector3)(ref zero5))..ctor(-16f * num2, 18f * num2, -20f * num2); break; case InspectStyle.TalonRingRoll: ((Vector3)(ref zero2))..ctor(-16f * num2, 88f * num2, -720f * num); ((Vector3)(ref zero))..ctor(-0.032f * Mathf.Sin((float)Math.PI * 2f * time), -0.012f * num2, 0f); ((Vector3)(ref zero5))..ctor(5f * num2, 8f * num2, -30f * num2); break; case InspectStyle.ClassicInspection: ((Vector3)(ref zero2))..ctor(-36f * num2, 132f * Mathf.Sin((float)Math.PI * time), 22f * Mathf.Sin((float)Math.PI * 4f * time) * num2); ((Vector3)(ref zero))..ctor(0.02f * Mathf.Sin((float)Math.PI * 2f * time), 0.026f * num2, -0.024f * num2); ((Vector3)(ref zero5))..ctor(-10f * num2, 16f * num2, 7f * Mathf.Sin((float)Math.PI * 2f * time)); break; case InspectStyle.ParacordRoll: ((Vector3)(ref zero2))..ctor(360f * num, 95f * num2, -360f * num); ((Vector3)(ref zero))..ctor(0.024f * Mathf.Sin((float)Math.PI * 2f * time), 0.03f * num2, -0.012f * num2); ((Vector3)(ref zero5))..ctor(14f * num2, 10f * num2, -16f * num2); break; case InspectStyle.SurvivalReverseGrip: ((Vector3)(ref zero2))..ctor(180f * Segment(time, 0.08f, 0.34f) - 180f * Segment(time, 0.66f, 0.92f), -140f * num2, 360f * num); ((Vector3)(ref zero))..ctor(-0.026f * num2, 0.018f * num2, -0.022f * num2); ((Vector3)(ref zero5))..ctor(18f * num2, -20f * num2, 12f * num2); break; case InspectStyle.NomadThumbRoll: ((Vector3)(ref zero2))..ctor(-70f * num2, 360f * num, 140f * Mathf.Sin((float)Math.PI * 2f * time) * num2); ((Vector3)(ref zero))..ctor(0.03f * num2, 0.034f * num2, -0.03f * num2); ((Vector3)(ref zero5))..ctor(-18f * num2, 24f * num2, 18f * num2); break; case InspectStyle.SkeletonRingRoll: ((Vector3)(ref zero2))..ctor(360f * num, 72f * num2, 720f * num); ((Vector3)(ref zero))..ctor(0.03f * Mathf.Sin((float)Math.PI * 2f * time), 0.025f * num2, -0.016f * num2); ((Vector3)(ref zero5))..ctor(10f * num2, -8f * num2, 32f * num2); break; } if (Object.op_Implicit((Object)(object)_rightModel)) { _rightModel.transform.localPosition = zero; _rightModel.transform.localRotation = GetFirstPersonMeshRotation() * Quaternion.Euler(zero2); } if (Object.op_Implicit((Object)(object)_leftModel)) { _leftModel.transform.localPosition = -zero; _leftModel.transform.localRotation = GetFirstPersonMeshRotation() * Quaternion.Euler(zero3); } if (_inspectPoseCaptured && Object.op_Implicit((Object)(object)_rightIk) && !_usingRigClip) { _rightIk.localPosition = _rightIkStartPosition + zero4; _rightIk.localRotation = _rightIkStartRotation * Quaternion.Euler(zero5); } if (_inspectPoseCaptured && Object.op_Implicit((Object)(object)_leftIk) && _definition.Dual && !_usingRigClip) { _leftIk.localPosition = _leftIkStartPosition + new Vector3(0f - zero4.x, zero4.y, zero4.z); _leftIk.localRotation = _leftIkStartRotation * Quaternion.Euler(0f - zero5.x, 0f - zero5.y, 0f - zero5.z); } SetButterflyRotations(bladeAngle, angleA, angleB, bladeTilt, handleTilt); _butterflyFingerAccentActive = _definition != null && _definition.Shape == KnifeShape.Butterfly && _usingRigClip; _butterflyFingerAccentTime = time; } private static RigProfile GetRigProfile(InspectStyle style) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: 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_0309: 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_033c: 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_0364: 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_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: 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_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_063c: 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_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: 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_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) return style switch { InspectStyle.M9BayonetSpin => new RigProfile(new Vector3(0.01f, 0.02f, -0.01f), new Vector3(-10f, 30f, -8f), new Vector3(0.02f, 0.015f, -0.025f), new Vector3(-8f, 16f, -18f), 360f), InspectStyle.FlipKnifeSnap => new RigProfile(new Vector3(0.02f, 0.018f, 0f), new Vector3(10f, -18f, 12f), new Vector3(0.03f, 0.018f, -0.015f), new Vector3(15f, -10f, 18f), 360f), InspectStyle.GutKnifeRoll => new RigProfile(new Vector3(-0.02f, 0.022f, -0.014f), new Vector3(-18f, 20f, 12f), new Vector3(-0.025f, 0.02f, -0.02f), new Vector3(-18f, 8f, 20f), 280f), InspectStyle.KarambitTwirl => new RigProfile(new Vector3(0.025f, -0.012f, 0.006f), new Vector3(4f, -14f, 22f), new Vector3(0.03f, -0.018f, 0.008f), new Vector3(8f, -12f, 30f), 720f), InspectStyle.HuntsmanEdgeCheck => new RigProfile(new Vector3(-0.025f, 0.03f, -0.03f), new Vector3(-20f, 22f, -8f), new Vector3(-0.025f, 0.025f, -0.03f), new Vector3(-22f, 16f, -10f), 160f), InspectStyle.ButterflyFlourish => new RigProfile(new Vector3(0.02f, 0.03f, -0.035f), new Vector3(-18f, 32f, -12f), new Vector3(0.025f, 0.03f, -0.045f), new Vector3(-18f, 24f, -18f), 330f), InspectStyle.FalchionBalance => new RigProfile(new Vector3(0.025f, 0.035f, 0f), new Vector3(-24f, -8f, 16f), new Vector3(0.03f, 0.028f, -0.015f), new Vector3(-24f, -4f, 18f), 160f), InspectStyle.ShadowDaggersFlourish => new RigProfile(new Vector3(0.025f, 0.01f, -0.012f), new Vector3(-8f, 12f, 16f), new Vector3(0.028f, 0.015f, -0.018f), new Vector3(-12f, 12f, 20f), 360f), InspectStyle.BowiePresentation => new RigProfile(new Vector3(-0.032f, 0.025f, -0.04f), new Vector3(-25f, 30f, -8f), new Vector3(-0.035f, 0.03f, -0.05f), new Vector3(-26f, 28f, -8f), 180f), InspectStyle.NavajaFingerFlip => new RigProfile(new Vector3(0.018f, 0.02f, 0.004f), new Vector3(10f, -16f, 18f), new Vector3(0.02f, 0.02f, 0.005f), new Vector3(12f, -16f, 24f), 540f), InspectStyle.StilettoSnap => new RigProfile(new Vector3(0f, 0.03f, -0.01f), new Vector3(-6f, 26f, -14f), new Vector3(0.01f, 0.025f, -0.015f), new Vector3(-8f, 24f, -16f), 720f), InspectStyle.UrsusTurnover => new RigProfile(new Vector3(-0.018f, 0.028f, -0.02f), new Vector3(-16f, 20f, -20f), new Vector3(-0.02f, 0.028f, -0.025f), new Vector3(-18f, 20f, -22f), 360f), InspectStyle.TalonRingRoll => new RigProfile(new Vector3(-0.03f, -0.01f, 0f), new Vector3(5f, 10f, -28f), new Vector3(-0.035f, -0.012f, 0.004f), new Vector3(5f, 8f, -30f), -720f), InspectStyle.ClassicInspection => new RigProfile(new Vector3(0.018f, 0.024f, -0.022f), new Vector3(-12f, 16f, 8f), new Vector3(0.022f, 0.022f, -0.028f), new Vector3(-12f, 16f, 8f), 180f), InspectStyle.ParacordRoll => new RigProfile(new Vector3(0.022f, 0.028f, -0.012f), new Vector3(14f, 10f, -16f), new Vector3(0.025f, 0.025f, -0.018f), new Vector3(15f, 10f, -18f), 360f), InspectStyle.SurvivalReverseGrip => new RigProfile(new Vector3(-0.024f, 0.016f, -0.022f), new Vector3(18f, -22f, 12f), new Vector3(-0.03f, 0.018f, -0.025f), new Vector3(20f, -22f, 14f), 360f), InspectStyle.NomadThumbRoll => new RigProfile(new Vector3(0.028f, 0.03f, -0.028f), new Vector3(-18f, 24f, 18f), new Vector3(0.032f, 0.028f, -0.035f), new Vector3(-20f, 24f, 20f), 360f), InspectStyle.SkeletonRingRoll => new RigProfile(new Vector3(0.028f, 0.022f, -0.014f), new Vector3(10f, -8f, 30f), new Vector3(0.032f, 0.02f, -0.02f), new Vector3(12f, -8f, 34f), 720f), _ => new RigProfile(new Vector3(-0.01f, 0.022f, -0.022f), new Vector3(-12f, 18f, 8f), new Vector3(0.012f, 0.018f, -0.024f), new Vector3(-12f, 18f, 8f), 80f), }; } private void CacheAnimatedParts() { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) _rightButterflyBlade = (Object.op_Implicit((Object)(object)_rightModel) ? FindDeepChild(_rightModel.transform, "ButterflyBlade_R") : null); _rightButterflyHandleA = (Object.op_Implicit((Object)(object)_rightModel) ? FindDeepChild(_rightModel.transform, "ButterflyHandleSafe_R") : null); _rightButterflyHandleB = (Object.op_Implicit((Object)(object)_rightModel) ? FindDeepChild(_rightModel.transform, "ButterflyHandleBite_R") : null); _leftButterflyBlade = (Object.op_Implicit((Object)(object)_leftModel) ? FindDeepChild(_leftModel.transform, "ButterflyBlade_L") : null); _leftButterflyHandleA = (Object.op_Implicit((Object)(object)_leftModel) ? FindDeepChild(_leftModel.transform, "ButterflyHandleSafe_L") : null); _leftButterflyHandleB = (Object.op_Implicit((Object)(object)_leftModel) ? FindDeepChild(_leftModel.transform, "ButterflyHandleBite_L") : null); _rightBladeRotation = (Object.op_Implicit((Object)(object)_rightButterflyBlade) ? _rightButterflyBlade.localRotation : Quaternion.identity); _rightHandleARotation = (Object.op_Implicit((Object)(object)_rightButterflyHandleA) ? _rightButterflyHandleA.localRotation : Quaternion.identity); _rightHandleBRotation = (Object.op_Implicit((Object)(object)_rightButterflyHandleB) ? _rightButterflyHandleB.localRotation : Quaternion.identity); _leftBladeRotation = (Object.op_Implicit((Object)(object)_leftButterflyBlade) ? _leftButterflyBlade.localRotation : Quaternion.identity); _leftHandleARotation = (Object.op_Implicit((Object)(object)_leftButterflyHandleA) ? _leftButterflyHandleA.localRotation : Quaternion.identity); _leftHandleBRotation = (Object.op_Implicit((Object)(object)_leftButterflyHandleB) ? _leftButterflyHandleB.localRotation : Quaternion.identity); } private void CacheFingerBones() { _rightThumbLow = (Object.op_Implicit((Object)(object)_rightIk) ? FindDeepChild(_rightIk, "r_thumb_low") : null); _rightIndexLow = (Object.op_Implicit((Object)(object)_rightIk) ? FindDeepChild(_rightIk, "r_index_low") : null); _rightIndexMid = (Object.op_Implicit((Object)(object)_rightIk) ? FindDeepChild(_rightIk, "r_index_mid") : null); _rightMiddleLow = (Object.op_Implicit((Object)(object)_rightIk) ? FindDeepChild(_rightIk, "r_middle_low") : null); _rightRingLow = (Object.op_Implicit((Object)(object)_rightIk) ? FindDeepChild(_rightIk, "r_ring_low") : null); _rightPinkyLow = (Object.op_Implicit((Object)(object)_rightIk) ? FindDeepChild(_rightIk, "r_pinky_low") : null); } private void ApplyButterflyFingerAccents(float time) { //IL_007e: 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_00c4: 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_0108: 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) float num = Segment(time, 0.12f, 0.22f) * (1f - Segment(time, 0.36f, 0.48f)); float num2 = Segment(time, 0.64f, 0.73f) * (1f - Segment(time, 0.82f, 0.92f)); float num3 = Mathf.Max(num, num2 * 0.76f); if (!(num3 <= 0.0001f)) { ApplyFingerAccent(_rightThumbLow, new Vector3(0f, -8f * num3, 4f * num3)); ApplyFingerAccent(_rightIndexLow, new Vector3(4f * num3, 0f, -10f * num3)); ApplyFingerAccent(_rightIndexMid, new Vector3(2f * num3, 0f, -7f * num3)); ApplyFingerAccent(_rightMiddleLow, new Vector3(2f * num3, 0f, -4f * num3)); ApplyFingerAccent(_rightRingLow, new Vector3(0f, 0f, -1.5f * num3)); ApplyFingerAccent(_rightPinkyLow, new Vector3(0f, 0f, -1f * num3)); } } private static void ApplyFingerAccent(Transform bone, Vector3 euler) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)bone)) { bone.localRotation *= Quaternion.Euler(euler); } } private void SetButterflyRotations(float bladeAngle, float angleA, float angleB, float bladeTilt = 0f, float handleTilt = 0f) { //IL_0014: 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_0044: 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_0074: 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_0089: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_rightButterflyBlade)) { _rightButterflyBlade.localRotation = _rightBladeRotation * Quaternion.Euler(bladeTilt, 0f, bladeAngle); } if (Object.op_Implicit((Object)(object)_rightButterflyHandleA)) { _rightButterflyHandleA.localRotation = _rightHandleARotation * Quaternion.Euler(handleTilt, 0f, angleA); } if (Object.op_Implicit((Object)(object)_rightButterflyHandleB)) { _rightButterflyHandleB.localRotation = _rightHandleBRotation * Quaternion.Euler(0f, 0f, angleB); } if (Object.op_Implicit((Object)(object)_leftButterflyBlade)) { _leftButterflyBlade.localRotation = _leftBladeRotation * Quaternion.Euler(0f - bladeTilt, 0f, 0f - bladeAngle); } if (Object.op_Implicit((Object)(object)_leftButterflyHandleA)) { _leftButterflyHandleA.localRotation = _leftHandleARotation * Quaternion.Euler(0f - handleTilt, 0f, 0f - angleA); } if (Object.op_Implicit((Object)(object)_leftButterflyHandleB)) { _leftButterflyHandleB.localRotation = _leftHandleBRotation * Quaternion.Euler(0f, 0f, 0f - angleB); } } private void ResetGeneratedPose() { //IL_002a: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) _butterflyFingerAccentActive = false; _butterflyFingerAccentTime = 0f; if (Object.op_Implicit((Object)(object)_rightModel)) { _rightModel.transform.localPosition = Vector3.zero; _rightModel.transform.localRotation = GetFirstPersonMeshRotation(); } if (Object.op_Implicit((Object)(object)_leftModel)) { _leftModel.transform.localPosition = Vector3.zero; _leftModel.transform.localRotation = GetFirstPersonMeshRotation(); } SetButterflyRotations(0f, 0f, 0f); } private void ResetPoseAndResumeIdle() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (Object.op_Implicit((Object)(object)_vanillaAnimation)) { _vanillaAnimation.Stop(); } _usingRigClip = false; ResetGeneratedPose(); if (_inspectPoseCaptured) { if (Object.op_Implicit((Object)(object)_rightIk)) { _rightIk.localPosition = _rightIkStartPosition; _rightIk.localRotation = _rightIkStartRotation; } if (Object.op_Implicit((Object)(object)_leftIk)) { _leftIk.localPosition = _leftIkStartPosition; _leftIk.localRotation = _leftIkStartRotation; } _inspectPoseCaptured = false; } if (Object.op_Implicit((Object)(object)_vanillaAnimation) && ((Component)this).gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)_vanillaAnimation.GetClip("Idle"))) { _vanillaAnimation.Stop(); _vanillaAnimation.Play("Idle"); } EnforceVisualState(); } private void ClearGeneratedModels() { if (Object.op_Implicit((Object)(object)_customInspectClip)) { if (Object.op_Implicit((Object)(object)_vanillaAnimation)) { _vanillaAnimation.RemoveClip("MoreKnivesInspect"); } Object.Destroy((Object)(object)_customInspectClip); _customInspectClip = null; } DisableAndDestroy(_rightModel); DisableAndDestroy(_leftModel); DisableAndDestroy(_leftAnchor); _rightModel = null; _leftModel = null; _leftAnchor = null; _rightButterflyBlade = null; _rightButterflyHandleA = null; _rightButterflyHandleB = null; _leftButterflyBlade = null; _leftButterflyHandleA = null; _leftButterflyHandleB = null; } private static void DisableAndDestroy(GameObject target) { if (Object.op_Implicit((Object)(object)target)) { target.SetActive(false); Object.Destroy((Object)(object)target); } } private void OnDisable() { CancelInspect(); } private float GetInspectDuration() { if (Object.op_Implicit((Object)(object)_vanillaAnimation)) { AnimationState val = _vanillaAnimation["Inspect"]; if ((TrackedReference)(object)val != (TrackedReference)null && val.length > 0.01f) { return val.length; } } return InspectDuration((_definition == null) ? InspectStyle.ClassicInspection : _definition.InspectStyle); } private static float InspectDuration(InspectStyle style) { switch (style) { case InspectStyle.ButterflyFlourish: return 4.45f; case InspectStyle.ShadowDaggersFlourish: return 3.95f; case InspectStyle.HuntsmanEdgeCheck: case InspectStyle.BowiePresentation: return 3.85f; case InspectStyle.NavajaFingerFlip: case InspectStyle.StilettoSnap: return 3.1f; default: return 3.55f; } } private static float Segment(float time, float start, float end) { if (end <= start) { if (!(time >= end)) { return 0f; } return 1f; } return Smooth01((time - start) / (end - start)); } private static float EvaluateTrack(float time, float[] times, float[] values) { if (times == null || values == null || times.Length == 0 || times.Length != values.Length) { return 0f; } if (time <= times[0]) { return values[0]; } for (int i = 1; i < times.Length; i++) { if (time <= times[i]) { float num = Segment(time, times[i - 1], times[i]); return Mathf.LerpUnclamped(values[i - 1], values[i], num); } } return values[^1]; } private static float Smooth01(float value) { value = Mathf.Clamp01(value); return value * value * (3f - 2f * value); } private static Transform FindDirectChild(Transform parent, string name) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == name) { return val; } } return null; } private static Transform FindDeepChild(Transform parent, string name) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)parent)) { return null; } foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == name) { return val; } Transform val2 = FindDeepChild(val, name); if (Object.op_Implicit((Object)(object)val2)) { return val2; } } return null; } } [BepInPlugin("local.howtofish.moreknives", "How to Fish - More Knives", "0.1.10")] public sealed class MoreKnivesPlugin : BaseUnityPlugin { public const string PluginGuid = "local.howtofish.moreknives"; public const string PluginName = "How to Fish - More Knives"; public const string PluginVersion = "0.1.10"; internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; try { KnifeAssets.WarmUp(); KnifeSelectionMenu.Create(); _harmony = new Harmony("local.howtofish.moreknives"); _harmony.PatchAll(typeof(MoreKnivesPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded " + KnifeCatalog.Definitions.Count + " knife entries (" + KnifeCatalog.Definitions.Count((KnifeDefinition definition) => !definition.UsesVanillaModel) + " custom, original M9 preserved); every knife costs $" + 45 + ".")); if (Environment.GetCommandLineArgs().Any((string argument) => argument == "-moreknives-selftest")) { ((MonoBehaviour)this).StartCoroutine(RunSelfTest()); } else if (Environment.GetCommandLineArgs().Any((string argument) => argument == "-moreknives-uiscreenshot")) { ((MonoBehaviour)this).StartCoroutine(RunUiScreenshotTest()); } else if (Environment.GetCommandLineArgs().Any((string argument) => argument == "-moreknives-liveinspecttest")) { ((MonoBehaviour)this).StartCoroutine(RunLiveInspectTest()); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("More Knives failed to initialize: " + ex)); } } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } KnifeSelectionMenu.Close(); } private IEnumerator RunSelfTest() { yield return (object)new WaitForSecondsRealtime(3f); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("How to Fish - More Knives self-test"); stringBuilder.AppendLine("UTC: " + DateTime.UtcNow.ToString("O")); stringBuilder.AppendLine("Game: " + Application.version); stringBuilder.AppendLine("Unity: " + Application.unityVersion); stringBuilder.AppendLine("Plugin: 0.1.10"); bool flag = true; Item val = ((IEnumerable)Resources.LoadAll("Items")).FirstOrDefault((Func)((Item item) => Object.op_Implicit((Object)(object)item) && item.ID == 63)); stringBuilder.AppendLine("Vanilla knife found: " + (Object.op_Implicit((Object)(object)val) ? "yes" : "no")); flag &= Object.op_Implicit((Object)(object)val); if (Object.op_Implicit((Object)(object)val)) { stringBuilder.AppendLine("Vanilla knife cost: $" + val.Cost); flag &= val.Cost == 45; } stringBuilder.AppendLine("Definitions: " + KnifeCatalog.Definitions.Count); int count = KnifeCatalog.Definitions.Count; flag = flag && count == 2; int num = KnifeCatalog.Definitions.Count((KnifeDefinition definition) => !definition.UsesVanillaModel); stringBuilder.AppendLine("Custom knife definitions: " + num + "/1"); flag = flag && num == 1; stringBuilder.AppendLine("Selection menu entries: " + KnifeSelectionMenu.EntryCount); flag &= KnifeSelectionMenu.EntryCount == count; int num2 = KnifeCatalog.Definitions.Select((KnifeDefinition definition) => definition.InspectStyle).Distinct().Count(); stringBuilder.AppendLine("Unique inspect profiles: " + num2 + "/2"); flag = flag && num2 == count; foreach (KnifeDefinition definition in KnifeCatalog.Definitions) { if (definition.UsesVanillaModel) { stringBuilder.AppendLine(definition.DisplayName + ": native game asset PASS"); continue; } KnifeAssetSet knifeAssetSet = KnifeAssets.Get(definition); int num3 = (Object.op_Implicit((Object)(object)knifeAssetSet.InventoryMesh) ? knifeAssetSet.InventoryMesh.vertexCount : 0); bool flag2 = definition.Price == 45 && num3 > 0; flag = flag && flag2; stringBuilder.AppendLine(string.Format("{0}: purchase={1} skin={2} price=${3} vertices={4} {5}", definition.DisplayName, definition.PurchaseId, definition.VariantCode, definition.Price, num3, flag2 ? "PASS" : "FAIL")); } if (Object.op_Implicit((Object)(object)val)) { Item val2 = null; try { val2 = Object.Instantiate(val); int num4 = 0; int num5 = 0; int num6 = 0; bool flag3 = false; int num7 = ((Component)val2).GetComponentsInChildren(true).Count((SkinnedMeshRenderer renderer) => Object.op_Implicit((Object)(object)renderer) && ((Renderer)renderer).enabled && (((Object)((Component)renderer).gameObject).name == "Knife" || (Object.op_Implicit((Object)(object)renderer.sharedMesh) && ((Object)renderer.sharedMesh).name.StartsWith("Knife")))); stringBuilder.AppendLine("Original M9 renderer visible before custom selection: " + num7); flag = flag && num7 > 0; foreach (KnifeDefinition definition2 in KnifeCatalog.Definitions) { if (definition2.UsesVanillaModel) { continue; } KnifeAssetSet knifeAssetSet2 = KnifeAssets.Get(definition2); KnifeVisualController knifeVisualController = KnifeVisualController.Ensure(val2, definition2); knifeVisualController.EnforceVisualState(); bool flag4 = knifeVisualController.Definition == definition2 && ((Component)val2).GetComponentsInChildren(true).Any((MeshFilter filter) => Object.op_Implicit((Object)(object)filter) && Object.op_Implicit((Object)(object)filter.sharedMesh) && (((Object)filter.sharedMesh).name.StartsWith("MoreKnives") || ((Object)filter.sharedMesh).name.StartsWith("Butterfly V4"))); if (flag4) { num4++; } flag = flag && flag4; bool flag5 = knifeVisualController.VanillaRendererCount > 0 && knifeVisualController.VisibleVanillaRendererCount == 0; if (flag5) { num5++; } flag = flag && flag5; float rootMotion; float handMotion; bool flag6 = knifeVisualController.ValidateRigAnimation(out rootMotion, out handMotion); if (flag6) { num6++; } flag = flag && flag6; if (!flag6 && definition2 == KnifeCatalog.Definitions[0]) { stringBuilder.AppendLine("Rig sample diagnostic: root=" + rootMotion.ToString("F6") + " hand=" + handMotion.ToString("F6")); } if (definition2.Shape == KnifeShape.Butterfly) { flag3 = knifeVisualController.ButterflyGroupsReady; flag = flag && flag3; int num8 = knifeAssetSet2.Parts.Sum((KnifePart part) => Object.op_Implicit((Object)(object)part.Mesh) ? part.Mesh.vertexCount : 0); bool flag7 = num8 >= 60000; flag = flag && flag7; stringBuilder.AppendLine("Butterfly V4 rendered vertices: " + num8 + (flag7 ? " PASS" : " FAIL")); } } stringBuilder.AppendLine("World models attached to vanilla knife hierarchy: " + num4 + "/1"); flag = flag && num4 == 1; stringBuilder.AppendLine("Vanilla held renderer suppressed for custom knives: " + num5 + "/1"); flag = flag && num5 == 1; stringBuilder.AppendLine("Rig-driven hand inspect curves: " + num6 + "/1"); flag = flag && num6 == 1; stringBuilder.AppendLine("Butterfly blade/handle pivot groups: " + (flag3 ? "PASS" : "FAIL")); } catch (Exception ex) { flag = false; stringBuilder.AppendLine("World model test exception: " + ex); } finally { if (Object.op_Implicit((Object)(object)val2)) { Collider val3 = ReflectionUtil.Get(val2, "_pickUpCollider"); Collider[] array = ReflectionUtil.Get(val2, "_worldColliders"); ItemManager.Remove(val2, val3, array); Object.Destroy((Object)(object)((Component)val2).gameObject); } } } stringBuilder.AppendLine("RESULT: " + (flag ? "PASS" : "FAIL")); string text = Path.Combine(Paths.BepInExRootPath, "more-knives-selftest.txt"); File.WriteAllText(text, stringBuilder.ToString()); ((BaseUnityPlugin)this).Logger.LogInfo((object)("More Knives self-test " + (flag ? "passed" : "failed") + ": " + text)); Application.Quit((!flag) ? 1 : 0); } private IEnumerator RunUiScreenshotTest() { yield return (object)new WaitForSecondsRealtime(3f); KnifeSelectionMenu.OpenPreviewForTest(); yield return (object)new WaitForSecondsRealtime(2f); string text = Path.Combine(Paths.BepInExRootPath, "more-knives-ui.png"); ScreenCapture.CaptureScreenshot(text, 1); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Captured More Knives UI preview: " + text)); yield return (object)new WaitForSecondsRealtime(2f); KnifeSelectionMenu.Close(); Application.Quit(0); } private IEnumerator RunLiveInspectTest() { yield return (object)new WaitForSecondsRealtime(5f); Button[] array = Resources.FindObjectsOfTypeAll