Decompiled source of Bonk Together v0.3.3
BepInEx/plugins/BonkTogether/BonkTogether.dll
Decompiled 19 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BonkTogether.Core; using Cinemachine; using PurrNet; using Steamworks; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Bonk Together")] [assembly: AssemblyFileVersion("0.3.3.0")] [assembly: AssemblyInformationalVersion("0.3.3-alpha.1")] [assembly: InternalsVisibleTo("BonkTogether.RuntimeProbe")] [assembly: AssemblyVersion("0.3.3.0")] namespace BonkTogether { [Serializable] internal sealed class BatData { public int version; public float[] vertices; public int[] triangles; } [Serializable] internal sealed class SwingData { public int version; public int count; public string[] names; public int[] parents; public float[] rest; public float[] samples; } internal sealed class Assets : IDisposable { public readonly ulong Fingerprint; public readonly Mesh Mesh; public readonly float[][] Muscles; public readonly AudioClip[] Whooshes; public readonly AudioClip[] Impacts; public readonly float[] WhooshPeaks; public readonly AudioClip PlayerImpact; public readonly int Samples; private static string Read(string name) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BonkTogether." + name); if (stream == null) { throw new InvalidDataException("Missing embedded asset " + name); } using StreamReader streamReader = new StreamReader(stream); return streamReader.ReadToEnd(); } public Assets() { //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0182: Expected O, but got Unknown //IL_01ef: 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_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: 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_0266: Unknown result type (might be due to invalid IL or missing references) string text = Read("bat.json"); string text2 = Read("swing.json"); byte[] array; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BonkTogether.sounds.bin")) { using MemoryStream memoryStream = new MemoryStream(); if (stream == null) { throw new InvalidDataException("Missing embedded sound bank"); } stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } using (MemoryStream memoryStream2 = new MemoryStream()) { using SHA256 sHA = SHA256.Create(); byte[] bytes = Encoding.UTF8.GetBytes(text + text2 + "visual-v7-perf-0.3.3"); memoryStream2.Write(bytes, 0, bytes.Length); memoryStream2.Write(array, 0, array.Length); Fingerprint = BitConverter.ToUInt64(sHA.ComputeHash(memoryStream2.ToArray()), 0); } BatData batData = JsonUtility.FromJson<BatData>(text); if (batData.version != 1 || batData.vertices.Length % 3 != 0 || batData.triangles.Length % 3 != 0) { throw new InvalidDataException("Unsupported bat geometry"); } Vector3[] array2 = (Vector3[])(object)new Vector3[batData.vertices.Length / 3]; for (int i = 0; i < array2.Length; i++) { array2[i] = new Vector3(batData.vertices[i * 3], batData.vertices[i * 3 + 1], batData.vertices[i * 3 + 2]); } Mesh = new Mesh { name = "Biedny baseball bat" }; Mesh.vertices = array2; Mesh.triangles = batData.triangles; Mesh.RecalculateNormals(); Mesh.RecalculateBounds(); Vector3[] normals = Mesh.normals; Dictionary<Vector3, Vector3> dictionary = new Dictionary<Vector3, Vector3>(); for (int j = 0; j < array2.Length; j++) { if (Mathf.Abs(normals[j].y) < 0.8f) { dictionary.TryGetValue(array2[j], out var value); dictionary[array2[j]] = value + normals[j]; } } for (int k = 0; k < array2.Length; k++) { if (Mathf.Abs(normals[k].y) < 0.8f) { int num = k; Vector3 val = dictionary[array2[k]]; normals[num] = ((Vector3)(ref val)).normalized; } } Mesh.normals = normals; SwingData swingData = JsonUtility.FromJson<SwingData>(text2); if (swingData.version != 1 || swingData.names.Length != swingData.parents.Length || swingData.rest.Length != swingData.names.Length * 7 || swingData.count < 2 || swingData.samples.Length != swingData.count * swingData.rest.Length) { throw new InvalidDataException("Unsupported swing data"); } Samples = swingData.count; Muscles = Retarget(swingData); using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(array, writable: false))) { if (binaryReader.ReadInt32() != 843337299 || binaryReader.ReadInt32() != 24000) { throw new InvalidDataException("Unsupported sound bank"); } int num2 = binaryReader.ReadInt32(); int num3 = binaryReader.ReadInt32(); int num4 = binaryReader.ReadInt32(); if (num2 < 2 || num2 > 32 || num3 < 2 || num3 > 32 || num4 < 0 || num4 >= num3) { throw new InvalidDataException("Invalid sound bank counts"); } Whooshes = (AudioClip[])(object)new AudioClip[num2]; WhooshPeaks = new float[num2]; Impacts = (AudioClip[])(object)new AudioClip[num3 - 1]; for (int l = 0; l < num2 + num3; l++) { int num5 = binaryReader.ReadInt32(); if (num5 < 240 || num5 > 48000) { throw new InvalidDataException("Invalid sound clip length"); } float[] array3 = new float[num5]; for (int m = 0; m < num5; m++) { array3[m] = (float)binaryReader.ReadInt16() / 32768f; } AudioClip val2 = AudioClip.Create("Bonk Together " + ((l < num2) ? "swing " : "impact ") + l, num5, 1, 24000, false); val2.SetData(array3, 0); if (l < num2) { Whooshes[l] = val2; float num6 = -1f; for (int n = 0; n + 240 <= num5; n += 240) { float num7 = 0f; for (int num8 = n; num8 < n + 240; num8++) { num7 += array3[num8] * array3[num8]; } if (num7 > num6) { num6 = num7; WhooshPeaks[l] = (float)(n + 120) / 24000f; } } } else if (l - num2 == num4) { PlayerImpact = val2; } else { Impacts[l - num2 - ((l - num2 > num4) ? 1 : 0)] = val2; } } if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) { throw new InvalidDataException("Trailing sound bank data"); } } Plugin.Log.LogInfo((object)("Assets ready: " + Mesh.vertexCount + " vertices; " + Samples + " retargeted Mixamo poses; fingerprint " + Fingerprint.ToString("x16"))); } private static float[][] Retarget(SwingData data) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_005d: 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_0067: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_023d: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BonkTogether source rig") { hideFlags = (HideFlags)61 }; Avatar val2 = null; HumanPoseHandler val3 = null; try { Transform[] array = (Transform[])(object)new Transform[data.names.Length]; List<SkeletonBone> list = new List<SkeletonBone>(); list.Add(new SkeletonBone { name = ((Object)val).name, position = Vector3.zero, rotation = Quaternion.identity, scale = Vector3.one }); for (int i = 0; i < array.Length; i++) { if (data.parents[i] >= i || data.parents[i] < -1) { throw new InvalidDataException("Invalid source skeleton hierarchy"); } array[i] = new GameObject(data.names[i]).transform; array[i].SetParent((data.parents[i] < 0) ? val.transform : array[data.parents[i]], false); SetBone(array[i], data.rest, i * 7); list.Add(new SkeletonBone { name = ((Object)array[i]).name, position = array[i].localPosition, rotation = array[i].localRotation, scale = Vector3.one }); } List<HumanBone> list2 = new List<HumanBone>(); string[] names = data.names; foreach (string text in names) { if (TryHumanBone(text, out var target)) { HumanBone item = default(HumanBone); ((HumanBone)(ref item)).boneName = text; ((HumanBone)(ref item)).humanName = HumanTrait.BoneName[target]; HumanLimit limit = default(HumanLimit); ((HumanLimit)(ref limit)).useDefaultValues = true; item.limit = limit; list2.Add(item); } } HumanDescription val4 = new HumanDescription { human = list2.ToArray(), skeleton = list.ToArray() }; ((HumanDescription)(ref val4)).upperArmTwist = 0.5f; ((HumanDescription)(ref val4)).lowerArmTwist = 0.5f; ((HumanDescription)(ref val4)).upperLegTwist = 0.5f; ((HumanDescription)(ref val4)).lowerLegTwist = 0.5f; ((HumanDescription)(ref val4)).armStretch = 0.05f; ((HumanDescription)(ref val4)).legStretch = 0.05f; ((HumanDescription)(ref val4)).feetSpacing = 0f; HumanDescription val5 = val4; val2 = AvatarBuilder.BuildHumanAvatar(val, val5); if (!Object.op_Implicit((Object)(object)val2) || !val2.isValid || !val2.isHuman) { throw new InvalidDataException("Mixamo skeleton could not form a valid humanoid avatar"); } Animator obj = val.AddComponent<Animator>(); obj.avatar = val2; ((Behaviour)obj).enabled = false; val3 = new HumanPoseHandler(val2, val.transform); HumanPose val6 = default(HumanPose); float[][] array2 = new float[data.count][]; for (int k = 0; k < data.count; k++) { for (int l = 0; l < array.Length; l++) { SetBone(array[l], data.samples, (k * array.Length + l) * 7); } val3.GetHumanPose(ref val6); array2[k] = (float[])val6.muscles.Clone(); float[] array3 = array2[k]; for (int j = 0; j < array3.Length; j++) { if (!Wire.Finite(array3[j])) { throw new InvalidDataException("Non-finite humanoid muscle in source animation"); } } } return array2; } finally { if (val3 != null) { val3.Dispose(); } Object.Destroy((Object)(object)val); if (Object.op_Implicit((Object)(object)val2)) { Object.Destroy((Object)(object)val2); } } } private static void SetBone(Transform bone, float[] data, int i) { //IL_000e: 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) bone.localPosition = new Vector3(data[i], data[i + 1], data[i + 2]); bone.localRotation = new Quaternion(data[i + 3], data[i + 4], data[i + 5], data[i + 6]); } internal static bool TryHumanBone(string name, out HumanBodyBones target) { string text = name.Substring(name.LastIndexOf(':') + 1); if (text == "Spine1") { text = "Chest"; } else if (text == "Spine2") { text = "UpperChest"; } else if (text.EndsWith("UpLeg")) { text = text.Replace("UpLeg", "UpperLeg"); } else if (text == "LeftLeg" || text == "RightLeg") { text = text.Replace("Leg", "LowerLeg"); } else if (text.EndsWith("ToeBase")) { text = text.Replace("ToeBase", "Toes"); } else if (text == "LeftArm" || text == "RightArm") { text = text.Replace("Arm", "UpperArm"); } else if (text.EndsWith("ForeArm")) { text = text.Replace("ForeArm", "LowerArm"); } else if (text.Contains("Hand") && text.Length > 9) { text = text.Replace("Hand", "").Replace("Pinky", "Little"); if (text.EndsWith("1")) { text = text.Substring(0, text.Length - 1) + "Proximal"; } else if (text.EndsWith("2")) { text = text.Substring(0, text.Length - 1) + "Intermediate"; } else if (text.EndsWith("3")) { text = text.Substring(0, text.Length - 1) + "Distal"; } } if (Enum.TryParse<HumanBodyBones>(text, out target)) { return (int)target != 55; } return false; } public void Dispose() { if (Object.op_Implicit((Object)(object)Mesh)) { Object.Destroy((Object)(object)Mesh); } if (Whooshes != null) { AudioClip[] whooshes = Whooshes; foreach (AudioClip val in whooshes) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } } if (Impacts != null) { AudioClip[] whooshes = Impacts; foreach (AudioClip val2 in whooshes) { if (Object.op_Implicit((Object)(object)val2)) { Object.Destroy((Object)(object)val2); } } } if (Object.op_Implicit((Object)(object)PlayerImpact)) { Object.Destroy((Object)(object)PlayerImpact); } } } internal sealed class AvatarBat : IDisposable { public readonly PlayerController Player; public readonly bool Local; public readonly bool LeftHanded; public readonly ulong Epoch; public readonly float Length; public readonly float Thickness; private readonly Assets assets; private readonly Animator animator; private readonly GenericPoseRig rig; private readonly Transform bat; private readonly GameObject meshObject; private readonly Material[] materials; private readonly AudioSource swingAudio; private readonly AudioSource hitAudio; private readonly TwoHandGrip rightGrip; private readonly TwoHandGrip leftGrip; private readonly BodyEnvelope body; private readonly Collider[] overlaps = (Collider[])(object)new Collider[64]; private readonly RaycastHit[] hits = (RaycastHit[])(object)new RaycastHit[64]; private readonly Quaternion[] original; private bool applied; private bool hit; private bool hasPrevious; private bool whoosh; private Vector3 previousTip; private Vector3 carryOffset; private Vector3 fitAnchor; private bool hasCarryOffset; private float continuityWeight; private double started = -100.0; private double whooshAt; private int whooshIndex; private readonly double createdAt; public uint SwingId { get; private set; } public bool Reverse { get; private set; } public bool Chained { get; private set; } public float ArmClearance { get; private set; } public float RightArmClearance => rightGrip.ArmClearance; public float LeftArmClearance => leftGrip.ArmClearance; public float BodyTurn { get; private set; } public float CarrySide { get; private set; } public float ElbowDrop { get; private set; } public float CarryForward { get; private set; } public Vector3 Center { get; private set; } public Vector3 GripCenter { get; private set; } public int AudioRequests { get; private set; } public int Contacts { get; private set; } public int PlayerContacts { get; private set; } public string LastClip { get; private set; } public float GripError { get; private set; } public float HandOrder { get; private set; } public float GripSpan { get; private set; } public float HandAlignment { get; private set; } public float BodyClearance { get; private set; } public string ShaderName => ((Object)materials[0].shader).name; public bool Alive { get { if (Object.op_Implicit((Object)(object)Player) && ((NetworkIdentity)Player).isSpawned && Object.op_Implicit((Object)(object)animator) && Object.op_Implicit((Object)(object)rig.RightHand)) { return Object.op_Implicit((Object)(object)rig.LeftHand); } return false; } } public event Action<Vector3, bool> OnHit; public AvatarBat(PlayerController player, Assets resources, bool local, ulong epoch = 0uL, bool leftHanded = false) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) Player = player; assets = resources; Local = local; Epoch = epoch; LeftHanded = leftHanded; createdAt = Time.realtimeSinceStartupAsDouble; animator = GameAccess.Animator(player); if (!Object.op_Implicit((Object)(object)animator)) { throw new InvalidOperationException("Player does not expose an Animator"); } rig = new GenericPoseRig(animator, assets); original = (Quaternion[])(object)new Quaternion[rig.Bones.Length]; rightGrip = new TwoHandGrip(rig, left: false); leftGrip = new TwoHandGrip(rig, left: true); body = new BodyEnvelope(rig, animator); try { materials = BatMaterials.Create(); meshObject = new GameObject("Bonk Together bat (Biedny)"); bat = meshObject.transform; bat.SetParent(((Component)Player).transform, true); meshObject.AddComponent<MeshFilter>().sharedMesh = assets.Mesh; ((Renderer)meshObject.AddComponent<MeshRenderer>()).sharedMaterials = materials; Thickness = Mathf.Clamp(rig.Height * 0.8f, 0.5f, 1.05f) * 1.25f; Length = Thickness * 0.9f; bat.localScale = new Vector3(Thickness, Length, Thickness) / Mathf.Abs(((Component)Player).transform.lossyScale.x); rig.RightPose.Size(Thickness * 0.016f, rig.Height * 0.006f); rig.LeftPose.Size(Thickness * 0.016f, rig.Height * 0.006f); swingAudio = Audio("Swing"); hitAudio = Audio("Contact"); } catch { Dispose(); throw; } Plugin.Log.LogInfo((object)("Bat attached to " + (local ? "local" : "peer") + " avatar; hand=" + (leftHanded ? "left" : "right") + "; bat length " + Length)); } private AudioSource Audio(string name) { //IL_000b: 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) GameObject val = new GameObject("Bonk Together " + name); val.transform.SetParent(((Component)Player).transform, false); AudioSource val2 = val.AddComponent<AudioSource>(); val2.playOnAwake = false; val2.spatialBlend = 1f; val2.dopplerLevel = 0f; val2.rolloffMode = (AudioRolloffMode)1; val2.minDistance = 1.5f; val2.maxDistance = 12f; MonoSingleton<SFXManager>.I.AddPlayerAudio(val2); return val2; } public void Restore() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (applied) { for (int i = 0; i < rig.Bones.Length; i++) { if (Object.op_Implicit((Object)(object)rig.Bones[i])) { rig.Bones[i].localRotation = original[i]; } } } applied = false; } public void Begin(uint id, double now, double age, bool sound, bool reverse = false, bool chained = false) { if (id != 0 && id > SwingId) { SwingId = id; started = now - age; hit = false; hasPrevious = false; Reverse = reverse; Chained = chained; whooshIndex = Wire.Variant(SwingId, Epoch, assets.Whooshes.Length); whooshAt = Motion.WhooshStart(assets.WhooshPeaks[whooshIndex]); whoosh = !sound || age > whooshAt + 0.18; } } public void Contact(Vector3 point, bool player = false) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (Alive) { Contacts++; if (player) { PlayerContacts++; } Play(player ? assets.PlayerImpact : assets.Impacts[Wire.Variant(SwingId, Epoch, assets.Impacts.Length)], impact: true, point); if (Local) { BonkCameraShake.Kick(Plugin.Shake.Value); } } } private void Play(AudioClip clip, bool impact, Vector3 point) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (Local || Plugin.PeerSounds.Value) { AudioSource val = (impact ? hitAudio : swingAudio); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).transform.position = point; val.pitch = 1f; val.PlayOneShot(clip, Plugin.Volume.Value); AudioRequests++; LastClip = ((Object)clip).name; } } } public void Pose(double now) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: 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_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_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_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_044e: 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_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0465: 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_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_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047a: 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_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: 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_04ae: 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_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: 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_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: 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_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0380: 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_038a: 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_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: 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_05c1: 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_03b2: 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_03be: 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_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: 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_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: 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_06ec: 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_06f6: 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_06fa: 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_0701: 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) //IL_0708: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_073c: 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_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_076a: 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_078c: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: 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_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_09ec: Unknown result type (might be due to invalid IL or missing references) //IL_09ee: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Unknown result type (might be due to invalid IL or missing references) //IL_0a06: Unknown result type (might be due to invalid IL or missing references) //IL_0a0b: Unknown result type (might be due to invalid IL or missing references) //IL_0a0d: Unknown result type (might be due to invalid IL or missing references) //IL_0a12: Unknown result type (might be due to invalid IL or missing references) //IL_0a1f: 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_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a2a: Unknown result type (might be due to invalid IL or missing references) //IL_0a2c: 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_0a33: Unknown result type (might be due to invalid IL or missing references) //IL_0a35: Unknown result type (might be due to invalid IL or missing references) //IL_0a3c: Unknown result type (might be due to invalid IL or missing references) //IL_0a41: Unknown result type (might be due to invalid IL or missing references) //IL_0a48: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a52: Unknown result type (might be due to invalid IL or missing references) //IL_0a59: Unknown result type (might be due to invalid IL or missing references) //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_0a6e: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) //IL_0a7c: Unknown result type (might be due to invalid IL or missing references) //IL_0a7e: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Unknown result type (might be due to invalid IL or missing references) //IL_0a8d: Unknown result type (might be due to invalid IL or missing references) //IL_0a94: Unknown result type (might be due to invalid IL or missing references) //IL_0a99: Unknown result type (might be due to invalid IL or missing references) //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) //IL_0aa5: Unknown result type (might be due to invalid IL or missing references) //IL_0aaa: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0abf: Unknown result type (might be due to invalid IL or missing references) //IL_0ac4: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Unknown result type (might be due to invalid IL or missing references) //IL_0ad4: Unknown result type (might be due to invalid IL or missing references) //IL_0ada: Unknown result type (might be due to invalid IL or missing references) //IL_0adc: Unknown result type (might be due to invalid IL or missing references) //IL_0b06: Unknown result type (might be due to invalid IL or missing references) //IL_0b02: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_0b08: Unknown result type (might be due to invalid IL or missing references) //IL_0b0a: Unknown result type (might be due to invalid IL or missing references) //IL_0b49: Unknown result type (might be due to invalid IL or missing references) //IL_0b4b: Unknown result type (might be due to invalid IL or missing references) //IL_0b4d: Unknown result type (might be due to invalid IL or missing references) //IL_0b52: Unknown result type (might be due to invalid IL or missing references) //IL_0b59: Unknown result type (might be due to invalid IL or missing references) //IL_0b5e: Unknown result type (might be due to invalid IL or missing references) //IL_0b63: Unknown result type (might be due to invalid IL or missing references) //IL_0b6b: Unknown result type (might be due to invalid IL or missing references) //IL_0bad: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bbf: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0bc3: Unknown result type (might be due to invalid IL or missing references) //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0be4: Unknown result type (might be due to invalid IL or missing references) //IL_0bf8: Unknown result type (might be due to invalid IL or missing references) //IL_0bfd: Unknown result type (might be due to invalid IL or missing references) //IL_0c02: Unknown result type (might be due to invalid IL or missing references) //IL_0c09: Unknown result type (might be due to invalid IL or missing references) //IL_0c1d: Unknown result type (might be due to invalid IL or missing references) //IL_0c22: Unknown result type (might be due to invalid IL or missing references) //IL_0c27: Unknown result type (might be due to invalid IL or missing references) //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0b87: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0b8e: Unknown result type (might be due to invalid IL or missing references) //IL_0b90: Unknown result type (might be due to invalid IL or missing references) //IL_0b95: Unknown result type (might be due to invalid IL or missing references) //IL_0b9a: Unknown result type (might be due to invalid IL or missing references) //IL_0c5b: Unknown result type (might be due to invalid IL or missing references) //IL_0c57: Unknown result type (might be due to invalid IL or missing references) //IL_0c63: Unknown result type (might be due to invalid IL or missing references) //IL_0c84: Unknown result type (might be due to invalid IL or missing references) //IL_0c80: Unknown result type (might be due to invalid IL or missing references) //IL_09b6: Unknown result type (might be due to invalid IL or missing references) //IL_09b8: Unknown result type (might be due to invalid IL or missing references) //IL_0c8c: Unknown result type (might be due to invalid IL or missing references) //IL_0c9d: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_0829: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Unknown result type (might be due to invalid IL or missing references) //IL_0856: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Unknown result type (might be due to invalid IL or missing references) //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0863: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_086d: Unknown result type (might be due to invalid IL or missing references) //IL_0cae: Unknown result type (might be due to invalid IL or missing references) //IL_0caa: Unknown result type (might be due to invalid IL or missing references) //IL_0cbb: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_0879: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_088a: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08ab: Unknown result type (might be due to invalid IL or missing references) //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08b7: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08c5: Unknown result type (might be due to invalid IL or missing references) //IL_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_08cc: Unknown result type (might be due to invalid IL or missing references) //IL_08d1: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Unknown result type (might be due to invalid IL or missing references) //IL_08df: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_08e6: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_08f7: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_08fe: Unknown result type (might be due to invalid IL or missing references) //IL_0900: Unknown result type (might be due to invalid IL or missing references) //IL_0902: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Unknown result type (might be due to invalid IL or missing references) //IL_090c: Unknown result type (might be due to invalid IL or missing references) //IL_0911: Unknown result type (might be due to invalid IL or missing references) //IL_0919: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_0925: 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) //IL_092c: Unknown result type (might be due to invalid IL or missing references) //IL_092e: 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_0935: Unknown result type (might be due to invalid IL or missing references) //IL_0954: Unknown result type (might be due to invalid IL or missing references) //IL_0957: Unknown result type (might be due to invalid IL or missing references) //IL_0ccc: Unknown result type (might be due to invalid IL or missing references) //IL_0cc8: Unknown result type (might be due to invalid IL or missing references) //IL_096e: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0972: Unknown result type (might be due to invalid IL or missing references) //IL_0974: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_0978: Unknown result type (might be due to invalid IL or missing references) //IL_097a: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_0d09: Unknown result type (might be due to invalid IL or missing references) //IL_0d14: Unknown result type (might be due to invalid IL or missing references) //IL_0d19: Unknown result type (might be due to invalid IL or missing references) //IL_0cec: Unknown result type (might be due to invalid IL or missing references) //IL_0cf7: Unknown result type (might be due to invalid IL or missing references) //IL_0cfc: Unknown result type (might be due to invalid IL or missing references) //IL_0d24: Unknown result type (might be due to invalid IL or missing references) //IL_0d3f: Unknown result type (might be due to invalid IL or missing references) //IL_0d4a: Unknown result type (might be due to invalid IL or missing references) //IL_0d5f: Unknown result type (might be due to invalid IL or missing references) //IL_0d6a: Unknown result type (might be due to invalid IL or missing references) //IL_0d85: Unknown result type (might be due to invalid IL or missing references) //IL_0d87: Unknown result type (might be due to invalid IL or missing references) //IL_0da6: Unknown result type (might be due to invalid IL or missing references) //IL_0df8: Unknown result type (might be due to invalid IL or missing references) //IL_0dfd: Unknown result type (might be due to invalid IL or missing references) //IL_0e14: Unknown result type (might be due to invalid IL or missing references) //IL_0e19: Unknown result type (might be due to invalid IL or missing references) //IL_0e1c: Unknown result type (might be due to invalid IL or missing references) //IL_0e1e: Unknown result type (might be due to invalid IL or missing references) //IL_0e20: Unknown result type (might be due to invalid IL or missing references) //IL_0e2a: Unknown result type (might be due to invalid IL or missing references) //IL_0ddc: Unknown result type (might be due to invalid IL or missing references) //IL_0e60: Unknown result type (might be due to invalid IL or missing references) //IL_0e62: Unknown result type (might be due to invalid IL or missing references) //IL_0e56: Unknown result type (might be due to invalid IL or missing references) //IL_0e58: Unknown result type (might be due to invalid IL or missing references) if (!Alive || !animator.isInitialized) { return; } for (int i = 0; i < rig.Bones.Length; i++) { original[i] = rig.Bones[i].localRotation; } double num = now - started; bool flag = num >= 0.0 && num < 0.9; float num2 = (flag ? Motion.Recovery(num) : 1f); float num3 = (flag ? ((Chained ? 1f : Motion.Smooth((float)(num / 0.16))) * (1f - num2)) : 0f); float num4 = (flag ? Motion.Frame(Reverse ? Math.Max(0.0, 0.57 - num) : num) : 0f); int num5 = Mathf.FloorToInt(num4); int num6 = Mathf.Min(num5 + 1, assets.Samples - 1); float num7 = Motion.Smooth((float)(now - createdAt) / 0.18f); Quaternion[][] array = (LeftHanded ? rig.LeftFrames : rig.Frames); for (int j = 0; j < rig.TorsoBones.Length; j++) { Quaternion val = Quaternion.Slerp(array[num5][j], array[num6][j], num4 - (float)num5) * Quaternion.Inverse(array[0][j]); Quaternion localRotation = rig.TorsoBones[j].localRotation; rig.TorsoBones[j].localRotation = Quaternion.Slerp(localRotation, val * localRotation, num3 * 0.12f * num7); } applied = true; float num8 = ((!LeftHanded) ? 1 : (-1)); Vector3 up = ((Component)animator).transform.up; Vector3 forward = ((Component)animator).transform.forward; Vector3 right = ((Component)animator).transform.right; BodyTurn = (flag ? ((0f - Motion.Turn(num, Reverse, Chained)) * num8 * num7) : 0f); float num9 = (flag ? (Mathf.Sin(Mathf.Clamp01((float)(num / 0.57)) * (float)Math.PI) * (1f - num2) * num7) : 0f); for (int k = 0; k < rig.TorsoBones.Length; k++) { float num10 = k switch { 1 => 0.45f, 0 => 0.3f, _ => 0.25f, }; Transform val2 = rig.TorsoBones[k]; val2.rotation = Quaternion.AngleAxis(BodyTurn * num10, up) * Quaternion.AngleAxis(7f * num9 * num10, right) * Quaternion.AngleAxis((0f - BodyTurn) * 0.12f * num10, forward) * val2.rotation; } for (int l = 0; l < 2; l++) { bool flag2 = l == 1; Transform val3 = rig.Mapped[(HumanBodyBones)(flag2 ? 11 : 12)]; Quaternion val4 = (flag2 ? rig.LeftShoulderRest : rig.RightShoulderRest); val3.localRotation = Quaternion.Slerp(val4, val3.localRotation, num3); float num11 = 15f + 25f * num3; val3.rotation = Quaternion.AngleAxis(flag2 ? num11 : (0f - num11), up) * val3.rotation; } float num12 = Mathf.Sin((float)now * 1.8f) * 0.006f; BatPath.Sample(flag ? num : (-1.0), out var center, out var axis, Reverse, Chained); Vector3 val5 = (rig.Mapped[(HumanBodyBones)14].position + rig.Mapped[(HumanBodyBones)13].position) * 0.5f; Vector3 val6 = val5 + (right * center.x * num8 + up * center.y + forward * center.z) * rig.Height + up * num12; Quaternion val7 = Along(right * axis.x * num8 + up * axis.y + forward * axis.z, forward); Quaternion identity = Quaternion.identity; Quaternion identity2 = Quaternion.identity; GripSpan = (rig.RightPose.Width + rig.LeftPose.Width) * 0.5f + rig.Height * 0.004f; float num13 = -0.13f * Length + (LeftHanded ? rig.RightPose.Width : rig.LeftPose.Width) * 0.5f + Thickness * 0.007f + GripSpan * 0.5f; Vector3 val8 = val7 * Vector3.up * (GripSpan * 0.5f); Vector3 val9 = (LeftHanded ? (-val8) : val8); Vector3 val10 = -val9; Vector3 position = rig.Mapped[(HumanBodyBones)14].position; Vector3 position2 = rig.Mapped[(HumanBodyBones)13].position; body.Update(Thickness); rightGrip.Prepare(up, 1f - num3); leftGrip.Prepare(up, 1f - num3); Vector3 requested = val6; bool flag3 = num3 <= 1E-05f; continuityWeight = ((flag3 && hasCarryOffset) ? 10 : 0); if (continuityWeight > 0f) { val6 = val5 + ((Component)animator).transform.rotation * carryOffset; } fitAnchor = val6; Vector3 val12; for (int m = 0; m < 32; m++) { Vector3 val11 = val6; identity = rig.RightPose.Wrist(val7, val6 + val9, position); identity2 = rig.LeftPose.Wrist(val7, val6 + val10, position2); val6 += rightGrip.Reachable(val6 + val9, identity) - (val6 + val9); val6 += leftGrip.Reachable(val6 + val10, identity2) - (val6 + val10); val6 = body.Push(val6, val7, Length, num13); val12 = val6 - val11; if (((Vector3)(ref val12)).sqrMagnitude < 1E-10f) { break; } } float num14 = ArmScore(val6, val7, val9, val10, position, position2, requested, right * num8, 1f - num3); if (num14 < -0.001f) { for (int n = 0; n < 7; n++) { if (!(num14 < -0.001f)) { break; } Vector3 val13 = val6; float num15 = num14; float num16 = rig.Height * ((!(continuityWeight > 0f)) ? ((n < 4) ? 0.025f : 0.006f) : ((n < 4) ? 0.001f : 0.00025f)); for (int num17 = 0; num17 < 27; num17++) { if (num17 == 13) { continue; } val12 = right * (float)(num17 % 3 - 1) + up * (float)(num17 / 3 % 3 - 1) + forward * (float)(num17 / 9 - 1); Vector3 normalized = ((Vector3)(ref val12)).normalized; Vector3 val14 = val6 + normalized * num16; for (int num18 = 0; num18 < 12; num18++) { Vector3 val15 = val14; Quaternion wrist = rig.RightPose.Wrist(val7, val14 + val9, position); Quaternion wrist2 = rig.LeftPose.Wrist(val7, val14 + val10, position2); val14 += rightGrip.Reachable(val14 + val9, wrist) - (val14 + val9); val14 += leftGrip.Reachable(val14 + val10, wrist2) - (val14 + val10); val14 = body.Push(val14, val7, Length, num13); val12 = val14 - val15; if (((Vector3)(ref val12)).sqrMagnitude < 1E-10f) { break; } } if (!((0f - Vector3.Distance(val14, fitAnchor)) * continuityWeight <= num15)) { float num19 = ArmScore(val14, val7, val9, val10, position, position2, requested, right * num8, 1f - num3); if (num19 > num15) { num15 = num19; val13 = val14; } } } bool num20 = num15 > num14; val6 = val13; num14 = num15; if (!num20) { if (n >= 4) { break; } n = 3; } } } Vector3 val16 = val6 - val8; Vector3 val17 = val6 + val8; identity = rig.RightPose.Wrist(val7, val6 + val9, position); identity2 = rig.LeftPose.Wrist(val7, val6 + val10, position2); Vector3 pole = position + (right * 0.16f - up * 0.35f + forward * 0.08f) * rig.Height; Vector3 pole2 = position2 + (-right * 0.16f - up * 0.35f + forward * 0.08f) * rig.Height; rightGrip.Solve(LeftHanded ? val16 : val17, identity, pole, body, body.RightArmRadius); leftGrip.Solve(LeftHanded ? val17 : val16, identity2, pole2, body, body.LeftArmRadius); ArmClearance = Mathf.Min(rightGrip.ArmClearance, leftGrip.ArmClearance); bat.SetPositionAndRotation(val6 - val7 * Vector3.up * num13, val7); GripCenter = val6; if (flag3) { carryOffset = Quaternion.Inverse(((Component)animator).transform.rotation) * (val6 - val5); hasCarryOffset = true; } CarryForward = Vector3.Dot(bat.up, forward); CarrySide = Vector3.Dot(val6 - val5, right) * num8 / rig.Height; ElbowDrop = Mathf.Min(Vector3.Dot(position - rig.Mapped[(HumanBodyBones)16].position, up), Vector3.Dot(position2 - rig.Mapped[(HumanBodyBones)15].position, up)) / rig.Height; rig.RightPose.Fingers(LeftHanded ? val16 : val17, bat.up); rig.LeftPose.Fingers(LeftHanded ? val17 : val16, bat.up); GripError = Mathf.Max(Vector3.Distance(rightGrip.Palm, LeftHanded ? val16 : val17), Vector3.Distance(leftGrip.Palm, LeftHanded ? val17 : val16)); HandOrder = Vector3.Dot(LeftHanded ? (leftGrip.Palm - rightGrip.Palm) : (rightGrip.Palm - leftGrip.Palm), bat.up); HandAlignment = Mathf.Min(Vector3.Dot(rig.RightPose.AcrossKnuckles, bat.up), Vector3.Dot(rig.LeftPose.AcrossKnuckles, bat.up)); BodyClearance = body.Clearance(val6, val7, Length, num13); ((Component)swingAudio).transform.position = val6; if (flag && !whoosh && num >= whooshAt) { whoosh = true; Play(assets.Whooshes[whooshIndex], impact: false, val6); } Vector3 val18 = bat.TransformPoint(0f, 0.84f, 0f); Vector3 val19 = bat.TransformPoint(0f, 0.12f, 0f); Center = (val18 + val19) * 0.5f; bool flag4 = flag && Motion.Contact(num); if (Local && flag4 && !hit) { Detect(val19, val18); } previousTip = val18; hasPrevious = flag4; } private float ArmScore(Vector3 center, Quaternion rotation, Vector3 rightOffset, Vector3 leftOffset, Vector3 rightShoulder, Vector3 leftShoulder, Vector3 requested, Vector3 dominant, float relaxed) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0013: 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_0026: 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_002a: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_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_0063: 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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_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_009f: 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_00b0: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00be: 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_00c1: 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_00e6: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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) Quaternion wrist = rig.RightPose.Wrist(rotation, center + rightOffset, rightShoulder); Quaternion wrist2 = rig.LeftPose.Wrist(rotation, center + leftOffset, leftShoulder); float poseCost; float poseCost2; float num = Mathf.Min(rightGrip.AvailableClearance(center + rightOffset, wrist, body, body.RightArmRadius, out poseCost), leftGrip.AvailableClearance(center + leftOffset, wrist2, body, body.LeftArmRadius, out poseCost2)); float num2 = Vector3.Distance(rightGrip.Reachable(center + rightOffset, wrist), center + rightOffset) + Vector3.Distance(leftGrip.Reachable(center + leftOffset, wrist2), center + leftOffset); float num3 = Mathf.Max(0f, (0f - rig.Height) * 0.04f - Vector3.Dot(center - requested, dominant)) * relaxed; float num4 = (0f - Mathf.Max(0f, 0.004f - 0.003f * relaxed - num)) * 1000f - poseCost - poseCost2 - num2 * 100f; Vector3 val = center - requested; return num4 - ((Vector3)(ref val)).sqrMagnitude * 0.05f - num3 * 8f - Vector3.Distance(center, fitAnchor) * continuityWeight; } private static Quaternion Along(Vector3 up, Vector3 forward) { //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_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_0016: 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_0021: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(forward, up); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.ProjectOnPlane(Vector3.right, up); } return Quaternion.LookRotation(((Vector3)(ref val)).normalized, ((Vector3)(ref up)).normalized); } private void Detect(Vector3 basePoint, Vector3 tip) { //IL_000d: 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_0045: 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_004b: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00c7: 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) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) float num = Thickness * 0.055f; int num2 = Physics.OverlapCapsuleNonAlloc(basePoint, tip, num, overlaps, -1, (QueryTriggerInteraction)1); Collider val = null; float num3 = float.MaxValue; for (int i = 0; i < num2; i++) { if (Valid(overlaps[i])) { Vector3 val2 = overlaps[i].ClosestPoint(tip) - tip; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num3) { val = overlaps[i]; num3 = sqrMagnitude; } } } Vector3 val3 = (Object.op_Implicit((Object)(object)val) ? val.ClosestPoint(tip) : Vector3.zero); Vector3 val4 = tip - previousTip; if (!Object.op_Implicit((Object)(object)val) && hasPrevious && ((Vector3)(ref val4)).sqrMagnitude > 1E-06f) { num2 = Physics.SphereCastNonAlloc(previousTip, num, ((Vector3)(ref val4)).normalized, hits, ((Vector3)(ref val4)).magnitude, -1, (QueryTriggerInteraction)1); float num4 = float.MaxValue; for (int j = 0; j < num2; j++) { if (Valid(((RaycastHit)(ref hits[j])).collider) && ((RaycastHit)(ref hits[j])).distance < num4) { val = ((RaycastHit)(ref hits[j])).collider; num4 = ((RaycastHit)(ref hits[j])).distance; val3 = ((RaycastHit)(ref hits[j])).point; } } } if (Object.op_Implicit((Object)(object)val)) { hit = true; PlayerController componentInParent = ((Component)val).GetComponentInParent<PlayerController>(); bool flag = Object.op_Implicit((Object)(object)componentInParent) && (Object)(object)componentInParent != (Object)(object)Player; Contact(val3, flag); if (this.OnHit != null) { this.OnHit(val3, flag); } } } private bool Valid(Collider collider) { if (Object.op_Implicit((Object)(object)collider) && collider.enabled && !collider.isTrigger && !((Component)collider).transform.IsChildOf(((Component)Player).transform)) { return ((Component)collider).gameObject.activeInHierarchy; } return false; } public void Dispose() { Restore(); SFXManager i = MonoSingleton<SFXManager>.I; AudioSource[] array = (AudioSource[])(object)new AudioSource[2] { swingAudio, hitAudio }; foreach (AudioSource val in array) { if (Object.op_Implicit((Object)(object)val)) { if (Object.op_Implicit((Object)(object)i)) { i.RemovePlayerAudio(val); } Object.Destroy((Object)(object)((Component)val).gameObject); } } if (Object.op_Implicit((Object)(object)meshObject)) { Object.Destroy((Object)(object)meshObject); } if (materials == null) { return; } Material[] array2 = materials; foreach (Material val2 in array2) { if (Object.op_Implicit((Object)(object)val2)) { Object.Destroy((Object)(object)val2); } } } } internal static class BatMaterials { public static Material[] Create() { //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_00ce: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0166: 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) Material val = null; Material val2 = null; Material[] array = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val3 in array) { if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.shader)) { if (((Object)val3.shader).name == "Shader Graphs/ToonWaveShader" && val3.HasProperty("_Color_1") && (!Object.op_Implicit((Object)(object)val) || ((Object)val3).name == "WaveWhite")) { val = val3; } if (((Object)val3.shader).name == "Shader Graphs/OutlineShader") { val2 = val3; } } } if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { throw new InvalidOperationException("Native toon/outline materials are unavailable in this scene"); } Material val4 = new Material(val) { name = "Bonk Together honey maple" }; Material val5 = new Material(val2) { name = "Bonk Together native outline" }; val4.SetColor("_Color_1", new Color(1f, 0.86f, 0.61f, 1f)); val4.SetColor("_Color_2", new Color(0.91f, 0.69f, 0.4f, 1f)); val4.SetColor("_Color_3", new Color(0.73f, 0.49f, 0.28f, 1f)); val4.SetColor("_Color_4", new Color(0.55f, 0.36f, 0.24f, 1f)); array = (Material[])(object)new Material[2] { val4, val5 }; foreach (Material val6 in array) { Set(val6, "_WindStrength", 0f); Set(val6, "_WindDensity", 0f); Set(val6, "_WindSpeed", 0f); Set(val6, "_Windspeed", 0f); Set(val6, "_FadeDistance", 100f); Set(val6, "_OutlineRenderDistance", 0f); Set(val6, "_Cull", (!((Object)(object)val6 == (Object)(object)val4)) ? 1 : 2); } Set(val4, "_Threshold_1", 0.7f); Set(val4, "_Threshold_2", 0.3f); Set(val4, "_Threshold_3", 0.05f); if (val4.HasProperty("_Texture2D")) { val4.SetTexture("_Texture2D", (Texture)(object)Texture2D.whiteTexture); } val5.SetColor("_OutlineColor", new Color(0.38f, 0.27f, 0.2f, 1f)); Set(val5, "_OutlineThickness", 0.0025f); Plugin.Log.LogInfo((object)("Bat uses native shaders: " + ((Object)val4.shader).name + " + " + ((Object)val5.shader).name)); return (Material[])(object)new Material[2] { val4, val5 }; } private static void Set(Material material, string property, float value) { if (material.HasProperty(property)) { material.SetFloat(property, value); } } } internal static class BatPath { public static void Sample(double elapsed, out Vector3 center, out Vector3 axis, bool reverse = false, bool chained = false) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_004d: 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_0054: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_0168: 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_0134: 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_0195: 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_0199: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_01c8: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_0259: 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_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0.1f, -0.13f, 0.21f); Vector3 val2 = new Vector3(0.46f, 0.89f, -0.025f); Vector3 normalized = ((Vector3)(ref val2)).normalized; if (elapsed < 0.0 || elapsed >= 0.9) { center = val; axis = normalized; return; } float num = ((!reverse) ? 1 : (-1)); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0.14f * num, 0.07f, 0.25f); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(0.83f * num, 0.54f, 0.1f); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(0.1f * num, 0.015f, 0.29f); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(0.7f * num, 0.18f, 0.69f); Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(-0.1f * num, 0.015f, 0.29f); Vector3 val8 = default(Vector3); ((Vector3)(ref val8))..ctor(-0.7f * num, 0.18f, 0.69f); Vector3 val9 = default(Vector3); ((Vector3)(ref val9))..ctor(-0.14f * num, 0.07f, 0.25f); Vector3 val10 = default(Vector3); ((Vector3)(ref val10))..ctor(-0.83f * num, 0.54f, 0.1f); if (elapsed < 0.2) { Mix(chained ? val3 : val, val3, chained ? val4 : normalized, val4, elapsed / 0.2, out center, out axis); return; } if (elapsed < 0.28) { Mix(val3, val5, val4, val6, (elapsed - 0.2) / 0.08, out center, out axis); return; } if (elapsed < 0.37) { Mix(val5, val7, val6, val8, (elapsed - 0.28) / 0.09, out center, out axis); return; } if (elapsed < 0.57) { Mix(val7, val9, val8, val10, (elapsed - 0.37) / 0.2, out center, out axis); return; } float num2 = Motion.Recovery(elapsed); center = Vector3.Lerp(val9, val, num2) + Vector3.forward * (Mathf.Sin(num2 * (float)Math.PI) * 0.055f); Vector3 val11 = default(Vector3); ((Vector3)(ref val11))..ctor(0f, 0.25f, 1f); val2 = ((num2 < 0.5f) ? Vector3.Slerp(val10, val11, Motion.Smooth(num2 * 2f)) : Vector3.Slerp(val11, normalized, Motion.Smooth(num2 * 2f - 1f))); axis = ((Vector3)(ref val2)).normalized; } private static void Mix(Vector3 a, Vector3 b, Vector3 x, Vector3 y, double time, out Vector3 center, out Vector3 axis) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_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_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) float num = Motion.Smooth((float)time); center = Vector3.Lerp(a, b, num); Vector3 val = Vector3.Slerp(x, y, num); axis = ((Vector3)(ref val)).normalized; } } internal sealed class BodyEnvelope { private readonly GenericPoseRig rig; private readonly Transform root; private readonly Vector3[] starts = (Vector3[])(object)new Vector3[3]; private readonly Vector3[] ends = (Vector3[])(object)new Vector3[3]; private readonly Vector3[] radii = (Vector3[])(object)new Vector3[3]; private readonly Vector3[] clearRadii = (Vector3[])(object)new Vector3[3]; private readonly Vector3[] pushRadii = (Vector3[])(object)new Vector3[3]; private readonly Vector3[] clearAxis = (Vector3[])(object)new Vector3[3]; private readonly Vector3[] pushAxis = (Vector3[])(object)new Vector3[3]; private readonly float[] clearDenominator = new float[3]; private readonly float[] pushDenominator = new float[3]; private readonly float[] clearScale = new float[3]; private readonly Vector3 headOffset; private Vector3 right; private Vector3 up; private Vector3 forward; private Vector3 armCenter; private Vector3 armRadii; public readonly float RightArmRadius; public readonly float LeftArmRadius; public BodyEnvelope(GenericPoseRig skeleton, Animator animator) { //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_00a9: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046f: 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_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_051a: 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_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0525: 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_052e: 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_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0576: 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_0589: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_0679: 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_01e9: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Invalid comparison between Unknown and I4 //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Invalid comparison between Unknown and I4 //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Invalid comparison between Unknown and I4 //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Invalid comparison between Unknown and I4 //IL_02c0: 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_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Invalid comparison between Unknown and I4 //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: 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_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: 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_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039e: 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_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Invalid comparison between Unknown and I4 //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: 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_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Invalid comparison between Unknown and I4 //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: 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_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) rig = skeleton; root = ((Component)animator).transform; right = root.right; up = root.up; forward = root.forward; Vector3 position = rig.Mapped[(HumanBodyBones)14].position; Vector3 position2 = rig.Mapped[(HumanBodyBones)16].position; Vector3 position3 = rig.Mapped[(HumanBodyBones)13].position; Vector3 position4 = rig.Mapped[(HumanBodyBones)15].position; Bounds[] array = (Bounds[])(object)new Bounds[2]; bool[] array2 = new bool[2]; SkinnedMeshRenderer[] componentsInChildren = ((Component)animator).GetComponentsInChildren<SkinnedMeshRenderer>(true); Vector3 val9; foreach (SkinnedMeshRenderer val in componentsInChildren) { if (!((Renderer)val).enabled || !((Component)val).gameObject.activeInHierarchy || !Object.op_Implicit((Object)(object)val.sharedMesh)) { continue; } BoneWeight[] boneWeights = val.sharedMesh.boneWeights; Transform[] bones = val.bones; HumanBodyBones[] array3 = (HumanBodyBones[])(object)new HumanBodyBones[bones.Length]; for (int j = 0; j < bones.Length; j++) { array3[j] = (HumanBodyBones)((Object.op_Implicit((Object)(object)bones[j]) && Assets.TryHumanBone(((Object)bones[j]).name, out var target)) ? ((int)target) : 55); } Transform transform = ((Component)val).transform; Mesh val2 = new Mesh(); try { val.BakeMesh(val2); Vector3[] vertices = val2.vertices; for (int k = 0; k < Math.Min(boneWeights.Length, vertices.Length); k++) { BoneWeight val3 = boneWeights[k]; int num = ((BoneWeight)(ref val3)).boneIndex0; float num2 = ((BoneWeight)(ref val3)).weight0; if (((BoneWeight)(ref val3)).weight1 > num2) { num = ((BoneWeight)(ref val3)).boneIndex1; num2 = ((BoneWeight)(ref val3)).weight1; } if (((BoneWeight)(ref val3)).weight2 > num2) { num = ((BoneWeight)(ref val3)).boneIndex2; num2 = ((BoneWeight)(ref val3)).weight2; } if (((BoneWeight)(ref val3)).weight3 > num2) { num = ((BoneWeight)(ref val3)).boneIndex3; num2 = ((BoneWeight)(ref val3)).weight3; } if (num2 < 0.45f || num >= bones.Length || (int)array3[num] == 55) { continue; } HumanBodyBones val4 = array3[num]; if ((int)val4 == 14 || (int)val4 == 13) { bool flag = (int)val4 == 13; Vector3 val5 = (flag ? position3 : position); Vector3 val6 = (flag ? position4 : position2); Vector3 val7 = transform.TransformPoint(vertices[k]); Vector3 val8 = val6 - val5; float num3 = Vector3.Dot(val7 - val5, val8) / ((Vector3)(ref val8)).sqrMagnitude; if (num3 > 0.2f && num3 < 0.85f) { val9 = val7 - val5 - val8 * num3; float magnitude = ((Vector3)(ref val9)).magnitude; if (flag) { LeftArmRadius = Mathf.Max(LeftArmRadius, magnitude); } else { RightArmRadius = Mathf.Max(RightArmRadius, magnitude); } } } int num4 = (((int)val4 == 10) ? 1 : (((int)val4 != 0 && (int)val4 != 7 && (int)val4 != 8 && (int)val4 != 54) ? (-1) : 0)); if (num4 >= 0) { Vector3 val10 = Basis(transform.TransformPoint(vertices[k]) - root.position); if (array2[num4]) { ((Bounds)(ref array[num4])).Encapsulate(val10); continue; } array[num4] = new Bounds(val10, Vector3.zero); array2[num4] = true; } } } finally { Object.Destroy((Object)(object)val2); } } if (!array2[0] || !array2[1]) { throw new InvalidOperationException("Cannot measure the visible torso/head skin for bat clearance"); } Vector3 val11 = Basis(rig.Mapped[(HumanBodyBones)0].position - root.position); float num5 = Mathf.Max(Mathf.Abs(((Bounds)(ref array[0])).min.x - val11.x), Mathf.Abs(((Bounds)(ref array[0])).max.x - val11.x)); float num6 = Mathf.Max(Mathf.Abs(((Bounds)(ref array[0])).min.z - val11.z), Mathf.Abs(((Bounds)(ref array[0])).max.z - val11.z)); val9 = (radii[0] = (radii[2] = new Vector3(num5, num5, num6) + Vector3.one * rig.Height * 0.004f)); radii[1] = ((Bounds)(ref array[1])).extents + Vector3.one * rig.Height * 0.004f; Vector3 val12 = root.position + World(((Bounds)(ref array[1])).center); headOffset = rig.Mapped[(HumanBodyBones)10].InverseTransformPoint(val12); float num7 = Vector3.Distance(position, position2); float num8 = Vector3.Distance(position3, position4); RightArmRadius = Mathf.Clamp(RightArmRadius, rig.Height * 0.012f, num7 * 0.2f); LeftArmRadius = Mathf.Clamp(LeftArmRadius, rig.Height * 0.012f, num8 * 0.2f); Plugin.Log.LogInfo((object)string.Concat("Measured torso half-width/depth=", radii[0].x, "/", radii[0].z, "; head radii=", radii[1], "; R/L arm radii=", RightArmRadius, "/", LeftArmRadius)); } public void Update(float thickness) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0044: 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_0051: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ad: 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_00c0: 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) //I