Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of First Person View v2.1.0
BepInEx/plugins/FirstPersonView/FirstPersonView.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.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using TooManyEmotes; using TooManyEmotes.Networking; using TooManyEmotes.Patches; using Unity.Netcode; using UnityEngine; using UnityEngine.Animations.Rigging; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FirstPersonView")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Lets players see their own body.")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+914e93eb53677854db4220d032ca7102801e3919")] [assembly: AssemblyProduct("FirstPersonView")] [assembly: AssemblyTitle("FirstPersonView")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FirstPersonView { internal static class BodyBack { private static Transform? bone; private static Camera? owner; private static Vector3 saved; private static Vector3 written; public static float GetAmount(float full, float travel) { return Mathf.Max(0f, full - travel); } public static void Apply(Transform? hips, Camera? camera, Vector3 direction, float distance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_005c: 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_0068: Unknown result type (might be due to invalid IL or missing references) Restore(); if (!((Object)(object)hips == (Object)null) && distance > 0f) { Vector3 val = hips.position - direction * distance; float f = val.x + val.y + val.z; if (!float.IsNaN(f) && !float.IsInfinity(f)) { saved = hips.localPosition; hips.position = val; written = hips.localPosition; bone = hips; owner = camera; } } } public static void RestoreAfter(List<Camera> cameras) { if (!((Object)(object)bone == (Object)null) && (!((Object)(object)owner != (Object)null) || !((Behaviour)owner).isActiveAndEnabled || cameras.Contains(owner))) { Restore(); } } public static void Restore() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Transform val = bone; bone = null; owner = null; if (!((Object)(object)val == (Object)null) && !(val.localPosition != written)) { val.localPosition = saved; } } } internal sealed class ClearancePoint { public Transform[] Bones = Array.Empty<Transform>(); public Vector3[] Locals = Array.Empty<Vector3>(); public float[] Weights = Array.Empty<float>(); public int[] Slots = Array.Empty<int>(); public Vector3 GetPosition() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; for (int i = 0; i < Bones.Length; i++) { val += Bones[i].TransformPoint(Locals[i]) * Weights[i]; } return val; } public Vector3 GetPosition(Matrix4x4[] matrices) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; for (int i = 0; i < Slots.Length; i++) { val += ((Matrix4x4)(ref matrices[Slots[i]])).MultiplyPoint3x4(Locals[i]) * Weights[i]; } return val; } } internal static class BodyClearance { private const int EdgeSteps = 10; private const int FaceSteps = 5; private static readonly int[] RimVertices = new int[10] { 960, 965, 969, 1007, 1009, 1035, 1194, 5254, 6430, 7321 }; private static readonly (int A, int B)[] RimEdges = new(int, int)[8] { (960, 968), (968, 1011), (969, 1018), (1008, 1011), (1009, 1011), (1035, 1036), (5254, 5255), (7059, 7061) }; private static readonly (int A, int B, int C)[] RimFaces = new(int, int, int)[3] { (968, 974, 1011), (1008, 1009, 1011), (6906, 6908, 6909) }; private static readonly (int Vertex, float Weight)[][] Points = CreateBlends(); private static readonly float[] FallbackPitch = new float[10] { 0f, 10f, 20f, 30f, 40f, 50f, 60f, 70f, 75f, 80f }; private static readonly float[] FallbackNeed = new float[10] { 0f, 0f, 0.01f, 0.086f, 0.159f, 0.255f, 0.365f, 0.483f, 0.55f, 0.623f }; private static (int Vertex, float Weight)[][] CreateBlends() { List<(int, float)[]> list = new List<(int, float)[]>(); int[] rimVertices = RimVertices; foreach (int item in rimVertices) { list.Add(new(int, float)[1] { (item, 1f) }); } for (int j = 1; j < 10; j++) { float num = (float)j / 10f; (int, int)[] rimEdges = RimEdges; for (int k = 0; k < rimEdges.Length; k++) { var (item2, item3) = rimEdges[k]; list.Add(new(int, float)[2] { (item2, 1f - num), (item3, num) }); } } for (int l = 1; l < 4; l++) { for (int m = 1; l + m < 5; m++) { float num2 = (float)l / 5f; float num3 = (float)m / 5f; (int, int, int)[] rimFaces = RimFaces; for (int n = 0; n < rimFaces.Length; n++) { var (item4, item5, item6) = rimFaces[n]; list.Add(new(int, float)[3] { (item4, num2), (item5, num3), (item6, 1f - num2 - num3) }); } } } return list.ToArray(); } public static NeedView CreateView(Camera camera, float pitch, float yaw) { float margin = 0.5f + ConfigManager.LookDownMargin.Value; return new NeedView(pitch, yaw, camera.fieldOfView, camera.aspect, camera.nearClipPlane, margin); } public static bool GetOffsets(LocalBodyState state, Vector3 reference, Transform container, List<Vector3> offsets) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0099: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) offsets.Clear(); ClearancePoint[] points = GetPoints(state); if (points == null) { return false; } ClearanceState clearance = state.Clearance; Transform[] bones = clearance.Bones; Matrix4x4[] matrices = clearance.Matrices; for (int i = 0; i < bones.Length; i++) { if ((Object)(object)bones[i] == (Object)null) { return false; } matrices[i] = bones[i].localToWorldMatrix; } Vector3 right = container.right; Vector3 up = container.up; Vector3 forward = container.forward; ClearancePoint[] array = points; foreach (ClearancePoint clearancePoint in array) { Vector3 val = clearancePoint.GetPosition(matrices) - reference; offsets.Add(new Vector3(Vector3.Dot(val, right), Vector3.Dot(val, up), Vector3.Dot(val, forward))); } return true; } public static float GetNeed(List<Vector3> offsets, in NeedView view) { return view.GetNeed(offsets); } public static float GetFallback(float pitch) { if (pitch <= FallbackPitch[0]) { return FallbackNeed[0]; } for (int i = 1; i < FallbackPitch.Length; i++) { if (pitch <= FallbackPitch[i]) { float num = Mathf.InverseLerp(FallbackPitch[i - 1], FallbackPitch[i], pitch); return Mathf.Lerp(FallbackNeed[i - 1], FallbackNeed[i], num); } } return FallbackNeed[FallbackNeed.Length - 1]; } private static ClearancePoint[]? GetPoints(LocalBodyState state) { ClearanceState clearance = state.Clearance; Mesh originalBodyMesh = state.OriginalBodyMesh; SkinnedMeshRenderer bodyRenderer = state.BodyRenderer; if ((Object)(object)originalBodyMesh == (Object)null || (Object)(object)bodyRenderer == (Object)null) { return null; } if (clearance.Source != originalBodyMesh || clearance.Body != bodyRenderer) { clearance.Source = originalBodyMesh; clearance.Body = bodyRenderer; clearance.Points = null; clearance.Version++; clearance.Points = CreatePoints(originalBodyMesh, bodyRenderer); SetSlots(clearance); } return clearance.Points; } private static void SetSlots(ClearanceState clearance) { List<Transform> list = new List<Transform>(); ClearancePoint[] array = clearance.Points ?? Array.Empty<ClearancePoint>(); foreach (ClearancePoint clearancePoint in array) { clearancePoint.Slots = new int[clearancePoint.Bones.Length]; for (int j = 0; j < clearancePoint.Bones.Length; j++) { int num = list.IndexOf(clearancePoint.Bones[j]); if (num < 0) { num = list.Count; list.Add(clearancePoint.Bones[j]); } clearancePoint.Slots[j] = num; } } clearance.Bones = list.ToArray(); clearance.Matrices = (Matrix4x4[])(object)new Matrix4x4[list.Count]; } private static ClearancePoint[]? CreatePoints(Mesh mesh, SkinnedMeshRenderer body) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (mesh.vertexCount != 7998) { return null; } Mesh readable = MeshSurgery.GetReadable(mesh); if ((Object)(object)readable == (Object)null) { return null; } Vector3[] vertices = readable.vertices; BoneWeight[] boneWeights = readable.boneWeights; Matrix4x4[] bindposes = readable.bindposes; Transform[] bones = body.bones; if (vertices.Length != 7998 || boneWeights.Length != vertices.Length) { return null; } List<Transform> pointBones = new List<Transform>(); List<Vector3> locals = new List<Vector3>(); List<float> pointWeights = new List<float>(); int[] array = new int[4]; float[] array2 = new float[4]; ClearancePoint[] array3 = new ClearancePoint[Points.Length]; for (int i = 0; i < array3.Length; i++) { pointBones.Clear(); locals.Clear(); pointWeights.Clear(); (int, float)[] array4 = Points[i]; for (int j = 0; j < array4.Length; j++) { var (num, num2) = array4[j]; if (num < 0 || num >= vertices.Length) { return null; } int shares = SkinBones.GetShares(boneWeights[num], array, array2); if (shares == 0) { return null; } Vector3 position = vertices[num]; for (int k = 0; k < shares; k++) { if (!AddBone(array[k], num2 * array2[k], position)) { return null; } } } float num3 = 0f; foreach (float item in pointWeights) { num3 += item; } if (!(num3 > 0f)) { return null; } float[] array5 = pointWeights.ToArray(); for (int l = 0; l < array5.Length; l++) { array5[l] /= num3; } array3[i] = new ClearancePoint { Bones = pointBones.ToArray(), Locals = locals.ToArray(), Weights = array5 }; } return array3; bool AddBone(int index, float share, Vector3 val) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (share <= 0f) { return true; } if (index < 0 || index >= bones.Length || index >= bindposes.Length || (Object)(object)bones[index] == (Object)null) { return false; } pointBones.Add(bones[index]); locals.Add(((Matrix4x4)(ref bindposes[index])).MultiplyPoint3x4(val)); pointWeights.Add(share); return true; } } } internal static class CameraRig { private static readonly int CrouchDownHash = Animator.StringToHash("CrouchDown"); private static readonly int CrouchIdleHash = Animator.StringToHash("CrouchIdle"); private static readonly int CrouchWalkHash = Animator.StringToHash("CrouchWalk"); private static readonly RaycastHit[] WallHits = (RaycastHit[])(object)new RaycastHit[32]; private static int wallMask; private static int wallLayer = -1; public static void ApplyOffset(LocalBodyState state, PlayerControllerB player) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) Camera gameplayCamera = state.GameplayCamera; Transform cameraContainerTransform = player.cameraContainerTransform; if (!((Object)(object)gameplayCamera == (Object)null) && !((Object)(object)cameraContainerTransform == (Object)null) && state.CameraBaseCaptured) { ShiftState shift = state.Shift; Transform transform = ((Component)gameplayCamera).transform; Transform parent = transform.parent; Vector3 up = cameraContainerTransform.up; Vector3 flatForward = GetFlatForward(transform, cameraContainerTransform, player, up); float lookDown = Vector3.Dot(transform.forward, -up); GetAngles(cameraContainerTransform, transform, out var pitch, out var yaw); bool flag = TooManyEmotesCompat.IsFirstPersonEmoteActive(); bool posed = !flag || state.Emote.Frame == Time.frameCount; Vector3 val = GetReference(state, player, transform, parent, flag); Vector3 vanilla = val; float wallRadius = GetWallRadius(gameplayCamera); float value = ConfigManager.HeadFollow.Value; if (!flag && value > 0f) { Quaternion yawRotation = Quaternion.LookRotation(flatForward, up); val = AddFollow(state, player, cameraContainerTransform, val, yawRotation, lookDown, value, wallRadius); } float heading = GetHeading(player); PoseTracker pose = shift.Pose; pose.Update(player, flag ? TooManyEmotesCompat.GetEmoteHash() : 0, flag ? TooManyEmotesCompat.GetEmotePhase() : 0f, flag && TooManyEmotesCompat.IsEmoteBlending()); float ownPitch = GetOwnPitch(state.LookPitch, state.LookFrame, Time.frameCount, pitch, flag); NeedView view = BodyClearance.CreateView(gameplayCamera, ownPitch, yaw); NeedView view2 = BodyClearance.CreateView(gameplayCamera, pitch, yaw); bool offsets = BodyClearance.GetOffsets(state, val, cameraContainerTransform, shift.Offsets); float num = (offsets ? BodyClearance.GetNeed(shift.Offsets, in view) : BodyClearance.GetFallback(ownPitch)); float needShown = (offsets ? BodyClearance.GetNeed(shift.Offsets, in view2) : BodyClearance.GetFallback(pitch)); float num2 = UpdateEnvelope(state, player, cameraContainerTransform, val, in view, pitch, value, num, offsets, posed); float ramp = (offsets ? shift.Samples.GetRamp(pose.Key, in view) : 0f); float cap; float release; bool flag2 = UpdateMotion(shift, player, gameplayCamera, cameraContainerTransform, vanilla, ownPitch, yaw, out cap, out release); if (!shift.Running) { shift.Value = Mathf.Max(num2, num); shift.RiseLeft = 0f; } else { ShiftInput input = new ShiftInput { Delta = Time.deltaTime, Look = ownPitch - shift.LastLook, Turn = Mathf.Abs(Mathf.DeltaAngle(shift.LastYaw, heading)), Moving = pose.Key.IsMoving(), NeedNow = num, Env = num2, EnvOld = shift.EnvOld, Ramp = ramp, KeyChanged = pose.Changed, GroupChanged = (pose.Changed && !pose.Previous.InGroup(pose.Key)), Gated = flag2, Cap = cap, ReleaseCap = release }; MoveShift(shift, in input); } float envOwn = 0f; float envShown = 0f; if (offsets && Mathf.Abs(pitch - ownPitch) > 0.001f) { envOwn = shift.Samples.GetEnvelope(pose.Key, in view); envShown = shift.Samples.GetEnvelope(pose.Key, in view2); } HoldShift(shift, envShown, envOwn, needShown, Time.deltaTime, flag2 ? release : float.PositiveInfinity); shift.LastLook = ownPitch; shift.LastYaw = heading; shift.Running = true; float full = shift.Held * (1f - FirstPersonViewApi.ExternalSuppression); float travel = GetTravel(shift, player, val, flatForward, full, wallRadius); shift.BackAmount = BodyBack.GetAmount(full, travel); shift.BackDir = flatForward; shift.BackFrame = Time.frameCount; Vector3 val2 = (transform.position = val + flatForward * travel); state.LastCameraTargetLocal = (((Object)(object)parent != (Object)null) ? parent.InverseTransformPoint(val2) : val2); state.HasCameraTarget = true; state.CameraOffsetApplied = true; } } private static float GetOwnPitch(float applied, int appliedFrame, int frame, float rendered, bool emoting) { if (emoting || appliedFrame != frame) { return rendered; } return applied; } private static bool UpdateMotion(ShiftState shift, PlayerControllerB player, Camera camera, Transform container, Vector3 vanilla, float ownPitch, float yaw, out float cap, out float release) { //IL_0008: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)player).transform; Quaternion val = container.rotation * Quaternion.Euler(ownPitch, yaw, 0f); Vector3 val2 = vanilla - transform.position; int frameCount = Time.frameCount; bool flag = shift.MotionFrame == frameCount - 1; cap = float.NaN; release = float.NaN; if (flag) { MotionCap.Get(val, shift.LastRotation, val2, shift.LastOffset, transform.up, camera.fieldOfView, camera.aspect, Time.deltaTime, out cap, out release, out var _); } shift.LastRotation = val; shift.LastOffset = val2; shift.MotionFrame = frameCount; return flag; } internal static float GetPitch(Transform container, Transform camTransform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(camTransform.forward, -container.up); return Mathf.Asin(Mathf.Clamp(num, -1f, 1f)) * 57.29578f; } internal static void GetAngles(Transform container, Transform camTransform, out float pitch, out float yaw) { //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) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) pitch = GetPitch(container, camTransform); Vector3 val = container.InverseTransformDirection(camTransform.forward); yaw = Mathf.Atan2(val.x, val.z) * 57.29578f; } private static Vector3 GetReference(LocalBodyState state, PlayerControllerB player, Transform camTransform, Transform? parent, bool emoting) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00ad: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_009c: Unknown result type (might be due to invalid IL or missing references) ShiftState shift = state.Shift; EmoteState emote = state.Emote; if (emoting && emote.SourceFrame == Time.frameCount && TooManyEmotesCompat.IsMovingWhileEmoting()) { return emote.Source; } Vector3 val = state.CameraBaseLocalPosition; Vector3 val4; if (!emoting && player.inVehicleAnimation) { Vector3 val2 = ((shift.FoundFrame == Time.frameCount) ? shift.FoundLocal : camTransform.localPosition); float num = 0.0001f; if (state.HasCameraTarget) { Vector3 val3 = val2 - state.LastCameraTargetLocal; if (((Vector3)(ref val3)).sqrMagnitude <= num * num) { val4 = shift.ReferenceLocal; goto IL_009c; } } val4 = val2; goto IL_009c; } goto IL_009d; IL_009c: val = val4; goto IL_009d; IL_009d: shift.ReferenceLocal = val; if (!((Object)(object)parent != (Object)null)) { return val; } return parent.TransformPoint(val); } private static Vector3 AddFollow(LocalBodyState state, PlayerControllerB player, Transform container, Vector3 reference, Quaternion yawRotation, float lookDown, float amount, float radius) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0063: 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_0049: Unknown result type (might be due to invalid IL or missing references) Vector3 val = FollowBodyAnchor(state, player, reference, yawRotation, lookDown) * amount; if (((Vector3)(ref val)).sqrMagnitude < 1E-08f) { return reference; } Vector3 position = container.position; Vector3 val2 = reference + val - position; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude < 0.0001f) { return position; } Vector3 val3 = val2 / magnitude; float num = ClampTravelToWall(player, position, val3, magnitude, radius); return position + val3 * num; } private static float UpdateEnvelope(LocalBodyState state, PlayerControllerB player, Transform container, Vector3 reference, in NeedView view, float shownPitch, float follow, float needNow, bool sentinels, bool posed) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_019f: Unknown result type (might be due to invalid IL or missing references) ShiftState shift = state.Shift; if (!sentinels) { shift.Env = 0f; shift.EnvOld = 0f; shift.EnvValid = false; return 0f; } PoseSamples samples = shift.Samples; PoseTracker pose = shift.Pose; if (shift.ChangeSeen != ConfigManager.ChangeCount) { shift.ChangeSeen = ConfigManager.ChangeCount; shift.EnvValid = false; } float y = container.lossyScale.y; if (samples.Version != state.Clearance.Version || Mathf.Abs(samples.Scale - y) > 0.001f || Mathf.Abs(samples.Follow - follow) > 0.0001f) { samples.Clear(); samples.Version = state.Clearance.Version; samples.Scale = y; samples.Follow = follow; shift.EnvValid = false; } if (pose.Changed || !shift.EnvValid || HasMoved(shift, in view)) { shift.Env = samples.GetEnvelope(pose.Key, in view); shift.EnvOld = ((pose.Changed || shift.RiseLeft > 0f || shift.Pending) ? samples.GetEnvelope(pose.Previous, in view) : 0f); shift.EnvValid = true; shift.EnvPitch = view.Pitch; shift.EnvYaw = view.Yaw; shift.EnvFov = view.Fov; shift.EnvAspect = view.Aspect; } if (pose.CanSample && posed) { float lean; Vector3 pivot = GetPivot(state, player, container, reference, out lean); samples.Add(pose.Key, pose.Phase, shift.Offsets, pivot, lean, shownPitch, view.Yaw); shift.Env = Mathf.Max(shift.Env, needNow); } return shift.Env; } private static bool HasMoved(ShiftState shift, in NeedView view) { if (!(Mathf.Abs(view.Pitch - shift.EnvPitch) > 0.25f) && !(Mathf.Abs(Mathf.DeltaAngle(shift.EnvYaw, view.Yaw)) > 2f) && !(Mathf.Abs(view.Fov - shift.EnvFov) > 0.01f)) { return Mathf.Abs(view.Aspect - shift.EnvAspect) > 0.001f; } return true; } private static Vector3 GetPivot(LocalBodyState state, PlayerControllerB player, Transform container, Vector3 reference, out float lean) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)state.HeadBone != (Object)null) ? state.HeadBone.parent : null); if ((Object)(object)val == (Object)null) { lean = 0f; return Vector3.zero; } lean = GetLean(player); Vector3 val2 = val.position - reference; return new Vector3(Vector3.Dot(val2, container.right), Vector3.Dot(val2, container.up), Vector3.Dot(val2, container.forward)); } private static float GetLean(PlayerControllerB player) { return ((RigConstraint<MultiRotationConstraintJob, MultiRotationConstraintData, MultiRotationConstraintJobBinder<MultiRotationConstraintData>>)(object)player.cameraLookRig1).weight; } private static float GetHeading(PlayerControllerB player) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) Transform thisPlayerBody = player.thisPlayerBody; float num = (((Object)(object)thisPlayerBody != (Object)null) ? thisPlayerBody.localEulerAngles.y : 0f); return num + player.ladderCameraHorizontal; } private static void MoveShift(ShiftState shift, in ShiftInput input) { float num = Mathf.Max(Mathf.Max(input.Env, input.NeedNow), input.Ramp); float value = shift.Value; float num2 = (input.Gated ? input.Cap : float.PositiveInfinity); if (input.KeyChanged) { bool flag = shift.RiseLeft > 0f && shift.GroupChanged; shift.Dwell = 0f; shift.Pending = true; shift.PendingLeft = 1f; if (input.GroupChanged || !flag) { shift.RiseLeft = 0.25f; shift.RiseFrom = value; shift.GroupChanged = input.GroupChanged && Constants.Camera.Release != ShiftRelease.Dwell; } } bool flag2 = shift.RiseLeft > 0f; if (flag2) { if (shift.GroupChanged) { shift.Value = GetBlend(shift, num, input.Look, input.Delta, num2); if (shift.Value < value) { shift.Pending = false; } } else { shift.Value = GetRise(shift, Mathf.Max(input.EnvOld, num), input.Look, input.Delta, num2); if (shift.Value < value) { shift.Pending = false; } } shift.RiseLeft -= input.Delta; } else { if (input.Gated && shift.Pending) { float num3 = (shift.GroupChanged ? num : Mathf.Max(input.EnvOld, num)); if (shift.Value >= num3 || shift.PendingLeft <= 0f) { shift.Pending = false; } else if (input.Look >= -0.01f) { shift.Value = Mathf.Min(num3, shift.Value + num2); } shift.PendingLeft -= input.Delta; } if (Mathf.Abs(input.Look) > 0.01f) { float look = GetLook(value, input.Look, num, num2); shift.Value = ((input.Look > 0f) ? Mathf.Max(shift.Value, look) : look); if (look < value) { shift.Pending = false; } } } ReleaseShift(shift, in input, num, value, flag2); shift.Value = Mathf.Max(shift.Value, input.NeedNow); } private static float GetRise(ShiftState shift, float goal, float look, float delta, float cap) { if (shift.Value < goal) { float num = Mathf.Min(shift.RiseFrom, shift.Value); float num2 = Mathf.Max(0f, goal - num) / 0.25f; return Mathf.Min(goal, shift.Value + Mathf.Min(num2 * delta, cap)); } if (!(look < -0.01f)) { return shift.Value; } return GetLook(shift.Value, look, goal, cap); } private static float GetBlend(ShiftState shift, float target, float look, float delta, float cap) { if (shift.Value < target) { float num = Mathf.Abs(target - shift.RiseFrom) / 0.25f; float num2 = (target - shift.Value) / Mathf.Max(shift.RiseLeft, delta); return Mathf.MoveTowards(shift.Value, target, Mathf.Min(Mathf.Max(num, num2) * delta, cap)); } if (!(look < -0.01f)) { return shift.Value; } return GetLook(shift.Value, look, target, cap); } private static float GetLook(float value, float look, float target, float cap) { float num = Mathf.Min(0.02f * Mathf.Abs(look), cap); if (look > 0f) { if (!(value < target)) { return value; } return Mathf.Min(target, value + num); } if (!(value > target)) { return value; } return Mathf.Max(target, value - num); } private static void ReleaseShift(ShiftState shift, in ShiftInput input, float target, float start, bool window) { float num = 0.02f; ShiftRelease release = Constants.Camera.Release; bool flag = Mathf.Abs(input.Look) > 0.01f; if (release == ShiftRelease.Dwell) { if (!flag && target < start - num) { shift.Dwell += input.Delta; } else { shift.Dwell = 0f; } } if (window || target >= start - num) { return; } float num2 = GetDrop(shift, in input, release, flag); if (input.Gated) { num2 = Mathf.Min(num2, input.ReleaseCap); } if (!(num2 <= 0f)) { float num3 = Mathf.Max(target, start - num2); if (!(num3 >= shift.Value)) { shift.Value = num3; shift.Pending = false; } } } private static float GetDrop(ShiftState shift, in ShiftInput input, ShiftRelease release, bool looking) { float num = 0.06f * input.Delta; float result; switch (release) { case ShiftRelease.Dwell: return (shift.Dwell >= 3f) ? num : 0f; case ShiftRelease.Input: { bool num2; if (!looking) { if (input.Turn > 0.05f) { goto IL_005f; } num2 = input.Moving; } else { num2 = input.Look < 0f; } if (num2) { goto IL_005f; } result = 0f; goto IL_0060; } default: { return 0.005f * input.Turn; } IL_0060: return result; IL_005f: result = num; goto IL_0060; } } private static void HoldShift(ShiftState shift, float envShown, float envOwn, float needShown, float delta, float cap) { float num = Mathf.Max(0f, envShown - Mathf.Max(shift.Value, envOwn)); if (num >= shift.Lift) { shift.Lift = num; shift.LiftAge = 0f; } else { shift.LiftAge += delta; if (shift.LiftAge > 0.35f) { shift.Lift = Mathf.Max(num, shift.Lift - Mathf.Min(0.2f * delta, cap)); } } shift.Held = Mathf.Max(shift.Value + shift.Lift, needShown); } private static float GetTravel(ShiftState shift, PlayerControllerB player, Vector3 origin, Vector3 forward, float full, float radius) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) float num = full; if (shift.Easing) { num = Mathf.Min(full, Mathf.MoveTowards(shift.Travel, full, shift.EaseRate * Time.deltaTime)); } float num2 = ClampTravelToWall(player, origin, forward, num, radius); bool flag = num2 < num - 0.001f; if (flag && shift.Blocked) { num2 = Mathf.Min(num2, shift.Travel + 1f * Time.deltaTime); } if (flag) { shift.Easing = false; num = num2; } else if (shift.Blocked) { shift.Easing = true; shift.EaseRate = Mathf.Max(0f, full - shift.Travel) / 0.15f; num = Mathf.Min(full, Mathf.MoveTowards(shift.Travel, full, shift.EaseRate * Time.deltaTime)); } if (num >= full) { shift.Easing = false; } shift.Blocked = flag; shift.Travel = num; return num; } public static void SaveEmoteBase(LocalBodyState state, PlayerControllerB player) { //IL_001e: 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_0023: Unknown result type (might be due to invalid IL or missing references) Transform cameraContainerTransform = player.cameraContainerTransform; state.Emote.Container = (((Object)(object)cameraContainerTransform != (Object)null) ? cameraContainerTransform.position : Vector3.zero); } private static Vector3 GetFlatForward(Transform camTransform, Transform container, PlayerControllerB player, Vector3 up) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_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_0044: 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) Vector3 val = Vector3.ProjectOnPlane(camTransform.forward, up); if (((Vector3)(ref val)).sqrMagnitude < 1E-05f) { val = Vector3.ProjectOnPlane(((Component)player).transform.forward, up); } if (!(((Vector3)(ref val)).sqrMagnitude < 1E-05f)) { return ((Vector3)(ref val)).normalized; } return container.forward; } public static void ClearStuckClamp(PlayerControllerB player) { if (player.isPlayerControlled && !player.isPlayerDead && player.clampLooking && !player.inSpecialInteractAnimation) { player.clampLooking = false; player.inVehicleAnimation = false; } } public static void UpdateSeatClamp(LocalBodyState state, PlayerControllerB player) { InteractTrigger currentTriggerInAnimationWith = player.currentTriggerInAnimationWith; if (player.inVehicleAnimation && player.clampLooking && !((Object)(object)currentTriggerInAnimationWith == (Object)null) && currentTriggerInAnimationWith.clampLooking) { float num = currentTriggerInAnimationWith.minVerticalClamp; float rayBack = GetRayBack(state); if (rayBack > 0f && (Object)(object)state.GameplayCamera != (Object)null) { num = Mathf.Max(num, GetSeatReach(player, ((Component)state.GameplayCamera).transform, num, rayBack)); } player.minVerticalClamp = Mathf.Max(num, Mathf.Min(player.minVerticalClamp, player.cameraUp)); } } private static float GetSeatReach(PlayerControllerB player, Transform camTransform, float limit, float push) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bd: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) Vector3 up = player.cameraContainerTransform.up; Vector3 val = Vector3.ProjectOnPlane(camTransform.forward, up); if (((Vector3)(ref val)).sqrMagnitude < 1E-05f) { return limit; } ((Vector3)(ref val)).Normalize(); float num = limit * (MathF.PI / 180f); Vector3 val2 = camTransform.position - val * push; Vector3 val3 = val * Mathf.Cos(num) - up * Mathf.Sin(num); int num2 = player.interactableObjectsMask | StartOfRound.Instance.collidersAndRoomMaskAndDefault; RaycastHit val4 = default(RaycastHit); float num3 = (Physics.Raycast(val2, val3, ref val4, player.grabDistance, num2, (QueryTriggerInteraction)2) ? ((RaycastHit)(ref val4)).distance : player.grabDistance); Vector3 val5 = val2 + val3 * num3 - camTransform.position; float num4 = Mathf.Atan2(0f - Vector3.Dot(val5, up), Vector3.Dot(val5, val)) * 57.29578f; return Mathf.Min(num4, 80f); } public static void AlignForInteractionRay(LocalBodyState state) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (state.HasCameraTarget && !((Object)(object)state.GameplayCamera == (Object)null)) { Transform transform = ((Component)state.GameplayCamera).transform; Transform parent = transform.parent; ShiftState shift = state.Shift; if (shift.FoundFrame != Time.frameCount) { shift.FoundLocal = transform.localPosition; shift.FoundFrame = Time.frameCount; } transform.position = (((Object)(object)parent != (Object)null) ? parent.TransformPoint(state.LastCameraTargetLocal) : state.LastCameraTargetLocal); } } public static float GetRayBack(LocalBodyState state) { if (!state.HasCameraTarget) { return 0f; } return state.Shift.Travel; } public static bool TryGetEye(LocalBodyState state, out Vector3 eye) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) eye = Vector3.zero; Camera gameplayCamera = state.GameplayCamera; if (!state.HasCameraTarget || (Object)(object)gameplayCamera == (Object)null) { return false; } Transform parent = ((Component)gameplayCamera).transform.parent; Vector3 referenceLocal = state.Shift.ReferenceLocal; eye = (((Object)(object)parent != (Object)null) ? parent.TransformPoint(referenceLocal) : referenceLocal); return true; } public static void ApplyArmAnchor(PlayerControllerB player, bool useVanillaArms, bool seat) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Transform cameraContainerTransform = player.cameraContainerTransform; if ((Object)(object)cameraContainerTransform != (Object)null) { ApplyArmAnchor(player, useVanillaArms, cameraContainerTransform.position, seat); } } public static void ApplyArmAnchor(PlayerControllerB player, bool useVanillaArms, Vector3 framed, bool seat = false) { //IL_0039: 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_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a8: Unknown result type (might be due to invalid IL or missing references) if (!useVanillaArms || (player.inSpecialInteractAnimation && !seat)) { return; } Transform localArmsTransform = player.localArmsTransform; Camera gameplayCamera = player.gameplayCamera; if (!((Object)(object)localArmsTransform == (Object)null) && !((Object)(object)gameplayCamera == (Object)null)) { Transform transform = ((Component)gameplayCamera).transform; localArmsTransform.position += transform.position - framed; if (!seat) { localArmsTransform.position += transform.right * ConfigManager.HandOffsetX.Value + transform.up * ConfigManager.HandOffsetY.Value + transform.forward * ConfigManager.HandOffsetZ.Value; } } } private static Vector3 FollowBodyAnchor(LocalBodyState state, PlayerControllerB player, Vector3 baseWorld, Quaternion yawRotation, float lookDown) { //IL_0010: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) Transform headBone = state.HeadBone; if ((Object)(object)headBone == (Object)null) { return Vector3.zero; } EyeAnchorState eyeAnchor = state.EyeAnchor; bool flag = IsEyeAnchorSettled(player, lookDown); eyeAnchor.SettledTime = (flag ? (eyeAnchor.SettledTime + Time.deltaTime) : 0f); bool flag2 = eyeAnchor.SettledTime >= 0.6f; bool flag3 = !player.isCrouching && !player.inSpecialInteractAnimation && player.specialAnimationWeight <= 0.01f; if ((!eyeAnchor.Captured && flag3) || (flag2 && !eyeAnchor.Verified)) { CaptureEyeAnchor(eyeAnchor, headBone, baseWorld, yawRotation, flag2); } if (!eyeAnchor.Captured) { return Vector3.zero; } Vector3 val = headBone.position + yawRotation * eyeAnchor.Local; Vector3 val2 = Quaternion.Inverse(yawRotation) * (val - baseWorld); if (flag) { float num = 1f - Mathf.Exp((0f - Time.deltaTime) / 2f); eyeAnchor.Drift = Vector3.Lerp(eyeAnchor.Drift, val2, num); eyeAnchor.BoneLocal = Vector3.Lerp(eyeAnchor.BoneLocal, headBone.InverseTransformPoint(baseWorld), num); float num2 = 0.06f; if (((Vector3)(ref eyeAnchor.Drift)).sqrMagnitude > num2 * num2) { eyeAnchor.Drift = ((Vector3)(ref eyeAnchor.Drift)).normalized * num2; } } Vector3 val3 = val2 - eyeAnchor.Drift; if (((Vector3)(ref val3)).sqrMagnitude > 0.36f) { val3 = ((Vector3)(ref val3)).normalized * 0.6f; } return yawRotation * val3; } private static void CaptureEyeAnchor(EyeAnchorState anchor, Transform bone, Vector3 baseWorld, Quaternion yawRotation, bool steady) { //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_0009: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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) anchor.Local = Quaternion.Inverse(yawRotation) * (baseWorld - bone.position); anchor.BoneLocal = bone.InverseTransformPoint(baseWorld); anchor.Drift = Vector3.zero; anchor.Captured = true; anchor.Verified = steady; } private static bool IsEyeAnchorSettled(PlayerControllerB player, float lookDown) { if (Mathf.Abs(lookDown) <= 0.05f && !player.isWalking && !player.isSprinting && !player.inSpecialInteractAnimation && player.specialAnimationWeight <= 0.01f && !player.performingEmote && !player.inVehicleAnimation && !player.clampLooking && (Object)(object)player.inAnimationWithEnemy == (Object)null && !player.inShockingMinigame && !IsSwinging(player) && !player.isCrouching && IsCrouchSettled(player) && !player.isClimbingLadder && !player.isJumping) { return !player.isFallingFromJump; } return false; } private static bool IsSwinging(PlayerControllerB player) { if (!Players.IsSwingingShovelLike(player)) { return SwingTorsoSmoothing.IsActive; } return true; } private static bool IsCrouchState(int hash) { if (hash != CrouchDownHash && hash != CrouchIdleHash) { return hash == CrouchWalkHash; } return true; } private static bool IsCrouchSettled(PlayerControllerB player) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Animator playerBodyAnimator = player.playerBodyAnimator; if ((Object)(object)playerBodyAnimator == (Object)null || playerBodyAnimator.layerCount == 0) { return true; } AnimatorStateInfo val = playerBodyAnimator.GetCurrentAnimatorStateInfo(0); int shortNameHash = ((AnimatorStateInfo)(ref val)).shortNameHash; if (shortNameHash == CrouchDownHash) { return false; } bool flag = IsCrouchState(shortNameHash); if (playerBodyAnimator.IsInTransition(0)) { val = playerBodyAnimator.GetNextAnimatorStateInfo(0); if (flag != IsCrouchState(((AnimatorStateInfo)(ref val)).shortNameHash)) { return false; } } return flag == player.isCrouching; } private static float ClampTravelToWall(PlayerControllerB player, Vector3 origin, Vector3 dir, float distance, float radius) { //IL_0019: 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_0061: 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_008c: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || distance <= 0f) { return distance; } int num = Physics.SphereCastNonAlloc(origin, radius, dir, WallHits, distance, GetWallMask(player) | instance.collidersAndRoomMask, (QueryTriggerInteraction)1); Transform transform = ((Component)player).transform; int num2 = 1 << ((Component)player).gameObject.layer; float num3 = distance; for (int i = 0; i < num; i++) { RaycastHit val = WallHits[i]; Collider collider = ((RaycastHit)(ref val)).collider; if ((Object)(object)collider == (Object)null || ((Component)collider).transform.IsChildOf(transform)) { continue; } LayerMask excludeLayers = collider.excludeLayers; if ((((LayerMask)(ref excludeLayers)).value & num2) == 0) { bool flag = ((Component)collider).gameObject.layer == 26; if ((!flag || IsFurniture(collider)) && (!(((RaycastHit)(ref val)).distance <= 0f) || (flag && IsAhead(collider, origin, dir)))) { num3 = Mathf.Min(num3, Mathf.Max(0f, ((RaycastHit)(ref val)).distance)); } } } return num3; } private static bool IsFurniture(Collider collider) { PlaceableShipObject component = ((Component)collider).GetComponent<PlaceableShipObject>(); if ((Object)(object)component != (Object)null) { return !component.AllowPlacementOnWalls; } return false; } private static bool IsAhead(Collider collider, Vector3 origin, Vector3 dir) { //IL_0015: 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) //IL_0030: 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) MeshCollider val = (MeshCollider)(object)((collider is MeshCollider) ? collider : null); if (val != null && !val.convex) { return false; } Vector3 val2 = collider.ClosestPoint(origin) - origin; if (((Vector3)(ref val2)).sqrMagnitude > 1E-06f) { return Vector3.Dot(val2, dir) > 0f; } return false; } private static int GetWallMask(PlayerControllerB player) { int layer = ((Component)player).gameObject.layer; if (layer == wallLayer) { return wallMask; } int num = 67108864; for (int i = 0; i < 32; i++) { if (!Physics.GetIgnoreLayerCollision(layer, i)) { num |= 1 << i; } } wallMask = num; wallLayer = layer; return num; } private static float GetWallRadius(Camera camera) { float num = Mathf.Tan(camera.fieldOfView * 0.5f * (MathF.PI / 180f)); float num2 = num * camera.aspect; float num3 = camera.nearClipPlane * Mathf.Sqrt(1f + num * num + num2 * num2); return num3 + 0.01f; } public static void RestoreOffset(LocalBodyState state) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) state.Shift.Reset(); state.HasCameraTarget = false; if (state.CameraOffsetApplied) { Camera gameplayCamera = state.GameplayCamera; if ((Object)(object)gameplayCamera != (Object)null && state.CameraBaseCaptured) { ((Component)gameplayCamera).transform.localPosition = state.CameraBaseLocalPosition; } state.CameraOffsetApplied = false; } } } internal static class MotionCap { private const float MinSlope = 0.001f; private const float MinPush = 1E-06f; private const float MinLength = 0.0001f; private const float MinDistance = 0.2f; private const float FarDistance = 8f; private const float ProbeStep = 0.01f; private static readonly float[] PointX = new float[3] { 0f, 0f, 1f }; private static readonly float[] PointY = new float[3] { 0f, -0.75f, -1f }; public static void Get(Quaternion look, Quaternion last, Vector3 offset, Vector3 lastOffset, Vector3 up, float fov, float aspect, float delta, out float cap, out float release, out float motion) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) Get(look, last, offset, lastOffset, up, fov, aspect, delta, 0.25f, 0.5f, out cap, out release, out motion); } public static void Get(Quaternion look, Quaternion last, Vector3 offset, Vector3 lastOffset, Vector3 up, float fov, float aspect, float delta, float gateAlpha, float releaseAlpha, out float cap, out float release, out float motion) { //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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Inverse(look); Vector3 val2 = val * GetSpin(look * Quaternion.Inverse(last)); Vector3 val3 = val * (offset - lastOffset); Vector3 val4 = val * -up; Vector3 flat = GetFlat(val4); float num = Vector3.Dot(offset, up) + 0.04f; float num2 = Mathf.Tan(fov * 0.5f * (MathF.PI / 180f)); float num3 = 0.036f * delta; cap = float.MaxValue; release = float.MaxValue; motion = 0f; for (int i = 0; i < PointX.Length; i++) { Vector3 val5 = new Vector3(PointX[i] * num2 * aspect, PointY[i] * num2, 1f); Vector3 normalized = ((Vector3)(ref val5)).normalized; float num4 = Vector3.Dot(normalized, val4); float num5 = ((num4 > 0.001f) ? (num / num4) : 8f); num5 = Mathf.Max(num5, 0.2f); val5 = Vector3.Cross(val2, normalized); float magnitude = ((Vector3)(ref val5)).magnitude; val5 = Vector3.Cross(val3, normalized); float num6 = magnitude + ((Vector3)(ref val5)).magnitude / num5 * 57.29578f; val5 = Vector3.Cross(flat, normalized); float num7 = Mathf.Max(((Vector3)(ref val5)).magnitude / num5 * 57.29578f * 0.01f, 1E-06f); float num8 = 0.9f / num7; cap = Mathf.Min(cap, num8 * (gateAlpha * num6 + num3)); release = Mathf.Min(release, num8 * (releaseAlpha * num6 + num3)); if (i == 1) { motion = num6; } } cap = ((cap >= 0f) ? (cap * 0.01f) : float.MaxValue); release = ((release >= 0f) ? (release * 0.01f) : float.MaxValue); } private static Vector3 GetSpin(Quaternion turn) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (turn.w < 0f) { ((Quaternion)(ref turn))..ctor(0f - turn.x, 0f - turn.y, 0f - turn.z, 0f - turn.w); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(turn.x, turn.y, turn.z); float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 1E-09f) { return Vector3.zero; } return val * (2f * Mathf.Atan2(magnitude, turn.w) * 57.29578f / magnitude); } private static Vector3 GetFlat(Vector3 down) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0055: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((0f - down.z) * down.x, (0f - down.z) * down.y, 1f - down.z * down.z); float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > 0.0001f)) { return new Vector3(0f, 0f, 1f); } return val / magnitude; } } internal readonly struct NeedView { public readonly float Pitch; public readonly float Yaw; public readonly float Fov; public readonly float Aspect; private readonly float sinPitch; private readonly float cosPitch; private readonly float flatCos; private readonly float sinTheta; private readonly float cosTheta; private readonly float spread; private readonly float sideSlope; private readonly float near; private readonly float sinYaw; private readonly float cosYaw; public NeedView(float pitch, float yaw, float fov, float aspect, float near, float margin) { Pitch = pitch; Yaw = yaw; Fov = fov; Aspect = aspect; float num = pitch * (MathF.PI / 180f); float num2 = fov * 0.5f * (MathF.PI / 180f); float num3 = margin * (MathF.PI / 180f); float num4 = num2 + num3; float num5 = Mathf.Atan(Mathf.Tan(num2) * Mathf.Max(aspect, 0.1f)); float num6 = yaw * (MathF.PI / 180f); sinPitch = Mathf.Sin(num); cosPitch = Mathf.Cos(num); flatCos = Mathf.Max(cosPitch, 0.01f); sinTheta = Mathf.Sin(num4); cosTheta = Mathf.Cos(num4); spread = Mathf.Sin(num + num4); sideSlope = 1f / Mathf.Tan(num5 + num3); this.near = near; sinYaw = Mathf.Sin(num6); cosYaw = Mathf.Cos(num6); } public float GetNeed(List<Vector3> offsets) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GetNeed(offsets, Vector3.zero, 0f); } public float GetNeed(List<Vector3> offsets, Vector3 pivot, float angle) { //IL_0029: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00b2: Unknown result type (might be due to invalid IL or missing references) if (spread < 0.05f) { return 0f; } float num = angle * (MathF.PI / 180f); float num2 = Mathf.Sin(num); float num3 = Mathf.Cos(num); float num4 = pivot.x * sinYaw + pivot.z * cosYaw; float num5 = 0f; for (int i = 0; i < offsets.Count; i++) { Vector3 val = offsets[i]; float num6 = val.x * cosYaw - val.z * sinYaw; float num7 = val.x * sinYaw + val.z * cosYaw; float num8 = val.y - pivot.y; float num9 = num7 - num4; float num10 = pivot.y + num8 * num3 - num9 * num2; float num11 = num4 + num8 * num2 + num9 * num3; float num12 = num10 * cosPitch + num11 * sinPitch; float num13 = num11 * cosPitch - num10 * sinPitch; float num14 = (num12 * cosTheta + num13 * sinTheta) / spread; float num15 = (num13 - near) / flatCos; float num16 = (num13 - Mathf.Abs(num6) * sideSlope) / flatCos; float num17 = Mathf.Min(num14, Mathf.Min(num15, num16)); if (num17 > num5) { num5 = num17; } } return num5; } } internal enum Posture { Standing, Crouch, Other } internal readonly struct PoseKey : IEquatable<PoseKey> { private static readonly int IdleHash = Animator.StringToHash("Idle1"); private static readonly int WalkHash = Animator.StringToHash("Walk"); private static readonly int SprintHash = Animator.StringToHash("Sprint"); private static readonly int SidewaysHash = Animator.StringToHash("WalkSideways"); private static readonly int WalkAltHash = Animator.StringToHash("Walk 0"); private static readonly int HinderedHash = Animator.StringToHash("WalkHindered"); private static readonly int LimpHash = Animator.StringToHash("LimpWalk"); private static readonly int CrouchDownHash = Animator.StringToHash("CrouchDown"); private static readonly int CrouchIdleHash = Animator.StringToHash("CrouchIdle"); private static readonly int CrouchWalkHash = Animator.StringToHash("CrouchWalk"); public static readonly int AirHash = Animator.StringToHash("Air"); public readonly int Base; public readonly int Clip; public readonly int Layer1; public readonly int Layer3; public readonly int Layer5; public readonly int Melee; public readonly int Emote; public readonly int Enemy; public PoseKey(int baseState, int clip, int layer1, int layer3, int layer5, int melee, int emote, int enemy) { Base = baseState; Clip = clip; Layer1 = layer1; Layer3 = layer3; Layer5 = layer5; Melee = melee; Emote = emote; Enemy = enemy; } public bool Equals(PoseKey other) { if (Base == other.Base && Clip == other.Clip && Layer1 == other.Layer1 && Layer3 == other.Layer3 && Layer5 == other.Layer5 && Melee == other.Melee && Emote == other.Emote) { return Enemy == other.Enemy; } return false; } public override bool Equals(object? obj) { if (obj is PoseKey other) { return Equals(other); } return false; } public override int GetHashCode() { int num = Base; num = num * 31 + Clip; num = num * 31 + Layer1; num = num * 31 + Layer3; num = num * 31 + Layer5; num = num * 31 + Melee; num = num * 31 + Emote; return num * 31 + Enemy; } public Posture GetPosture() { if (Layer1 != 0 || Layer3 != 0 || Layer5 != 0 || Emote != 0 || Enemy != 0) { return Posture.Other; } if (Base == IdleHash || IsMoving()) { return Posture.Standing; } if (Base == CrouchIdleHash || Base == CrouchWalkHash || Base == CrouchDownHash) { return Posture.Crouch; } return Posture.Other; } public bool IsStanding() { if (Layer1 == 0 && Layer5 == 0 && Emote == 0 && Enemy == 0) { if (Base != IdleHash) { return IsMoving(); } return true; } return false; } public bool IsMoving() { if (Base != WalkHash && Base != SprintHash && Base != AirHash && Base != SidewaysHash && Base != WalkAltHash && Base != HinderedHash) { return Base == LimpHash; } return true; } public bool InGroup(PoseKey other) { Posture posture = GetPosture(); if (posture == other.GetPosture()) { if (posture == Posture.Other) { return Equals(other); } return true; } return false; } } internal sealed class PoseTracker { private static readonly int JumpHash = Animator.StringToHash("Jump"); private static readonly int LandHash = Animator.StringToHash("JumpLand"); private static readonly int FallHash = Animator.StringToHash("FallNoJump"); private static readonly int HurtHash = Animator.StringToHash("Hurt1"); private static readonly int OverheatHash = Animator.StringToHash("GunOverheat"); private static readonly int EnemyHash = Animator.StringToHash("Enemy"); private static readonly Dictionary<int, int> ClipHashes = new Dictionary<int, int>(); private static readonly Dictionary<Type, bool> MeleeTypes = new Dictionary<Type, bool>(); private readonly List<AnimatorClipInfo> clips = new List<AnimatorClipInfo>(); private readonly float[] bandTime = new float[6]; private object? enemy; private int enemyHash; private int clipHeld; public PoseKey Key; public PoseKey Previous; public bool HasKey; public bool Changed; public bool CanSample; public float Phase; public float KeyTime; public PoseTracker() { Reset(); } public void Reset() { HasKey = false; Changed = false; CanSample = false; clipHeld = 0; for (int i = 0; i < bandTime.Length; i++) { bandTime[i] = float.NegativeInfinity; } } public void Update(PlayerControllerB player, int emote, float emotePhase, bool emoteBlend) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; Animator playerBodyAnimator = player.playerBodyAnimator; int num = 0; bool flag = true; PoseKey key; if (emote != 0) { key = new PoseKey(0, 0, 0, 0, 0, 0, emote, 0); Phase = emotePhase - Mathf.Floor(emotePhase); flag = !emoteBlend; clipHeld = 0; } else if ((Object)(object)playerBodyAnimator == (Object)null || playerBodyAnimator.layerCount == 0) { key = new PoseKey(0, 0, 0, 0, 0, 0, 0, 0); flag = false; clipHeld = 0; } else { bool flag2 = playerBodyAnimator.IsInTransition(0); AnimatorStateInfo val = (flag2 ? playerBodyAnimator.GetNextAnimatorStateInfo(0) : playerBodyAnimator.GetCurrentAnimatorStateInfo(0)); int num2 = ((AnimatorStateInfo)(ref val)).shortNameHash; if (num2 == JumpHash || num2 == LandHash || num2 == FallHash) { num2 = PoseKey.AirHash; } int layerKey = GetLayerKey(playerBodyAnimator, player, 1); int layerKey2 = GetLayerKey(playerBodyAnimator, player, 3); int num3 = GetLayerKey(playerBodyAnimator, player, 5); int hash; bool flag3 = TryGetClip(playerBodyAnimator, flag2, out hash); bool flag4 = Constants.Camera.Release != ShiftRelease.Dwell && IsQuickPlaying(playerBodyAnimator); if (flag4 && IsQuick(num3)) { num3 = 0; } num = ((num3 != 0) ? 5 : ((layerKey2 != 0) ? 3 : ((layerKey != 0) ? 1 : 0))); AnimatorStateInfo currentAnimatorStateInfo = playerBodyAnimator.GetCurrentAnimatorStateInfo(num); float normalizedTime = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime; Phase = normalizedTime - Mathf.Floor(normalizedTime); flag = !flag2; flag &= CheckLayer(playerBodyAnimator, 1, layerKey, time); flag &= CheckLayer(playerBodyAnimator, 3, layerKey2, time); flag &= CheckLayer(playerBodyAnimator, 5, num3, time); flag = flag && !flag4; if (!flag3 && HasKey && clipHeld < 2) { clipHeld++; key = Key; flag = false; } else { clipHeld = 0; key = new PoseKey(num2, hash, layerKey, layerKey2, num3, IsHoldingMelee(player) ? 1 : 0, 0, GetEnemyKey(player)); } } Changed = HasKey && !key.Equals(Key); if (Changed) { Previous = Key; } if (!HasKey || Changed) { KeyTime = time; } Key = key; HasKey = true; CanSample = flag && time - KeyTime >= 0.1f; } private bool CheckLayer(Animator animator, int layer, int keyed, float now) { if (layer >= animator.layerCount) { return true; } float layerWeight = animator.GetLayerWeight(layer); if (layerWeight > 0.05f && layerWeight < 0.95f) { bandTime[layer] = now; } if (now - bandTime[layer] < 0.1f) { return false; } if (keyed != 0) { return !animator.IsInTransition(layer); } return true; } private static bool IsQuick(int hash) { if (hash != HurtHash) { return hash == OverheatHash; } return true; } private static bool IsQuickPlaying(Animator animator) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (animator.layerCount <= 5) { return false; } AnimatorStateInfo val = animator.GetCurrentAnimatorStateInfo(5); if (IsQuick(((AnimatorStateInfo)(ref val)).shortNameHash)) { return true; } if (animator.IsInTransition(5)) { val = animator.GetNextAnimatorStateInfo(5); return IsQuick(((AnimatorStateInfo)(ref val)).shortNameHash); } return false; } private static bool IsHoldingMelee(PlayerControllerB player) { if (!Players.IsActivelyHolding(player)) { return false; } GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer; if (currentlyHeldObjectServer is Shovel) { return true; } Type type = ((object)currentlyHeldObjectServer).GetType(); if (MeleeTypes.TryGetValue(type, out var value)) { return value; } Type type2 = type; while (type2 != null && !value) { value = type2.Name == "JMeleeWeapon"; type2 = type2.BaseType; } MeleeTypes[type] = value; return value; } private static int GetLayerKey(Animator animator, PlayerControllerB player, int layer) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (layer >= animator.layerCount || animator.GetLayerWeight(layer) < 0.5f || animator.GetCurrentAnimatorClipInfoCount(layer) <= 0) { return 0; } if (layer == 5 && player.inVehicleAnimation) { InteractTrigger currentTriggerInAnimationWith = player.currentTriggerInAnimationWith; if ((Object)(object)currentTriggerInAnimationWith != (Object)null) { return ((Object)currentTriggerInAnimationWith).GetInstanceID(); } } AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(layer); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash; } private bool TryGetClip(Animator animator, bool next, out int hash) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) hash = 0; clips.Clear(); if (next) { animator.GetNextAnimatorClipInfo(0, clips); } else { animator.GetCurrentAnimatorClipInfo(0, clips); } AnimationClip val = null; float num = 0f; for (int i = 0; i < clips.Count; i++) { AnimatorClipInfo val2 = clips[i]; if ((Object)(object)((AnimatorClipInfo)(ref val2)).clip != (Object)null && ((AnimatorClipInfo)(ref val2)).weight > num) { val = ((AnimatorClipInfo)(ref val2)).clip; num = ((AnimatorClipInfo)(ref val2)).weight; } } if ((Object)(object)val == (Object)null) { return false; } int instanceID = ((Object)val).GetInstanceID(); if (!ClipHashes.TryGetValue(instanceID, out hash)) { string name = ((Object)val).name; hash = Animator.StringToHash(name); ClipHashes[instanceID] = hash; } return true; } private int GetEnemyKey(PlayerControllerB player) { EnemyAI inAnimationWithEnemy = player.inAnimationWithEnemy; if ((Object)(object)inAnimationWithEnemy == (Object)null) { return 0; } EnemyType enemyType = inAnimationWithEnemy.enemyType; if ((Object)(object)enemyType == (Object)null) { return EnemyHash; } if (enemyType != enemy) { enemy = enemyType; enemyHash = Animator.StringToHash(enemyType.enemyName ?? "Enemy"); } return enemyHash; } } internal sealed class PoseSamples { private sealed class Bin { public readonly List<Vector3> Offsets = new List<Vector3>(); public Vector3 Pivot; public float Lean; public float Pitch; public float Yaw; public bool Filled; } private sealed class KeyBins { public readonly Bin?[] Bins = new Bin[24]; public int Count; } public const float LeanScale = 0.46f; public const float LeanWeight = 0.45f; private readonly Dictionary<PoseKey, KeyBins> keys = new Dictionary<PoseKey, KeyBins>(); public int Version; public float Scale; public float Follow; public void Clear() { keys.Clear(); } public void Add(PoseKey key, float phase, List<Vector3> offsets, Vector3 pivot, float lean, float pitch, float yaw) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (!PoseSeeds.IsCrouchDown(key)) { if (!keys.TryGetValue(key, out KeyBins value)) { value = new KeyBins(); keys[key] = value; } int num = Mathf.Clamp((int)(phase * 24f), 0, 23); Bin bin = value.Bins[num]; if (bin == null) { bin = new Bin(); value.Bins[num] = bin; } if (!bin.Filled) { bin.Filled = true; value.Count++; } bin.Offsets.Clear(); bin.Offsets.AddRange(offsets); bin.Pivot = pivot; bin.Lean = lean; bin.Pitch = pitch; bin.Yaw = yaw; } } public float GetEnvelope(PoseKey key, in NeedView view) { float num = ((Follow > 0f) ? 0f : (PoseSeeds.Get(key, view.Pitch, view.Fov) * (Scale / 1.1216f))); if (!keys.TryGetValue(key, out KeyBins value)) { return num; } Bin[] bins = value.Bins; foreach (Bin bin in bins) { if (bin != null && bin.Filled) { float corrected = GetCorrected(bin, in view); if (corrected > num) { num = corrected; } } } return num; } public float GetRamp(PoseKey key, in NeedView view) { if (Follow > 0f) { return 0f; } return PoseSeeds.GetRamp(key, view.Pitch, view.Fov) * (Scale / 1.1216f); } private static float GetCorrected(Bin bin, in NeedView view) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(Mathf.DeltaAngle(bin.Yaw, view.Yaw)) > 30f) { return 0f; } float angle = 0.46f * (bin.Lean / 0.45f) * (view.Pitch - bin.Pitch); return view.GetNeed(bin.Offsets, bin.Pivot, angle); } } internal static class PoseSeeds { private readonly struct Step { public readonly float Pitch; public readonly float Slope; public Step(float pitch, float slope) { Pitch = pitch; Slope = slope; } } private const int IdleRow = 0; private const int WalkRow = 1; private const int SprintRow = 2; private const int AirRow = 3; private const int CrouchDownRow = 4; private const int CrouchIdleRow = 5; private const int CrouchWalkRow = 6; private const int TiredRow = 7; private const float MaxPitch = 85f; private const float NarrowFov = 66f; private static readonly int IdleHash = Animator.StringToHash("I