Decompiled source of Bonk Together v0.10.0
BepInEx/plugins/BonkTogether/BonkTogether.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BonkTogether.Core; using Cinemachine; using HarmonyLib; using PurrNet; using Steamworks; using TMPro; using Unity.Collections; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.Sprites; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Bonk Together")] [assembly: AssemblyFileVersion("0.10.0.0")] [assembly: AssemblyInformationalVersion("0.10.0-alpha.1")] [assembly: InternalsVisibleTo("BonkTogether.RuntimeProbe")] [assembly: AssemblyVersion("0.10.0.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 { internal const int KissCount = 14; 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 AudioClip[] Kisses; public readonly float[] KissPeaks; 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_0190: 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_01a9: 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_01be: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) 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-v14-residents-love-boba-native-launch-0.9.0"); memoryStream2.Write(bytes, 0, bytes.Length); memoryStream2.Write(array, 0, array.Length); for (int i = 1; i <= 14; i++) { byte[] array2 = PcmAudio.Bytes("kiss-" + i + ".wav"); memoryStream2.Write(array2, 0, array2.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[] array3 = (Vector3[])(object)new Vector3[batData.vertices.Length / 3]; for (int j = 0; j < array3.Length; j++) { array3[j] = new Vector3(batData.vertices[j * 3], batData.vertices[j * 3 + 1], batData.vertices[j * 3 + 2]); } Mesh = new Mesh { name = "Biedny baseball bat" }; Mesh.vertices = array3; Mesh.triangles = batData.triangles; Mesh.RecalculateNormals(); Mesh.RecalculateBounds(); Vector3[] normals = Mesh.normals; Dictionary<Vector3, Vector3> dictionary = new Dictionary<Vector3, Vector3>(); for (int k = 0; k < array3.Length; k++) { if (Mathf.Abs(normals[k].y) < 0.8f) { dictionary.TryGetValue(array3[k], out var value); dictionary[array3[k]] = value + normals[k]; } } for (int l = 0; l < array3.Length; l++) { if (Mathf.Abs(normals[l].y) < 0.8f) { int num = l; Vector3 val = dictionary[array3[l]]; 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 m = 0; m < num2 + num3; m++) { int num5 = binaryReader.ReadInt32(); if (num5 < 240 || num5 > 48000) { throw new InvalidDataException("Invalid sound clip length"); } float[] array4 = new float[num5]; for (int n = 0; n < num5; n++) { array4[n] = (float)binaryReader.ReadInt16() / 32768f; } AudioClip val2 = AudioClip.Create("Bonk Together " + ((m < num2) ? "swing " : "impact ") + m, num5, 1, 24000, false); val2.SetData(array4, 0); if (m < num2) { Whooshes[m] = val2; float num6 = -1f; for (int num7 = 0; num7 + 240 <= num5; num7 += 240) { float num8 = 0f; for (int num9 = num7; num9 < num7 + 240; num9++) { num8 += array4[num9] * array4[num9]; } if (num8 > num6) { num6 = num8; WhooshPeaks[m] = (float)(num7 + 120) / 24000f; } } } else if (m - num2 == num4) { PlayerImpact = val2; } else { Impacts[m - num2 - ((m - num2 > num4) ? 1 : 0)] = val2; } } if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) { throw new InvalidDataException("Trailing sound bank data"); } } Kisses = (AudioClip[])(object)new AudioClip[14]; KissPeaks = new float[14]; for (int num10 = 0; num10 < 14; num10++) { string name = ((num10 < 2) ? ("Kiss " + (num10 + 2) + " - Joseph Sardin (CC0)") : ("Kiss " + (num10 + 1) + " - VoiceBosch (Pixabay)")); Kisses[num10] = PcmAudio.Read("kiss-" + (num10 + 1) + ".wav", name); KissPeaks[num10] = PcmAudio.Peak(Kisses[num10]); } 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 (Kisses != null) { AudioClip[] whooshes = Kisses; foreach (AudioClip val2 in whooshes) { if (Object.op_Implicit((Object)(object)val2)) { Object.Destroy((Object)(object)val2); } } } if (Impacts != null) { AudioClip[] whooshes = Impacts; foreach (AudioClip val3 in whooshes) { if (Object.op_Implicit((Object)(object)val3)) { Object.Destroy((Object)(object)val3); } } } 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 BodyEnvelope body; private readonly EquipmentFit equipment; private readonly BatCollision collision; private readonly BatTape tape; private readonly BatTrail trail; private readonly Quaternion[] original; private bool applied; private bool hit; private bool hasPrevious; private bool whoosh; private bool disposed; private Vector3 safeCenter; private Quaternion safeRotation; private BatSegment previousShaft; private bool pendingFit; private double impactAge = -1.0; private double reboundAnchorAge; private float reboundTurn; private double safeElapsed; private readonly Quaternion[] safeUpper = (Quaternion[])(object)new Quaternion[5]; private float safeTurn; private bool flourishCancelled; private double preparationStarted; private Vector3 carryOffset; private Vector3 fitAnchor; private Vector3 entryPath; private Vector3 entryAxis; private Vector3 lastPath; private Vector3 lastAxis; private float entryTurn; private Vector3 entryNormal; private bool hasEntry; private bool hasPose; private readonly Quaternion[] entryUpper = (Quaternion[])(object)new Quaternion[5]; private bool hasCarryOffset; private float continuityWeight; private Vector3 swingCorrection; private Vector3 currentRequested; private bool hasSwingCorrection; private double started = -100.0; private double previousPoseTime = -100.0; private double whooshAt; private int whooshIndex; private readonly double createdAt; private readonly Vector3 attachedScale; public uint ReboundSerial { get; set; } public Vector3 ReboundPath { get; private set; } public Vector3 ReboundAxis { get; private set; } public bool Rebounded => impactAge >= 0.0; public int ImpactAgeMs => (int)Math.Max(0.0, impactAge * 1000.0); public bool Constrained { get; private set; } public byte TapeColor { get; set; } public bool FlourishAllowed { get; set; } public double PoseTime { get; private set; } public bool Overhead { get; private set; } public bool LowBall { get; private set; } public bool Preparing { get; private set; } public bool SoftImpact { get; private set; } public int EnvelopeRefreshes { get; private set; } public Vector3 ImpactNormal { get; private set; } public bool ScaleChanged { get { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)animator)) { Vector3 val = ((Component)animator).transform.lossyScale - attachedScale; return ((Vector3)(ref val)).sqrMagnitude > 1E-06f; } return false; } } 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 (!disposed && 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; } } internal bool LoveSwing { get; private set; } public event Action<Vector3, bool> OnHit; public event Action<BatImpact, PlayerController> OnImpact; internal bool Flourishing(double now) { if (Plugin.Flourish.Value && FlourishAllowed && !flourishCancelled && now - createdAt >= 0.0) { return now - createdAt < 0.35; } return false; } internal bool SteadyCarry(double now) { if (now - started >= 0.9 && !Preparing) { return !Flourishing(now); } return false; } internal Vector3 TossTarget(bool overhead) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b4: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) BatPath.Sample(overhead ? 0.24 : 0.315, out var center, out var axis, reverse: false, chained: false, overhead); Transform transform = ((Component)animator).transform; float num = ((!LeftHanded) ? 1 : (-1)); Vector3 val = (rig.Mapped[(HumanBodyBones)14].position + rig.Mapped[(HumanBodyBones)13].position) * 0.5f + (transform.right * center.x * num + transform.up * center.y + transform.forward * center.z) * rig.Height; Vector3 val2 = transform.right * axis.x * num + transform.up * axis.y + transform.forward * axis.z; return val + ((Vector3)(ref val2)).normalized * Length * 0.48f; } public AvatarBat(PlayerController player, Assets resources, bool local, ulong epoch = 0uL, bool leftHanded = false) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0236: 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; FlourishAllowed = local; animator = GameAccess.Animator(player); if (!Object.op_Implicit((Object)(object)animator)) { throw new InvalidOperationException("Player does not expose an Animator"); } attachedScale = ((Component)animator).transform.lossyScale; 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); equipment = new EquipmentFit(animator); collision = new BatCollision(((Component)Player).transform); 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"); tape = new BatTape(bat, materials[0]); trail = new BatTrail(((Component)Player).transform); TapeColor = (byte)Plugin.Tape.Value; } 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 Prepare(double now, double age) { if (!(now - started < 0.9)) { if (!Preparing) { Preparing = true; preparationStarted = now; hasSwingCorrection = false; } if (!Local) { preparationStarted = now - Math.Min(1.5, Math.Max(0.0, age)); } flourishCancelled = true; } } public void CancelPreparation() { Preparing = false; } public double PreparationAge(double now) { if (!Preparing) { return 0.0; } return Math.Max(0.0, now - preparationStarted); } public void Begin(uint id, double now, double age, bool sound, bool reverse = false, bool chained = false, bool overhead = false, bool lowBall = false, bool loveSwing = false) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (id != 0 && id > SwingId) { hasEntry = hasPose; entryPath = lastPath; entryAxis = lastAxis; entryTurn = BodyTurn; for (int i = 0; i < entryUpper.Length; i++) { entryUpper[i] = safeUpper[i]; } entryNormal = ((Rebounded && now - started < 1.1) ? ((Component)animator).transform.InverseTransformDirection(ImpactNormal) : Vector3.zero); entryNormal.x *= ((!LeftHanded) ? 1 : (-1)); SwingId = id; started = now - age; hit = false; impactAge = -1.0; ReboundSerial = 0u; Preparing = false; Overhead = overhead; LoveSwing = loveSwing; LowBall = lowBall && !overhead; hasSwingCorrection = false; if (age < 0.9) { flourishCancelled = true; } trail.Clear(); Reverse = reverse; Chained = chained; whooshIndex = Wire.Variant(SwingId, Epoch, LoveSwing ? assets.Kisses.Length : assets.Whooshes.Length); whooshAt = Motion.WhooshStart(LoveSwing ? assets.KissPeaks[whooshIndex] : assets.WhooshPeaks[whooshIndex], Overhead); 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; } } } private void Fit(double now, double elapsed, bool constrained = false, Vector3 fixedCenter = default(Vector3), Quaternion fixedRotation = default(Quaternion)) { //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_01d6: 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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: 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_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_072f: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: 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_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0a19: Unknown result type (might be due to invalid IL or missing references) //IL_0a1e: Unknown result type (might be due to invalid IL or missing references) //IL_0a20: Unknown result type (might be due to invalid IL or missing references) //IL_0a22: Unknown result type (might be due to invalid IL or missing references) //IL_0a24: Unknown result type (might be due to invalid IL or missing references) //IL_0a2b: Unknown result type (might be due to invalid IL or missing references) //IL_0a32: Unknown result type (might be due to invalid IL or missing references) //IL_0a37: Unknown result type (might be due to invalid IL or missing references) //IL_0a39: Unknown result type (might be due to invalid IL or missing references) //IL_0a40: Unknown result type (might be due to invalid IL or missing references) //IL_0a45: Unknown result type (might be due to invalid IL or missing references) //IL_0a4a: Unknown result type (might be due to invalid IL or missing references) //IL_0a4c: Unknown result type (might be due to invalid IL or missing references) //IL_0a53: Unknown result type (might be due to invalid IL or missing references) //IL_0a58: Unknown result type (might be due to invalid IL or missing references) //IL_0a68: Unknown result type (might be due to invalid IL or missing references) //IL_0a6d: Unknown result type (might be due to invalid IL or missing references) //IL_0a72: Unknown result type (might be due to invalid IL or missing references) //IL_0a76: Unknown result type (might be due to invalid IL or missing references) //IL_0a7b: Unknown result type (might be due to invalid IL or missing references) //IL_0a80: Unknown result type (might be due to invalid IL or missing references) //IL_0a82: Unknown result type (might be due to invalid IL or missing references) //IL_0a84: Unknown result type (might be due to invalid IL or missing references) //IL_0a8b: Unknown result type (might be due to invalid IL or missing references) //IL_0a92: Unknown result type (might be due to invalid IL or missing references) //IL_0a97: 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_0aa0: 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_0aac: Unknown result type (might be due to invalid IL or missing references) //IL_0ab3: Unknown result type (might be due to invalid IL or missing references) //IL_0ab8: Unknown result type (might be due to invalid IL or missing references) //IL_0abd: 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_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_0acd: Unknown result type (might be due to invalid IL or missing references) //IL_0ad2: Unknown result type (might be due to invalid IL or missing references) //IL_0936: Unknown result type (might be due to invalid IL or missing references) //IL_093b: Unknown result type (might be due to invalid IL or missing references) //IL_0940: 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_0979: Unknown result type (might be due to invalid IL or missing references) //IL_0600: 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_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0b6c: Unknown result type (might be due to invalid IL or missing references) //IL_0b6e: Unknown result type (might be due to invalid IL or missing references) //IL_0b73: Unknown result type (might be due to invalid IL or missing references) //IL_0b84: Unknown result type (might be due to invalid IL or missing references) //IL_0b89: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_099b: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_09a4: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09da: 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_0b97: Unknown result type (might be due to invalid IL or missing references) //IL_0b99: Unknown result type (might be due to invalid IL or missing references) //IL_0b93: Unknown result type (might be due to invalid IL or missing references) //IL_0b9e: Unknown result type (might be due to invalid IL or missing references) //IL_0ba0: Unknown result type (might be due to invalid IL or missing references) //IL_0ba2: Unknown result type (might be due to invalid IL or missing references) //IL_0ba7: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0bc0: Unknown result type (might be due to invalid IL or missing references) //IL_0bd4: Unknown result type (might be due to invalid IL or missing references) //IL_0bd9: Unknown result type (might be due to invalid IL or missing references) //IL_0c0c: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) //IL_0c34: Unknown result type (might be due to invalid IL or missing references) //IL_0c36: Unknown result type (might be due to invalid IL or missing references) //IL_0c39: Unknown result type (might be due to invalid IL or missing references) //IL_0c3b: Unknown result type (might be due to invalid IL or missing references) //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08ae: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08f3: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_0905: Unknown result type (might be due to invalid IL or missing references) //IL_090a: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Unknown result type (might be due to invalid IL or missing references) //IL_0912: Unknown result type (might be due to invalid IL or missing references) //IL_0916: 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_08e5: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_08eb: Unknown result type (might be due to invalid IL or missing references) //IL_0d09: Unknown result type (might be due to invalid IL or missing references) //IL_0d0b: Unknown result type (might be due to invalid IL or missing references) //IL_0c94: Unknown result type (might be due to invalid IL or missing references) //IL_0ca1: Unknown result type (might be due to invalid IL or missing references) //IL_0ca7: Unknown result type (might be due to invalid IL or missing references) //IL_0cac: Unknown result type (might be due to invalid IL or missing references) //IL_0cb1: Unknown result type (might be due to invalid IL or missing references) //IL_0cb6: Unknown result type (might be due to invalid IL or missing references) //IL_114b: Unknown result type (might be due to invalid IL or missing references) //IL_114d: Unknown result type (might be due to invalid IL or missing references) //IL_114f: Unknown result type (might be due to invalid IL or missing references) //IL_1154: Unknown result type (might be due to invalid IL or missing references) //IL_1156: Unknown result type (might be due to invalid IL or missing references) //IL_1158: Unknown result type (might be due to invalid IL or missing references) //IL_115a: Unknown result type (might be due to invalid IL or missing references) //IL_115f: Unknown result type (might be due to invalid IL or missing references) //IL_116c: Unknown result type (might be due to invalid IL or missing references) //IL_116e: Unknown result type (might be due to invalid IL or missing references) //IL_1170: Unknown result type (might be due to invalid IL or missing references) //IL_1172: Unknown result type (might be due to invalid IL or missing references) //IL_1177: Unknown result type (might be due to invalid IL or missing references) //IL_1179: Unknown result type (might be due to invalid IL or missing references) //IL_117e: Unknown result type (might be due to invalid IL or missing references) //IL_118b: Unknown result type (might be due to invalid IL or missing references) //IL_118d: Unknown result type (might be due to invalid IL or missing references) //IL_118f: Unknown result type (might be due to invalid IL or missing references) //IL_1191: Unknown result type (might be due to invalid IL or missing references) //IL_1196: Unknown result type (might be due to invalid IL or missing references) //IL_1198: Unknown result type (might be due to invalid IL or missing references) //IL_119d: Unknown result type (might be due to invalid IL or missing references) //IL_119f: Unknown result type (might be due to invalid IL or missing references) //IL_11a1: Unknown result type (might be due to invalid IL or missing references) //IL_11a8: Unknown result type (might be due to invalid IL or missing references) //IL_11ad: Unknown result type (might be due to invalid IL or missing references) //IL_11b4: Unknown result type (might be due to invalid IL or missing references) //IL_11b9: Unknown result type (might be due to invalid IL or missing references) //IL_11be: Unknown result type (might be due to invalid IL or missing references) //IL_11c5: Unknown result type (might be due to invalid IL or missing references) //IL_11ca: Unknown result type (might be due to invalid IL or missing references) //IL_11da: Unknown result type (might be due to invalid IL or missing references) //IL_11df: Unknown result type (might be due to invalid IL or missing references) //IL_11e4: Unknown result type (might be due to invalid IL or missing references) //IL_11e6: Unknown result type (might be due to invalid IL or missing references) //IL_11e8: Unknown result type (might be due to invalid IL or missing references) //IL_11ea: Unknown result type (might be due to invalid IL or missing references) //IL_11f4: Unknown result type (might be due to invalid IL or missing references) //IL_11f9: Unknown result type (might be due to invalid IL or missing references) //IL_1200: Unknown result type (might be due to invalid IL or missing references) //IL_1205: Unknown result type (might be due to invalid IL or missing references) //IL_120a: Unknown result type (might be due to invalid IL or missing references) //IL_1211: Unknown result type (might be due to invalid IL or missing references) //IL_1216: Unknown result type (might be due to invalid IL or missing references) //IL_1226: Unknown result type (might be due to invalid IL or missing references) //IL_122b: Unknown result type (might be due to invalid IL or missing references) //IL_1230: Unknown result type (might be due to invalid IL or missing references) //IL_1058: Unknown result type (might be due to invalid IL or missing references) //IL_105a: Unknown result type (might be due to invalid IL or missing references) //IL_105c: Unknown result type (might be due to invalid IL or missing references) //IL_105e: Unknown result type (might be due to invalid IL or missing references) //IL_1060: Unknown result type (might be due to invalid IL or missing references) //IL_1062: Unknown result type (might be due to invalid IL or missing references) //IL_1067: Unknown result type (might be due to invalid IL or missing references) //IL_1078: Unknown result type (might be due to invalid IL or missing references) //IL_107d: Unknown result type (might be due to invalid IL or missing references) //IL_1244: Unknown result type (might be due to invalid IL or missing references) //IL_1240: Unknown result type (might be due to invalid IL or missing references) //IL_108b: Unknown result type (might be due to invalid IL or missing references) //IL_108d: Unknown result type (might be due to invalid IL or missing references) //IL_1087: Unknown result type (might be due to invalid IL or missing references) //IL_0d1e: Unknown result type (might be due to invalid IL or missing references) //IL_0d20: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d2f: Unknown result type (might be due to invalid IL or missing references) //IL_0d31: Unknown result type (might be due to invalid IL or missing references) //IL_0d33: Unknown result type (might be due to invalid IL or missing references) //IL_0d38: Unknown result type (might be due to invalid IL or missing references) //IL_0d3a: 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_0d4c: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0d50: Unknown result type (might be due to invalid IL or missing references) //IL_0d52: Unknown result type (might be due to invalid IL or missing references) //IL_0d57: Unknown result type (might be due to invalid IL or missing references) //IL_0d59: Unknown result type (might be due to invalid IL or missing references) //IL_0d5e: Unknown result type (might be due to invalid IL or missing references) //IL_0d60: Unknown result type (might be due to invalid IL or missing references) //IL_0d68: 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_0d6c: Unknown result type (might be due to invalid IL or missing references) //IL_0d71: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Unknown result type (might be due to invalid IL or missing references) //IL_0d78: Unknown result type (might be due to invalid IL or missing references) //IL_0d7a: Unknown result type (might be due to invalid IL or missing references) //IL_0d7c: Unknown result type (might be due to invalid IL or missing references) //IL_0d81: Unknown result type (might be due to invalid IL or missing references) //IL_0d86: Unknown result type (might be due to invalid IL or missing references) //IL_0d8b: Unknown result type (might be due to invalid IL or missing references) //IL_0d8d: Unknown result type (might be due to invalid IL or missing references) //IL_0d95: Unknown result type (might be due to invalid IL or missing references) //IL_0d97: Unknown result type (might be due to invalid IL or missing references) //IL_0d99: Unknown result type (might be due to invalid IL or missing references) //IL_0d9e: Unknown result type (might be due to invalid IL or missing references) //IL_0da0: Unknown result type (might be due to invalid IL or missing references) //IL_0da5: Unknown result type (might be due to invalid IL or missing references) //IL_0da7: Unknown result type (might be due to invalid IL or missing references) //IL_0da9: Unknown result type (might be due to invalid IL or missing references) //IL_0dae: Unknown result type (might be due to invalid IL or missing references) //IL_0db3: Unknown result type (might be due to invalid IL or missing references) //IL_0db8: Unknown result type (might be due to invalid IL or missing references) //IL_0dc0: Unknown result type (might be due to invalid IL or missing references) //IL_0dc2: Unknown result type (might be due to invalid IL or missing references) //IL_0dcc: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Unknown result type (might be due to invalid IL or missing references) //IL_0dd3: Unknown result type (might be due to invalid IL or missing references) //IL_0dd5: Unknown result type (might be due to invalid IL or missing references) //IL_0dd7: 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_0dfc: Unknown result type (might be due to invalid IL or missing references) //IL_0dfe: Unknown result type (might be due to invalid IL or missing references) //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e02: Unknown result type (might be due to invalid IL or missing references) //IL_0e04: Unknown result type (might be due to invalid IL or missing references) //IL_0e06: Unknown result type (might be due to invalid IL or missing references) //IL_0e08: Unknown result type (might be due to invalid IL or missing references) //IL_0e0a: Unknown result type (might be due to invalid IL or missing references) //IL_0e0e: Unknown result type (might be due to invalid IL or missing references) //IL_0cd1: Unknown result type (might be due to invalid IL or missing references) //IL_0cde: Unknown result type (might be due to invalid IL or missing references) //IL_0ce4: Unknown result type (might be due to invalid IL or missing references) //IL_0ce9: Unknown result type (might be due to invalid IL or missing references) //IL_0cfc: Unknown result type (might be due to invalid IL or missing references) //IL_0d01: Unknown result type (might be due to invalid IL or missing references) //IL_0d06: Unknown result type (might be due to invalid IL or missing references) //IL_1246: Unknown result type (might be due to invalid IL or missing references) //IL_1248: Unknown result type (might be due to invalid IL or missing references) //IL_1092: Unknown result type (might be due to invalid IL or missing references) //IL_1094: Unknown result type (might be due to invalid IL or missing references) //IL_1096: Unknown result type (might be due to invalid IL or missing references) //IL_109b: Unknown result type (might be due to invalid IL or missing references) //IL_1272: Unknown result type (might be due to invalid IL or missing references) //IL_126e: Unknown result type (might be due to invalid IL or missing references) //IL_1274: Unknown result type (might be due to invalid IL or missing references) //IL_1276: Unknown result type (might be due to invalid IL or missing references) //IL_12b5: Unknown result type (might be due to invalid IL or missing references) //IL_12b7: Unknown result type (might be due to invalid IL or missing references) //IL_12b9: Unknown result type (might be due to invalid IL or missing references) //IL_12be: Unknown result type (might be due to invalid IL or missing references) //IL_12c5: Unknown result type (might be due to invalid IL or missing references) //IL_12ca: Unknown result type (might be due to invalid IL or missing references) //IL_12cf: Unknown result type (might be due to invalid IL or missing references) //IL_12d7: Unknown result type (might be due to invalid IL or missing references) //IL_12e5: Unknown result type (might be due to invalid IL or missing references) //IL_12ea: Unknown result type (might be due to invalid IL or missing references) //IL_12f7: Unknown result type (might be due to invalid IL or missing references) //IL_12f9: Unknown result type (might be due to invalid IL or missing references) //IL_12fb: Unknown result type (might be due to invalid IL or missing references) //IL_1300: Unknown result type (might be due to invalid IL or missing references) //IL_131c: Unknown result type (might be due to invalid IL or missing references) //IL_1330: Unknown result type (might be due to invalid IL or missing references) //IL_1335: Unknown result type (might be due to invalid IL or missing references) //IL_133a: Unknown result type (might be due to invalid IL or missing references) //IL_1341: Unknown result type (might be due to invalid IL or missing references) //IL_1355: Unknown result type (might be due to invalid IL or missing references) //IL_135a: Unknown result type (might be due to invalid IL or missing references) //IL_135f: Unknown result type (might be due to invalid IL or missing references) //IL_10b0: Unknown result type (might be due to invalid IL or missing references) //IL_10b2: Unknown result type (might be due to invalid IL or missing references) //IL_10b4: Unknown result type (might be due to invalid IL or missing references) //IL_10b6: Unknown result type (might be due to invalid IL or missing references) //IL_10bb: Unknown result type (might be due to invalid IL or missing references) //IL_10bd: Unknown result type (might be due to invalid IL or missing references) //IL_10c2: Unknown result type (might be due to invalid IL or missing references) //IL_10cf: Unknown result type (might be due to invalid IL or missing references) //IL_10d1: Unknown result type (might be due to invalid IL or missing references) //IL_10d3: Unknown result type (might be due to invalid IL or missing references) //IL_10d5: Unknown result type (might be due to invalid IL or missing references) //IL_10da: Unknown result type (might be due to invalid IL or missing references) //IL_10dc: Unknown result type (might be due to invalid IL or missing references) //IL_10e1: Unknown result type (might be due to invalid IL or missing references) //IL_10e3: Unknown result type (might be due to invalid IL or missing references) //IL_10eb: Unknown result type (might be due to invalid IL or missing references) //IL_10ed: Unknown result type (might be due to invalid IL or missing references) //IL_10ef: Unknown result type (might be due to invalid IL or missing references) //IL_10f4: Unknown result type (might be due to invalid IL or missing references) //IL_10f6: Unknown result type (might be due to invalid IL or missing references) //IL_10fb: Unknown result type (might be due to invalid IL or missing references) //IL_10fd: Unknown result type (might be due to invalid IL or missing references) //IL_10ff: Unknown result type (might be due to invalid IL or missing references) //IL_1104: Unknown result type (might be due to invalid IL or missing references) //IL_1109: Unknown result type (might be due to invalid IL or missing references) //IL_110e: Unknown result type (might be due to invalid IL or missing references) //IL_1110: Unknown result type (might be due to invalid IL or missing references) //IL_1118: Unknown result type (might be due to invalid IL or missing references) //IL_111a: Unknown result type (might be due to invalid IL or missing references) //IL_111c: Unknown result type (might be due to invalid IL or missing references) //IL_1121: Unknown result type (might be due to invalid IL or missing references) //IL_1123: Unknown result type (might be due to invalid IL or missing references) //IL_1128: Unknown result type (might be due to invalid IL or missing references) //IL_112a: Unknown result type (might be due to invalid IL or missing references) //IL_112c: Unknown result type (might be due to invalid IL or missing references) //IL_1131: Unknown result type (might be due to invalid IL or missing references) //IL_1136: Unknown result type (might be due to invalid IL or missing references) //IL_113b: Unknown result type (might be due to invalid IL or missing references) //IL_1393: Unknown result type (might be due to invalid IL or missing references) //IL_138f: Unknown result type (might be due to invalid IL or missing references) //IL_0e36: Unknown result type (might be due to invalid IL or missing references) //IL_0e38: Unknown result type (might be due to invalid IL or missing references) //IL_139b: Unknown result type (might be due to invalid IL or missing references) //IL_13bc: Unknown result type (might be due to invalid IL or missing references) //IL_13b8: Unknown result type (might be due to invalid IL or missing references) //IL_13c4: Unknown result type (might be due to invalid IL or missing references) //IL_13d5: Unknown result type (might be due to invalid IL or missing references) //IL_13e6: Unknown result type (might be due to invalid IL or missing references) //IL_13e2: Unknown result type (might be due to invalid IL or missing references) //IL_13f3: Unknown result type (might be due to invalid IL or missing references) //IL_1029: Unknown result type (might be due to invalid IL or missing references) //IL_102b: Unknown result type (might be due to invalid IL or missing references) //IL_1404: Unknown result type (might be due to invalid IL or missing references) //IL_1400: Unknown result type (might be due to invalid IL or missing references) //IL_0e8d: Unknown result type (might be due to invalid IL or missing references) //IL_0e96: Unknown result type (might be due to invalid IL or missing references) //IL_0e9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ea6: Unknown result type (might be due to invalid IL or missing references) //IL_0eab: Unknown result type (might be due to invalid IL or missing references) //IL_0eb0: Unknown result type (might be due to invalid IL or missing references) //IL_0eba: Unknown result type (might be due to invalid IL or missing references) //IL_0ebf: Unknown result type (might be due to invalid IL or missing references) //IL_0ec4: Unknown result type (might be due to invalid IL or missing references) //IL_0ec8: Unknown result type (might be due to invalid IL or missing references) //IL_0ecd: Unknown result type (might be due to invalid IL or missing references) //IL_0ecf: Unknown result type (might be due to invalid IL or missing references) //IL_0ed1: Unknown result type (might be due to invalid IL or missing references) //IL_0ed5: Unknown result type (might be due to invalid IL or missing references) //IL_0eda: Unknown result type (might be due to invalid IL or missing references) //IL_0edf: Unknown result type (might be due to invalid IL or missing references) //IL_1441: Unknown result type (might be due to invalid IL or missing references) //IL_144c: Unknown result type (might be due to invalid IL or missing references) //IL_1451: Unknown result type (might be due to invalid IL or missing references) //IL_1424: Unknown result type (might be due to invalid IL or missing references) //IL_142f: Unknown result type (might be due to invalid IL or missing references) //IL_1434: Unknown result type (might be due to invalid IL or missing references) //IL_0ee9: Unknown result type (might be due to invalid IL or missing references) //IL_0eeb: Unknown result type (might be due to invalid IL or missing references) //IL_0ef8: Unknown result type (might be due to invalid IL or missing references) //IL_0efa: Unknown result type (might be due to invalid IL or missing references) //IL_0efc: Unknown result type (might be due to invalid IL or missing references) //IL_0efe: Unknown result type (might be due to invalid IL or missing references) //IL_0f03: Unknown result type (might be due to invalid IL or missing references) //IL_0f05: Unknown result type (might be due to invalid IL or missing references) //IL_0f0a: Unknown result type (might be due to invalid IL or missing references) //IL_0f17: Unknown result type (might be due to invalid IL or missing references) //IL_0f19: Unknown result type (might be due to invalid IL or missing references) //IL_0f1b: Unknown result type (might be due to invalid IL or missing references) //IL_0f1d: Unknown result type (might be due to invalid IL or missing references) //IL_0f22: Unknown result type (might be due to invalid IL or missing references) //IL_0f24: Unknown result type (might be due to invalid IL or missing references) //IL_0f29: Unknown result type (might be due to invalid IL or missing references) //IL_0f2b: Unknown result type (might be due to invalid IL or missing references) //IL_0f33: Unknown result type (might be due to invalid IL or missing references) //IL_0f35: Unknown result type (might be due to invalid IL or missing references) //IL_0f37: Unknown result type (might be due to invalid IL or missing references) //IL_0f3c: Unknown result type (might be due to invalid IL or missing references) //IL_0f3e: Unknown result type (might be due to invalid IL or missing references) //IL_0f43: Unknown result type (might be due to invalid IL or missing references) //IL_0f45: Unknown result type (might be due to invalid IL or missing references) //IL_0f47: Unknown result type (might be due to invalid IL or missing references) //IL_0f4c: Unknown result type (might be due to invalid IL or missing references) //IL_0f51: Unknown result type (might be due to invalid IL or missing references) //IL_0f56: Unknown result type (might be due to invalid IL or missing references) //IL_0f58: Unknown result type (might be due to invalid IL or missing references) //IL_0f60: Unknown result type (might be due to invalid IL or missing references) //IL_0f62: Unknown result type (might be due to invalid IL or missing references) //IL_0f64: Unknown result type (might be due to invalid IL or missing references) //IL_0f69: Unknown result type (might be due to invalid IL or missing references) //IL_0f6b: Unknown result type (might be due to invalid IL or missing references) //IL_0f70: Unknown result type (might be due to invalid IL or missing references) //IL_0f72: Unknown result type (might be due to invalid IL or missing references) //IL_0f74: Unknown result type (might be due to invalid IL or missing references) //IL_0f79: Unknown result type (might be due to invalid IL or missing references) //IL_0f7e: Unknown result type (might be due to invalid IL or missing references) //IL_0f83: Unknown result type (might be due to invalid IL or missing references) //IL_0f8b: Unknown result type (might be due to invalid IL or missing references) //IL_0f8d: Unknown result type (might be due to invalid IL or missing references) //IL_0f97: Unknown result type (might be due to invalid IL or missing references) //IL_0f9c: Unknown result type (might be due to invalid IL or missing references) //IL_0f9e: Unknown result type (might be due to invalid IL or missing references) //IL_0fa0: Unknown result type (might be due to invalid IL or missing references) //IL_0fa2: Unknown result type (might be due to invalid IL or missing references) //IL_0fa7: Unknown result type (might be due to invalid IL or missing references) //IL_0fc6: Unknown result type (might be due to invalid IL or missing references) //IL_0fc9: Unknown result type (might be due to invalid IL or missing references) //IL_145c: Unknown result type (might be due to invalid IL or missing references) //IL_1477: Unknown result type (might be due to invalid IL or missing references) //IL_1482: Unknown result type (might be due to invalid IL or missing references) //IL_1497: Unknown result type (might be due to invalid IL or missing references) //IL_14a2: Unknown result type (might be due to invalid IL or missing references) //IL_14bd: Unknown result type (might be due to invalid IL or missing references) //IL_14bf: Unknown result type (might be due to invalid IL or missing references) //IL_14de: Unknown result type (might be due to invalid IL or missing references) //IL_14fa: Unknown result type (might be due to invalid IL or missing references) //IL_14ff: Unknown result type (might be due to invalid IL or missing references) //IL_1516: Unknown result type (might be due to invalid IL or missing references) //IL_151b: Unknown result type (might be due to invalid IL or missing references) //IL_151e: Unknown result type (might be due to invalid IL or missing references) //IL_1520: Unknown result type (might be due to invalid IL or missing references) //IL_1522: Unknown result type (might be due to invalid IL or missing references) //IL_152c: Unknown result type (might be due to invalid IL or missing references) //IL_0fe0: Unknown result type (might be due to invalid IL or missing references) //IL_0fe2: Unknown result type (might be due to invalid IL or missing references) //IL_0fe4: Unknown result type (might be due to invalid IL or missing references) //IL_0fe6: Unknown result type (might be due to invalid IL or missing references) //IL_0fe8: Unknown result type (might be due to invalid IL or missing references) //IL_0fea: Unknown result type (might be due to invalid IL or missing references) //IL_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_0fee: Unknown result type (might be due to invalid IL or missing references) //IL_0ff2: Unknown result type (might be due to invalid IL or missing references) //IL_1010: Unknown result type (might be due to invalid IL or missing references) //IL_1012: 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; } bool flag = elapsed >= 0.0 && elapsed < 0.9; float num = ((Rebounded && !Preparing) ? Motion.Rebound(elapsed, impactAge, reboundAnchorAge) : 0f); double num2 = (Rebounded ? Math.Min(elapsed, impactAge) : elapsed); if (Rebounded && elapsed >= impactAge + 0.4) { flag = false; } float num3 = (flag ? Mathf.Max(Motion.Recovery(num2), num) : 1f); float num4 = (Preparing ? Motion.Smooth((float)(PreparationAge(now) / 0.18)) : (flag ? ((Chained ? 1f : Motion.Smooth((float)(elapsed / 0.16))) * (1f - num3)) : 0f)); float num5 = (flag ? Motion.Frame(Reverse ? Math.Max(0.0, 0.57 - num2) : num2) : 0f); int num6 = Mathf.FloorToInt(num5); int num7 = Mathf.Min(num6 + 1, assets.Samples - 1); float num8 = 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[num6][j], array[num7][j], num5 - (float)num6) * Quaternion.Inverse(array[0][j]); Quaternion localRotation = rig.TorsoBones[j].localRotation; rig.TorsoBones[j].localRotation = Quaternion.Slerp(localRotation, val * localRotation, num4 * 0.12f * num8); } applied = true; float num9 = ((!LeftHanded) ? 1 : (-1)); Vector3 up = ((Component)animator).transform.up; Vector3 forward = ((Component)animator).transform.forward; Vector3 right = ((Component)animator).transform.right; BodyTurn = ((!flag) ? 0f : (Rebounded ? (reboundTurn * (1f - num)) : ((0f - Motion.Turn(num2, Reverse, Chained)) * num9 * num8))); if (Overhead && flag && !Rebounded) { BodyTurn = 0f; } if (Preparing) { BodyTurn = 18f * num9 * Motion.Smooth((float)(PreparationAge(now) / 0.18)) * (1f - Motion.Smooth((float)((PreparationAge(now) - 0.18) / 0.24))); } double num10 = Motion.Wind(Overhead); if (flag && !Rebounded && hasEntry && elapsed < num10) { BodyTurn = Mathf.Lerp(entryTurn, BodyTurn, Motion.Smooth((float)(elapsed / num10))); } float num11 = (flag ? (Mathf.Sin(Mathf.Clamp01((float)(elapsed / 0.57)) * (float)Math.PI) * (1f - num3) * num8) : 0f); for (int k = 0; k < rig.TorsoBones.Length; k++) { float num12 = k switch { 1 => 0.45f, 0 => 0.3f, _ => 0.25f, }; Transform val2 = rig.TorsoBones[k]; val2.rotation = Quaternion.AngleAxis(BodyTurn * num12, up) * Quaternion.AngleAxis((float)(Overhead ? 18 : (LowBall ? 40 : 10)) * num11 * num12, right) * Quaternion.AngleAxis((0f - BodyTurn) * 0.12f * num12, forward) * val2.rotation; if (Rebounded) { val2.rotation = Quaternion.AngleAxis((float)(-(SoftImpact ? 3 : 7)) * Mathf.Sin(Mathf.Clamp01((float)((elapsed - impactAge - 0.045) / 0.18)) * (float)Math.PI) * num12, right) * 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, num4); float num13 = 15f + 25f * num4; val3.rotation = Quaternion.AngleAxis(flag2 ? num13 : (0f - num13), up) * val3.rotation; float num14 = (Preparing ? Motion.Smooth((float)((PreparationAge(now) - 0.18) / 0.24)) : ((Overhead && flag) ? (1f - Motion.Smooth((float)((elapsed - 0.12) / 0.3))) : 0f)); val3.rotation = Quaternion.AngleAxis((float)(flag2 ? (-25) : 25) * num14, forward) * val3.rotation; } if (constrained && hasPrevious) { for (int m = 0; m < rig.TorsoBones.Length; m++) { rig.TorsoBones[m].localRotation = safeUpper[m]; } rig.Mapped[(HumanBodyBones)12].localRotation = safeUpper[3]; rig.Mapped[(HumanBodyBones)11].localRotation = safeUpper[4]; BodyTurn = safeTurn; } else if (flag && !Rebounded && hasEntry && elapsed < num10) { float num15 = Motion.Smooth((float)(elapsed / num10)); for (int n = 0; n < rig.TorsoBones.Length; n++) { rig.TorsoBones[n].localRotation = Quaternion.Slerp(entryUpper[n], rig.TorsoBones[n].localRotation, num15); } Transform val5 = rig.Mapped[(HumanBodyBones)12]; Transform val6 = rig.Mapped[(HumanBodyBones)11]; val5.localRotation = Quaternion.Slerp(entryUpper[3], val5.localRotation, num15); val6.localRotation = Quaternion.Slerp(entryUpper[4], val6.localRotation, num15); } float num16 = Mathf.Sin((float)now * 1.8f) * 0.006f; BatPath.Sample(flag ? elapsed : (-1.0), out var center, out var axis, Reverse, Chained, Overhead, LowBall); if (Preparing) { BatPath.Prepare(PreparationAge(now), out center, out axis); } else if (!flag && Flourishing(now)) { BatPath.Equip(now - createdAt, ref center, ref axis); } if (flag && !Rebounded && hasEntry && elapsed < num10) { BatPath.Sample(num10, out var center2, out var axis2, Reverse, Chained, Overhead, LowBall); float num17 = ((((Vector3)(ref entryNormal)).sqrMagnitude > 0.5f) ? 0.08f : 0f); Vector3 val7 = entryPath + entryNormal * 0.1f; float num18 = Motion.Smooth((float)((elapsed - (double)num17) / (num10 - (double)num17))); center = ((elapsed < (double)num17) ? Vector3.Lerp(entryPath, val7, Motion.Smooth((float)(elapsed / (double)num17))) : Vector3.Lerp((num17 > 0f) ? val7 : entryPath, center2, num18)); axis = Vector3.Slerp(entryAxis, axis2, num18); } if (Rebounded && flag) { Vector3 val8 = ((Component)animator).transform.InverseTransformDirection(ImpactNormal); val8.x *= num9; float num19 = Motion.Smooth((float)((elapsed - impactAge - 0.045) / 0.16)); center = ReboundPath + val8 * (SoftImpact ? 0.055f : 0.105f) * num19; center.y = Mathf.Lerp(center.y, -0.1f, num); center.z -= 0.045f * num19; axis = Vector3.Slerp(ReboundAxis, Vector3.up, num); } Vector3 val9 = (rig.Mapped[(HumanBodyBones)14].position + rig.Mapped[(HumanBodyBones)13].position) * 0.5f; Vector3 val10 = val9 + (right * center.x * num9 + up * center.y + forward * center.z) * rig.Height + up * num16; Quaternion val11 = Along(right * axis.x * num9 + 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 num20 = -0.13f * Length + (LeftHanded ? rig.RightPose.Width : rig.LeftPose.Width) * 0.5f + Thickness * 0.007f + GripSpan * 0.5f; Vector3 val12 = val11 * Vector3.up * (GripSpan * 0.5f); Vector3 val13 = (LeftHanded ? (-val12) : val12); Vector3 val14 = -val13; Vector3 position = rig.Mapped[(HumanBodyBones)14].position; Vector3 position2 = rig.Mapped[(HumanBodyBones)13].position; body.Update(Thickness); float num21 = Mathf.Clamp((float)(now - previousPoseTime), 0.004166667f, 0.1f); rightGrip.Prepare(up, 1f - num4, num21); leftGrip.Prepare(up, 1f - num4, num21); Vector3 requested = (currentRequested = val10); bool flag3 = !flag && !Preparing && !Flourishing(now); continuityWeight = ((!flag3) ? ((hasSwingCorrection && !Rebounded) ? 3 : 0) : (hasCarryOffset ? 10 : 0)); if (flag3 && hasCarryOffset) { val10 = val9 + ((Component)animator).transform.rotation * carryOffset; } else if (!flag3 && !constrained && hasSwingCorrection && !Rebounded) { val10 += ((Component)animator).transform.rotation * swingCorrection * Mathf.Exp((0f - num21) * 10f); } fitAnchor = val10; if (!constrained) { Vector3 val16; for (int num22 = 0; num22 < 32; num22++) { Vector3 val15 = val10; identity = rig.RightPose.Wrist(val11, val10 + val13, position); identity2 = rig.LeftPose.Wrist(val11, val10 + val14, position2); val10 += rightGrip.Reachable(val10 + val13, identity) - (val10 + val13); val10 += leftGrip.Reachable(val10 + val14, identity2) - (val10 + val14); val10 = body.Push(val10, val11, Length, num20); val16 = val10 - val15; if (((Vector3)(ref val16)).sqrMagnitude < 1E-10f) { break; } } float num23 = ArmScore(val10, val11, val13, val14, position, position2, requested, right * num9, 1f - num4); if (num23 < -0.001f) { for (int num24 = 0; num24 < 7; num24++) { if (!(num23 < -0.001f)) { break; } Vector3 val17 = val10; float num25 = num23; float num26 = rig.Height * ((!flag3 || !hasCarryOffset) ? ((num24 < 4) ? 0.025f : 0.006f) : ((num24 < 4) ? 0.001f : 0.00025f)); for (int num27 = 0; num27 < 27; num27++) { if (num27 == 13) { continue; } val16 = right * (float)(num27 % 3 - 1) + up * (float)(num27 / 3 % 3 - 1) + forward * (float)(num27 / 9 - 1); Vector3 normalized = ((Vector3)(ref val16)).normalized; Vector3 val18 = val10 + normalized * num26; for (int num28 = 0; num28 < 12; num28++) { Vector3 val19 = val18; Quaternion wrist = rig.RightPose.Wrist(val11, val18 + val13, position); Quaternion wrist2 = rig.LeftPose.Wrist(val11, val18 + val14, position2); val18 += rightGrip.Reachable(val18 + val13, wrist) - (val18 + val13); val18 += leftGrip.Reachable(val18 + val14, wrist2) - (val18 + val14); val18 = body.Push(val18, val11, Length, num20); val16 = val18 - val19; if (((Vector3)(ref val16)).sqrMagnitude < 1E-10f) { break; } } if (!((0f - Vector3.Distance(val18, fitAnchor)) * continuityWeight <= num25)) { float num29 = ArmScore(val18, val11, val13, val14, position, position2, requested, right * num9, 1f - num4); if (num29 > num25) { num25 = num29; val17 = val18; } } } bool num30 = num25 > num23; val10 = val17; num23 = num25; if (!num30) { if (num24 >= 4) { break; } num24 = 3; } } } } if (constrained) { val10 = fixedCenter; val11 = fixedRotation; val12 = val11 * Vector3.up * (GripSpan * 0.5f); val13 = (LeftHanded ? (-val12) : val12); val14 = -val13; for (int num31 = 0; num31 < 4; num31++) { identity = rig.RightPose.Wrist(val11, val10 + val13, position); identity2 = rig.LeftPose.Wrist(val11, val10 + val14, position2); val10 += rightGrip.Reachable(val10 + val13, identity) - (val10 + val13); val10 += leftGrip.Reachable(val10 + val14, identity2) - (val10 + val14); } } Vector3 val20 = val10 - val12; Vector3 val21 = val10 + val12; identity = rig.RightPose.Wrist(val11, val10 + val13, position); identity2 = rig.LeftPose.Wrist(val11, val10 + val14, 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 ? val20 : val21, identity, pole, body, body.RightArmRadius); leftGrip.Solve(LeftHanded ? val21 : val20, identity2, pole2, body, body.LeftArmRadius); ArmClearance = Mathf.Min(rightGrip.ArmClearance, leftGrip.ArmClearance); bat.SetPositionAndRotation(val10 - val11 * Vector3.up * num20, val11); GripCenter = val10; CarryForward = Vector3.Dot(bat.up, forward); CarrySide = Vector3.Dot(val10 - val9, right) * num9 / 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 ? val20 : val21, bat.up); rig.LeftPose.Fingers(LeftHanded ? val21 : val20, bat.up); GripError = Mathf.Max(Vector3.Distance(rightGrip.Palm, LeftHanded ? val20 : val21), Vector3.Distance(leftGrip.Palm, LeftHanded ? val21 : val20)); 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(val10, val11, Length, num20); ((Component)swingAudio).transform.position = val10; Vector3 val22 = bat.TransformPoint(0f, 0.84f, 0f); Vector3 val23 = bat.TransformPoint(0f, 0.12f, 0f); Center = (val22 + val23) * 0.5f; } 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); } public void Dispose() { if (disposed) { return; } disposed = true; Restore(); if (tape != null) { tape.Dispose(); } if (trail != null) { trail.Dispose(); } SFXManager val = Object.FindFirstObjectByType<SFXManager>(); AudioSource[] array = (AudioSource[])(object)new AudioSource[2] { swingAudio, hitAudio }; foreach (AudioSource val2 in array) { if (Object.op_Implicit((Object)(object)val) && val2 != null) { val.RemovePlayerAudio(val2); } if (Object.op_Implicit((Object)(object)val2)) { Object.Destroy((Object)(object)((Component)val2).gameObject); } } if (Object.op_Implicit((Object)(object)meshObject)) { meshObject.SetActive(false); Object.Destroy((Object)(object)meshObject); } if (materials == null) { return; } Material[] array2 = materials; foreach (Material val3 in array2) { if (Object.op_Implicit((Object)(object)val3)) { Object.Destroy((Object)(object)val3); } } } internal void NativeBallContact(Collider collider, double now) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) double num = now - started; if (Alive && Local && !hit && Object.op_Implicit((Object)(object)collider) && !(num < 0.0) && !(num >= 0.9)) { PoseTime = now; hit = true; ImpactNormal = -((Component)animator).transform.forward; SetRebound((int)(num * 1000.0), RelativePath(), RelativeAxis()); Vector3 position = ((Component)collider).transform.position; Contact(position); if (this.OnHit != null) { this.OnHit(position, arg2: false); } if (this.OnImpact != null) { this.OnImpact(new BatImpact { Collider = collider, Point = position, Normal = ImpactNormal }, null); } } } public void Pose(double now) { //IL_0099: 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_00a3: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or mi