using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("RepoThirdPerson")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.5.0")] [assembly: AssemblyInformationalVersion("1.3.5")] [assembly: AssemblyProduct("RepoThirdPerson")] [assembly: AssemblyTitle("RepoThirdPerson")] [assembly: AssemblyVersion("1.3.5.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 RepoThirdPerson { [BepInPlugin("com.reponativemods.thirdperson", "REPO Native Third Person", "1.3.5")] public sealed class Plugin : BaseUnityPlugin { private static class RepoUpdatePatches { [CompilerGenerated] private sealed class d__2 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable instructions; public IEnumerable <>3__instructions; private List 5__2; private FieldInfo 5__3; private MethodInfo 5__4; private MethodInfo 5__5; private bool 5__6; private int 5__7; CodeInstruction IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = new List(instructions); 5__3 = AccessTools.Field(typeof(Vector3), "y"); 5__4 = AccessTools.Method(typeof(Quaternion), "Euler", new Type[3] { typeof(float), typeof(float), typeof(float) }, (Type[])null); 5__5 = AccessTools.Method(typeof(RepoUpdatePatches), "ResolveActionMovementYaw", (Type[])null, (Type[])null); 5__6 = false; 5__7 = 0; break; case 1: <>1__state = -1; if (!5__6 && 5__2[5__7].opcode == OpCodes.Ldfld && object.Equals(5__2[5__7].operand, 5__3)) { for (int i = 5__7 + 1; i < 5__2.Count && i <= 5__7 + 4; i++) { if (Calls(5__2[i], 5__4)) { <>2__current = new CodeInstruction(OpCodes.Call, (object)5__5); <>1__state = 2; return true; } } } goto IL_01ae; case 2: { <>1__state = -1; 5__6 = true; goto IL_01ae; } IL_01ae: 5__7++; break; } if (5__7 < 5__2.Count) { <>2__current = 5__2[5__7]; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__2 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__2(0); } d__.instructions = <>3__instructions; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerController), "Update")] private static void PlayerControllerUpdatePostfix() { Instance?.TickInput(); } [HarmonyPrefix] [HarmonyPriority(800)] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static void PlayerControllerFixedUpdatePrefix(PlayerController __instance) { Instance?.BeginActionMovementRewrite(__instance); } [IteratorStateMachine(typeof(d__2))] [HarmonyTranspiler] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static IEnumerable PlayerControllerFixedUpdateTranspiler(IEnumerable instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(-2) { <>3__instructions = instructions }; } private static bool Calls(CodeInstruction instruction, MethodInfo method) { if (instruction.opcode == OpCodes.Call) { return object.Equals(instruction.operand, method); } return false; } private static float ResolveActionMovementYaw(float originalYaw) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if ((Object)Instance == (Object)null) { return originalYaw; } if (Instance.IsLocalGrabActive() && Instance.TryGetGameplayAimYaw(out var yaw)) { _hasRewriteTurnYaw = true; _lastRewriteTurnYaw = yaw; return yaw; } if ((IsActionMovementCameraLockHeld() || Instance.IsMapAimLockActive()) && Instance.TryGetGameplayAimYaw(out var yaw2)) { _hasRewriteTurnYaw = true; _lastRewriteTurnYaw = yaw2; return yaw2; } if (!Instance.CanAcceptActionMovementInput()) { return originalYaw; } if (_rewriteMovementInput) { return _rewriteTurnYaw; } if (!_hasRewriteTurnYaw) { return originalYaw; } return _lastRewriteTurnYaw; } internal static bool IsActionMovementCameraLockHeld() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if ((Object)Instance != (Object)null && Instance.IsCameraLockTemporarilySuppressed()) { return false; } if (Mouse.current != null && Mouse.current.rightButton != null) { return Mouse.current.rightButton.isPressed; } return Input.GetMouseButton(1); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static void PlayerControllerFixedUpdatePostfix(PlayerController __instance) { Instance?.TickActionMovementAfterFixedUpdate(__instance); } [HarmonyFinalizer] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private static void PlayerControllerFixedUpdateFinalizer() { Instance?.EndActionMovementRewrite(); } [HarmonyPostfix] [HarmonyPatch(typeof(SemiFunc), "InputMovementX")] private static void SemiFuncInputMovementXPostfix(ref float __result) { if (_rewriteMovementInput) { __result = _rewriteMovementX; } } [HarmonyPostfix] [HarmonyPatch(typeof(SemiFunc), "InputMovementY")] private static void SemiFuncInputMovementYPostfix(ref float __result) { if (_rewriteMovementInput) { __result = _rewriteMovementY; } } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerAvatarVisuals), "Update")] private static void PlayerAvatarVisualsUpdatePostfix(PlayerAvatarVisuals __instance) { Instance?.TickActionMovementVisuals(__instance); } [HarmonyPriority(0)] private static void ModdedModelPlayerAvatarUpdatePostfix(object __instance) { Instance?.TickModdedModelPlayerAvatarPostUpdate(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraPosition), "Update")] private static void CameraPositionUpdatePostfix(CameraPosition __instance) { Instance?.ApplyFirstPersonCrouchLocalOffset(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraCrouchPosition), "Update")] private static void CameraCrouchPositionUpdatePostfix(CameraCrouchPosition __instance) { Instance?.ForceCameraCrouchLocalPosition(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(CameraCrawlPosition), "Update")] private static void CameraCrawlPositionUpdatePostfix(CameraCrawlPosition __instance) { Instance?.ForceCameraCrawlLocalPosition(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerLocalCamera), "GetOverrideTransform")] private static void PlayerLocalCameraGetOverrideTransformPostfix(PlayerLocalCamera __instance, ref Transform __result) { Instance?.TryGetSelectionOverride(__instance, ref __result); Instance?.NormalizeFirstPersonOverrideTransform(__instance, ref __result); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerLocalCamera), "GetOverrideActive")] private static void PlayerLocalCameraGetOverrideActivePostfix(PlayerLocalCamera __instance, ref bool __result) { Instance?.TryGetSelectionOverrideActive(__instance, ref __result); Instance?.NormalizeFirstPersonOverrideActive(__instance, ref __result); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(FlashlightController), "Update")] private static void FlashlightControllerUpdatePostfix(FlashlightController __instance) { Instance?.TickFlashlightControllerPostUpdate(__instance); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerAvatarRightArm), "Update")] private static void PlayerAvatarRightArmUpdatePostfix(PlayerAvatarRightArm __instance) { Instance?.ForceLocalThirdPersonRightArmPose(__instance); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerAvatarLeftArm), "Update")] private static void PlayerAvatarLeftArmUpdatePostfix(PlayerAvatarLeftArm __instance) { Instance?.ForceLocalThirdPersonLeftArmPose(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyOnScreen), "Awake")] private static void EnemyOnScreenAwakePostfix(EnemyOnScreen __instance) { Instance?.EnableEnemyOnScreenDuringThirdPerson(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyOnScreen), "OnEnable")] private static void EnemyOnScreenOnEnablePostfix(EnemyOnScreen __instance) { Instance?.EnableEnemyOnScreenDuringThirdPerson(__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(SemiPuke), "PukeActive")] private static void SemiPukePukeActivePrefix(ref Quaternion _direction) { Instance?.OverridePukeDirection(ref _direction); } } private struct ClipPlaneState { public float Near; public float Far; } public const string PluginGuid = "com.reponativemods.thirdperson"; public const string PluginName = "REPO Native Third Person"; public const string PluginVersion = "1.3.5"; private const string SelectionTransformName = "REPO Native Third Person Selection Transform"; private const string ToggleActionName = "REPO Native Third Person Toggle"; private const string ZoomInActionName = "REPO Native Third Person Zoom In"; private const string ZoomOutActionName = "REPO Native Third Person Zoom Out"; private const string DefaultLayerName = "Default"; private const string GroundLayerName = "Ground"; private const string WallLayerName = "Wall"; private const string PlayerLayerName = "Player"; private const float InputDeadZone = 0.001f; private const float MinimumCameraCastDistance = 0.001f; private const float MinimumSelectionDirectionSqrMagnitude = 0.0001f; private const float MinimumConfiguredDistance = 0.1f; private const float CameraPositionOverrideDuration = 0.1f; private const float ShowSelfOverrideDuration = 0.15f; private const float ObstructedMinimumDistance = 0.05f; private const float NearFadeStartDistance = 2.6f; private const float NearFadeEndDistance = 1.15f; private ConfigEntry _toggleKey; private ConfigEntry _zoomInKey; private ConfigEntry _zoomOutKey; private ConfigEntry _resetOffsetsKey; private ConfigEntry _scrollSensitivity; private ConfigEntry _keyZoomSpeed; private ConfigEntry _offsetAdjustSpeed; private ConfigEntry _offsetX; private ConfigEntry _offsetY; private ConfigEntry _defaultDistance; private ConfigEntry _minDistance; private ConfigEntry _maxDistance; private ConfigEntry _collisionRadius; private ConfigEntry _collisionPadding; private ConfigEntry _minimumFarClipPlane; private ConfigEntry _nearClipPlane; private ConfigEntry _cameraCenteredSelection; private ConfigEntry _selectionOriginMode; private ConfigEntry _selectionMaxDistance; private ConfigEntry _actionMovementEnabled; private ConfigEntry _actionTurnSpeed; private ConfigEntry _actionMovementWhileGrabbing; private ConfigEntry _forceLocalModdedModel; private ConfigEntry _cameraCloseSmoothTime; private ConfigEntry _cameraFarSmoothTime; private ConfigEntry _grabCameraDistance; private ConfigEntry _grabCameraOffsetX; private ConfigEntry _nearFadeStartZoomRatio; private ConfigEntry _nearFadeMinAlpha; private ConfigEntry _lockRuntimeCameraTuning; private ConfigEntry _localTransparencyMode; private ConfigEntry _silhouetteScale; private ConfigEntry _outlineWidth; private ConfigEntry _outlineColorR; private ConfigEntry _outlineColorG; private ConfigEntry _outlineColorB; private ConfigEntry _outlineColorA; private ConfigEntry _thirdPersonMapOverlay; private ConfigEntry _mapOverlayX; private ConfigEntry _mapOverlayY; private ConfigEntry _mapOverlayZ; private ConfigEntry _mapOverlayScale; private ConfigEntry _mapOverlayPitch; private ConfigEntry _mapOverlayYaw; private ConfigEntry _mapOverlayRoll; private ConfigEntry _debugShowCameraPoints; private ConfigEntry _debugShowGrabSelection; private ConfigEntry _debugLogCameraSettings; private ConfigEntry _debugCameraLogInterval; private readonly Dictionary _originalClipPlanes = new Dictionary(); private readonly Dictionary _originalRendererMotionVectors = new Dictionary(); private readonly Dictionary _originalRendererLayers = new Dictionary(); private readonly Dictionary _originalRendererMaterials = new Dictionary(); private readonly Dictionary _transparentRendererMaterials = new Dictionary(); private readonly Dictionary _originalRendererEnabledStates = new Dictionary(); private readonly Dictionary _originalRendererShadowModes = new Dictionary(); private readonly Dictionary _silhouetteRenderers = new Dictionary(); private readonly Dictionary _outlineRenderers = new Dictionary(); private readonly Dictionary _contourDepthRenderers = new Dictionary(); private readonly Dictionary _contourOutlineRenderers = new Dictionary(); private readonly HashSet _activeTransparentRenderers = new HashSet(); private readonly HashSet _activeObstructionTransparentRenderers = new HashSet(); private readonly MaterialPropertyBlock _transparencyPropertyBlock = new MaterialPropertyBlock(); private readonly List _cameraBuffer = new List(16); private bool _thirdPersonActive; private float _currentDistance; private float _resolvedDistance; private float _resolvedDistanceVelocity; private Vector3 _gameplayCameraPosition; private Vector3 _stableGrabOrigin; private float _grabCameraBlend; private float _grabCameraBlendVelocity; private bool _wasLocalGrabActive; private bool _hasGrabAimLockTarget; private Vector3 _grabAimLockTarget; private float _grabAimLockUntilTime; private float _thirdPersonCrouchYOffset; private float _thirdPersonCrouchYOffsetVelocity; private int _collisionMask; private InputAction _toggleAction; private InputAction _zoomInAction; private InputAction _zoomOutAction; private Harmony _harmony; private Transform _selectionTransform; private int _lastInputTickFrame = -1; private int _lastCameraTickFrame = -1; private bool _temporarilyFirstPerson; private float _forceFirstPersonLocalModelHiddenUntil; private float _cameraLockSuppressUntilTime; private float _startingOffsetX; private float _startingOffsetY; private float _runtimeOffsetX; private float _runtimeOffsetY; private int _lastActionMovementTickFrame = -1; private Vector3 _lastActionMoveDirection = Vector3.zero; private float _lastActionMoveDirectionTime; private bool _loggedModelCompatibility; private bool _loggedModelCompatibilityMissing; private Type _moddedModelPlayerAvatarType; private FieldInfo _forceShowLocalModelField; private FieldInfo _currentModelInstanceField; private FieldInfo _cachedModelRenderersField; private MethodInfo _applyModelToVisualMethod; private MethodInfo _rightArmGrabberPoseOverrideMethod; private MethodInfo _rightArmSetPoseMethod; private MethodInfo _rightArmAnimatePoseMethod; private MethodInfo _leftArmSetPoseMethod; private MethodInfo _leftArmAnimatePoseMethod; private FieldInfo _physGrabBeamActiveField; private FieldInfo _playerAvatarRightArmField; private bool _moddedModelUpdatePatched; private PlayerAvatar _cachedModelAvatar; private Component _cachedModelComponent; private GameObject _cachedModelInstance; private Renderer[] _cachedForcedRenderers; private bool _localModdedModelVisible; private PlayerAvatarVisuals _cachedAvatarVisualsForMotionVectors; private Renderer[] _cachedAvatarVisualRenderers; private float _nextModelCompatibilityRetryTime; private float _nextRendererRefreshTime; private float _nextAvatarRendererRefreshTime; private float _nextCameraDebugLogTime; private float _nextTransparencyDebugLogTime; private float _nextCameraSettingsLogTime; private float _nextMapOverlayLogTime; private GameObject _localMapOverlayClone; private Transform _localMapOverlayVisualRoot; private MapToolController _localMapOverlaySource; private Material _silhouetteMaterial; private Material _outlineMaterial; private Material _contourDepthMaterial; private Material _contourOutlineMaterial; private bool _contourPreferSkinnedRenderers; private float _contourBodyVolumeThreshold; private bool _motionBlurOverrideActive; private bool _motionBlurOriginalActive; private float _motionBlurOriginalShutterAngle; private static FieldInfo _menuCurrentPageField; private static bool _rewriteMovementInput; private static float _rewriteMovementX; private static float _rewriteMovementY; private static float _rewriteTurnYaw; private static float _lastRewriteTurnYaw; private static bool _hasRewriteTurnYaw; private static Quaternion _visualFacingRotation = Quaternion.identity; private static bool _hasVisualFacingRotation; private PlayerAvatar _lastPlayerAvatar; private int _lastGameState = -1; private FieldInfo _avatarIsDisabledField; private FieldInfo _avatarDeadSetField; private FieldInfo _postProcessingMotionBlurField; private FieldInfo _avatarVisualPositionField; private FieldInfo _avatarVisualFollowLerpField; private FieldInfo _avatarVisualBodySpringTargetField; private FieldInfo _cameraPositionOverrideTimerField; private FieldInfo _cameraPositionOverrideTargetField; private FieldInfo _cameraCrouchLerpField; private FieldInfo _cameraCrawlLerpField; private FieldInfo _playerAvatarVisionTargetField; private FieldInfo _visionTargetCurrentPositionField; private FieldInfo _visionTargetStandPositionField; private Transform _debugAnchorPoint; private Transform _debugHeadPoint; private Transform _debugGrabOriginPoint; private Transform _debugGrabCameraHitPoint; private Transform _debugGrabTargetPoint; private LineRenderer _debugGrabCameraRayLine; private LineRenderer _debugGrabCharacterRayLine; private LineRenderer _debugGrabRangeLine; private Material _debugGrabCameraRayMaterial; private Material _debugGrabCharacterRayMaterial; private Material _debugGrabRangeMaterial; internal static Plugin Instance { get; private set; } internal void TickFlashlightControllerPostUpdate(FlashlightController controller) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0037: 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_004b: Expected O, but got Unknown //IL_004b: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && !((Object)controller == (Object)null) && !((Object)controller.PlayerAvatar == (Object)null) && !((Object)controller.PlayerAvatar != (Object)PlayerAvatar.instance)) { controller.SetThirdPerson(true); AlignLocalThirdPersonFlashlight(controller); if ((Object)controller.halo != (Object)null) { controller.halo.enabled = false; } } } private void AlignLocalThirdPersonFlashlight(FlashlightController controller) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: 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_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_008b: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) PlayerAvatar playerAvatar = controller.PlayerAvatar; if ((Object)playerAvatar == (Object)null) { return; } Vector3 val = (_hasVisualFacingRotation ? (_visualFacingRotation * Vector3.forward) : ((!((Object)playerAvatar.playerAvatarVisuals != (Object)null)) ? ((Component)playerAvatar).transform.forward : ((Component)playerAvatar.playerAvatarVisuals).transform.forward)); val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref val)).Normalize(); Transform transform = ((Component)controller).transform; transform.rotation = Quaternion.LookRotation(val, Vector3.up); if ((Object)playerAvatar.flashlightLightAim != (Object)null) { playerAvatar.flashlightLightAim.clientAimPoint = transform.position + val * 100f; } } } internal void ForceLocalThirdPersonRightArmPose(PlayerAvatarRightArm arm) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: 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_0038: Expected O, but got Unknown //IL_0038: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (!_thirdPersonActive || _temporarilyFirstPerson || (Object)arm == (Object)null || (Object)arm.playerAvatar != (Object)PlayerAvatar.instance) { return; } PhysGrabber physGrabber = arm.playerAvatar.physGrabber; if (!((Object)physGrabber == (Object)null) && (IsPhysGrabBeamActive(physGrabber) || physGrabber.grabbed)) { if (_rightArmGrabberPoseOverrideMethod == null) { _rightArmGrabberPoseOverrideMethod = typeof(PlayerAvatarRightArm).GetMethod("GrabberPoseOverride", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _rightArmGrabberPoseOverrideMethod?.Invoke(arm, new object[1] { 0.2f }); ForceRightArmPoseNow(arm, arm.grabberPose); } } internal void ForceLocalThirdPersonLeftArmPose(PlayerAvatarLeftArm arm) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: 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_0038: Expected O, but got Unknown //IL_0038: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_007c: 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_0069: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && !((Object)arm == (Object)null) && !((Object)arm.playerAvatar != (Object)PlayerAvatar.instance)) { FlashlightController flashlightController = arm.flashlightController; if (!((Object)flashlightController == (Object)null) && (flashlightController.LightActive || (!((Object)flashlightController.spotlight == (Object)null) && ((Behaviour)flashlightController.spotlight).enabled))) { ForceLeftArmPoseNow(arm, arm.flashlightPose); } } } private void ForceRightArmPoseNow(PlayerAvatarRightArm arm, Vector3 pose) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!((Object)arm == (Object)null)) { if (_rightArmSetPoseMethod == null) { _rightArmSetPoseMethod = typeof(PlayerAvatarRightArm).GetMethod("SetPose", BindingFlags.Instance | BindingFlags.NonPublic); } if (_rightArmAnimatePoseMethod == null) { _rightArmAnimatePoseMethod = typeof(PlayerAvatarRightArm).GetMethod("AnimatePose", BindingFlags.Instance | BindingFlags.NonPublic); } _rightArmSetPoseMethod?.Invoke(arm, new object[1] { pose }); _rightArmAnimatePoseMethod?.Invoke(arm, null); } } private void ForceLeftArmPoseNow(PlayerAvatarLeftArm arm, Vector3 pose) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!((Object)arm == (Object)null)) { if (_leftArmSetPoseMethod == null) { _leftArmSetPoseMethod = typeof(PlayerAvatarLeftArm).GetMethod("SetPose", BindingFlags.Instance | BindingFlags.NonPublic); } if (_leftArmAnimatePoseMethod == null) { _leftArmAnimatePoseMethod = typeof(PlayerAvatarLeftArm).GetMethod("AnimatePose", BindingFlags.Instance | BindingFlags.NonPublic); } _leftArmSetPoseMethod?.Invoke(arm, new object[1] { pose }); _leftArmAnimatePoseMethod?.Invoke(arm, null); } } private bool IsPhysGrabBeamActive(PhysGrabber physGrabber) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)physGrabber == (Object)null) { return false; } if (_physGrabBeamActiveField == null) { _physGrabBeamActiveField = typeof(PhysGrabber).GetField("physGrabBeamActive", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } bool flag = default(bool); int num; if (_physGrabBeamActiveField != null) { object value = _physGrabBeamActiveField.GetValue(physGrabber); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private PlayerAvatarRightArm GetPlayerAvatarRightArm(PlayerAvatarVisuals visuals) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if ((Object)visuals == (Object)null) { return null; } if (_playerAvatarRightArmField == null) { _playerAvatarRightArmField = typeof(PlayerAvatarVisuals).GetField("playerAvatarRightArm", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj = _playerAvatarRightArmField?.GetValue(visuals); PlayerAvatarRightArm val = (PlayerAvatarRightArm)((obj is PlayerAvatarRightArm) ? obj : null); if (!((Object)val != (Object)null)) { return ((Component)visuals).GetComponentInChildren(true); } return val; } private static Transform CreateDebugPoint(string objectName, Color color, float scale) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); if ((Object)val == (Object)null) { return null; } ((Object)val).name = objectName; val.transform.localScale = Vector3.one * Mathf.Max(0.01f, scale); int num = LayerMask.NameToLayer("TopLayer"); if (num >= 0) { val.layer = num; } Collider component = val.GetComponent(); if ((Object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val.GetComponent(); if ((Object)component2 != (Object)null) { Material material = component2.material; if ((Object)material != (Object)null) { material.color = color; } } KeepAliveOutsideScene(val); val.SetActive(false); return val.transform; } private LineRenderer GetOrCreateDebugLine(ref LineRenderer line, ref Material material, string objectName, Color color, float width) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0084: 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_0099: Expected O, but got Unknown //IL_00a6: 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) if ((Object)line != (Object)null) { return line; } GameObject val = new GameObject(objectName); KeepAliveOutsideScene(val); int num = LayerMask.NameToLayer("TopLayer"); if (num >= 0) { val.layer = num; } line = val.AddComponent(); line.positionCount = 2; line.useWorldSpace = true; line.loop = false; ((Renderer)line).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)line).receiveShadows = false; line.widthMultiplier = Mathf.Max(0.002f, width); material = CreateDebugLineMaterial(objectName + " Material", color); if ((Object)material != (Object)null) { ((Renderer)line).material = material; } line.startColor = color; line.endColor = color; val.SetActive(false); return line; } private static Material CreateDebugLineMaterial(string name, Color color) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Hidden/Internal-Colored") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Standard"); if ((Object)val == (Object)null) { return null; } Material val2 = new Material(val); ((Object)val2).name = name; if (val2.HasProperty("_Color")) { val2.SetColor("_Color", color); } if (val2.HasProperty("_SrcBlend")) { val2.SetFloat("_SrcBlend", 5f); } if (val2.HasProperty("_DstBlend")) { val2.SetFloat("_DstBlend", 10f); } if (val2.HasProperty("_ZWrite")) { val2.SetFloat("_ZWrite", 0f); } val2.renderQueue = 5000; val2.SetOverrideTag("RenderType", "Transparent"); return val2; } private void HideDebugPoints() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if ((Object)_debugAnchorPoint != (Object)null) { ((Component)_debugAnchorPoint).gameObject.SetActive(false); } if ((Object)_debugHeadPoint != (Object)null) { ((Component)_debugHeadPoint).gameObject.SetActive(false); } HideGrabDebugVisuals(); } private void UpdateDebugPoints(Vector3 anchor, Vector3 headCenter) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_007b: 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) bool flag = _debugShowCameraPoints != null && _debugShowCameraPoints.Value && _thirdPersonActive && !_temporarilyFirstPerson; if ((Object)_debugAnchorPoint != (Object)null) { ((Component)_debugAnchorPoint).gameObject.SetActive(false); } if ((Object)_debugHeadPoint != (Object)null) { ((Component)_debugHeadPoint).gameObject.SetActive(flag); if (flag) { _debugHeadPoint.position = headCenter; } } if (flag && Time.time >= _nextCameraDebugLogTime) { _nextCameraDebugLogTime = Time.time + 0.5f; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[ThirdPersonDebug] head={headCenter} currentDistance={_currentDistance:0.00} resolvedDistance={_resolvedDistance:0.00}"); } } private static Vector3 GetCharacterBodyDebugOrigin(PlayerAvatar avatar, Vector3 grabOrigin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //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_0021: 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) if ((Object)avatar == (Object)null) { return grabOrigin; } return Vector3.Lerp(((Component)avatar).transform.position, grabOrigin, 0.45f); } private void UpdateGrabDebugVisuals(Vector3 grabOrigin, Vector3 cameraRayDebugOrigin, Vector3 cameraHitPoint, Vector3 grabTarget, float grabRange, bool hasCameraHit, bool hitIsReachable) { //IL_002e: 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_0074: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f3: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) if (_debugShowGrabSelection == null || !_debugShowGrabSelection.Value || !_thirdPersonActive || _temporarilyFirstPerson) { HideGrabDebugVisuals(); return; } Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.85f, 0.05f, 0.95f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.2f, 1f, 0.25f, 0.95f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.25f, 0.95f, 1f, 0.95f); Color val4 = default(Color); ((Color)(ref val4))..ctor(1f, 0.1f, 0.08f, 0.95f); Color color = default(Color); ((Color)(ref color))..ctor(1f, 1f, 1f, 0.45f); Color val5 = ((!hasCameraHit) ? val3 : (hitIsReachable ? val2 : val4)); SetDebugPoint(_debugGrabOriginPoint, grabOrigin, val3, active: true); SetDebugPoint(_debugGrabCameraHitPoint, cameraHitPoint, hasCameraHit ? val5 : val, active: true); SetDebugPoint(_debugGrabTargetPoint, grabTarget, val5, active: true); SetDebugLine(GetOrCreateDebugLine(ref _debugGrabCameraRayLine, ref _debugGrabCameraRayMaterial, "REPO Native Third Person Grab Camera Ray Debug", val, 0.018f), cameraRayDebugOrigin, cameraHitPoint, val, active: true); SetDebugLine(GetOrCreateDebugLine(ref _debugGrabCharacterRayLine, ref _debugGrabCharacterRayMaterial, "REPO Native Third Person Grab Character Ray Debug", val5, 0.028f), grabOrigin, grabTarget, val5, active: true); Vector3 val6 = grabTarget - grabOrigin; Vector3 end = grabOrigin + ((((Vector3)(ref val6)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val6)).normalized : Vector3.forward) * Mathf.Max(0.1f, grabRange); SetDebugLine(GetOrCreateDebugLine(ref _debugGrabRangeLine, ref _debugGrabRangeMaterial, "REPO Native Third Person Grab Range Debug", color, 0.012f), grabOrigin, end, color, active: true); } private static void SetDebugPoint(Transform point, Vector3 position, Color color, bool active) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //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) //IL_003a: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)point == (Object)null) { return; } GameObject gameObject = ((Component)point).gameObject; gameObject.SetActive(active); if (active) { point.position = position; Renderer component = gameObject.GetComponent(); if ((Object)component != (Object)null && (Object)component.material != (Object)null) { component.material.color = color; } } } private static void SetDebugLine(LineRenderer line, Vector3 start, Vector3 end, Color color, bool active) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) if ((Object)line == (Object)null) { return; } ((Component)line).gameObject.SetActive(active); if (active) { line.startColor = color; line.endColor = color; line.SetPosition(0, start); line.SetPosition(1, end); if ((Object)((Renderer)line).material != (Object)null && ((Renderer)line).material.HasProperty("_Color")) { ((Renderer)line).material.SetColor("_Color", color); } } } private void HideGrabDebugVisuals() { //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_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_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_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) //IL_0052: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) SetDebugPoint(_debugGrabOriginPoint, Vector3.zero, Color.clear, active: false); SetDebugPoint(_debugGrabCameraHitPoint, Vector3.zero, Color.clear, active: false); SetDebugPoint(_debugGrabTargetPoint, Vector3.zero, Color.clear, active: false); SetDebugLine(_debugGrabCameraRayLine, Vector3.zero, Vector3.zero, Color.clear, active: false); SetDebugLine(_debugGrabCharacterRayLine, Vector3.zero, Vector3.zero, Color.clear, active: false); SetDebugLine(_debugGrabRangeLine, Vector3.zero, Vector3.zero, Color.clear, active: false); } internal void EnableEnemyOnScreenDuringThirdPerson(EnemyOnScreen enemyOnScreen) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)enemyOnScreen == (Object)null)) { enemyOnScreen.enableOnCameraOverride = true; } } private void Awake() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Expected O, but got Unknown //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Expected O, but got Unknown //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Expected O, but got Unknown //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Expected O, but got Unknown //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Expected O, but got Unknown //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Expected O, but got Unknown //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Expected O, but got Unknown //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Expected O, but got Unknown //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Expected O, but got Unknown //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Expected O, but got Unknown //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Expected O, but got Unknown //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Expected O, but got Unknown //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Expected O, but got Unknown //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Expected O, but got Unknown //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Expected O, but got Unknown //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_0829: Expected O, but got Unknown //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Expected O, but got Unknown //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08c6: Expected O, but got Unknown //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_0904: Expected O, but got Unknown //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Expected O, but got Unknown //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Expected O, but got Unknown //IL_09b4: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Expected O, but got Unknown //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09fc: Expected O, but got Unknown //IL_0aa5: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Expected O, but got Unknown //IL_0ae3: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0aee: Unknown result type (might be due to invalid IL or missing references) //IL_0af3: Unknown result type (might be due to invalid IL or missing references) //IL_0bbe: Unknown result type (might be due to invalid IL or missing references) //IL_0bec: Unknown result type (might be due to invalid IL or missing references) //IL_0c1a: Unknown result type (might be due to invalid IL or missing references) //IL_0c48: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c96: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Expected O, but got Unknown //IL_0ccf: Unknown result type (might be due to invalid IL or missing references) Instance = this; KeepAliveOutsideScene(((Component)this).gameObject); _toggleKey = ((BaseUnityPlugin)this).Config.Bind("General", "ToggleKey", (KeyCode)120, "Key to toggle third-person mode."); _offsetX = ((BaseUnityPlugin)this).Config.Bind("Camera", "OffsetX", 0.45f, "Always-on third-person right shoulder offset."); _offsetY = ((BaseUnityPlugin)this).Config.Bind("Camera", "OffsetY", 1.965f, "Vertical offset from the local player origin."); _defaultDistance = ((BaseUnityPlugin)this).Config.Bind("Camera", "DefaultDistance", 3f, new ConfigDescription("Default distance behind the player.", (AcceptableValueBase)(object)new AcceptableValueRange(0.25f, 25f), Array.Empty())); _minDistance = ((BaseUnityPlugin)this).Config.Bind("Camera", "MinDistance", 1f, new ConfigDescription("Minimum zoom distance.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 25f), Array.Empty())); _maxDistance = ((BaseUnityPlugin)this).Config.Bind("Camera", "MaxDistance", 3.33f, new ConfigDescription("Maximum zoom distance.", (AcceptableValueBase)(object)new AcceptableValueRange(0.25f, 50f), Array.Empty())); _collisionRadius = ((BaseUnityPlugin)this).Config.Bind("Camera", "CollisionRadius", 0.035f, new ConfigDescription("Very small spherecast radius used to keep the camera out of walls while avoiding false pull-in near doors.", (AcceptableValueBase)(object)new AcceptableValueRange(0.005f, 0.25f), Array.Empty())); _collisionPadding = ((BaseUnityPlugin)this).Config.Bind("Camera", "CollisionPadding", 0.15f, new ConfigDescription("Distance kept between the camera and collision surfaces.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); _nearClipPlane = ((BaseUnityPlugin)this).Config.Bind("Camera", "NearClipPlane", 0.03f, new ConfigDescription("Near clip plane while third-person is active. Lower values reduce close zoom clipping.", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 1f), Array.Empty())); _minimumFarClipPlane = ((BaseUnityPlugin)this).Config.Bind("Camera", "MinimumFarClipPlane", 1000f, new ConfigDescription("Minimum far clip plane while third-person is active. The mod also preserves any larger original far clip value.", (AcceptableValueBase)(object)new AcceptableValueRange(100f, 100000f), Array.Empty())); _cameraCenteredSelection = ((BaseUnityPlugin)this).Config.Bind("Interaction", "CameraCenteredSelection", true, "Aim selection/grabbing at the object centered by the third-person camera while keeping the origin at the player vision transform."); _selectionOriginMode = ((BaseUnityPlugin)this).Config.Bind("Interaction", "SelectionOriginMode", "Camera", new ConfigDescription("Origin used by third-person selection/grab override. Camera projects the third-person crosshair through the character grab range; PlayerVision is a legacy fallback.", (AcceptableValueBase)(object)new AcceptableValueList(new string[2] { "Camera", "PlayerVision" }), Array.Empty())); _selectionMaxDistance = ((BaseUnityPlugin)this).Config.Bind("Interaction", "SelectionMaxDistance", 100f, new ConfigDescription("Maximum distance used when converting the third-person camera center ray into a player-origin selection ray.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 500f), Array.Empty())); _zoomInKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "ZoomInKey", (KeyCode)270, "Key to zoom in."); _zoomOutKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "ZoomOutKey", (KeyCode)269, "Key to zoom out."); _resetOffsetsKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "ResetOffsetsKey", (KeyCode)278, "Key to reset runtime camera offsets to the loaded config values."); _scrollSensitivity = ((BaseUnityPlugin)this).Config.Bind("Controls", "ScrollSensitivity", 1f, new ConfigDescription("Mouse wheel zoom sensitivity.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); _keyZoomSpeed = ((BaseUnityPlugin)this).Config.Bind("Controls", "KeyZoomSpeed", 5f, new ConfigDescription("Zoom speed when using zoom keys.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 50f), Array.Empty())); _offsetAdjustSpeed = ((BaseUnityPlugin)this).Config.Bind("Controls", "OffsetAdjustSpeed", 1f, new ConfigDescription("Offset adjustment speed when holding arrow keys, in world units per second.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 10f), Array.Empty())); _actionMovementEnabled = ((BaseUnityPlugin)this).Config.Bind("Action Movement", "Enabled", true, "When third-person is active, turn the avatar toward the camera-relative WASD direction."); _actionTurnSpeed = ((BaseUnityPlugin)this).Config.Bind("Action Movement", "TurnSpeed", 14f, new ConfigDescription("How quickly the avatar turns toward the camera-relative movement direction.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 40f), Array.Empty())); _actionMovementWhileGrabbing = ((BaseUnityPlugin)this).Config.Bind("Action Movement", "WhileGrabbing", false, "Keep action movement active while grabbing. Disabled by default so grab aim keeps vanilla behavior."); _forceLocalModdedModel = ((BaseUnityPlugin)this).Config.Bind("Compatibility", "ForceLocalModdedModel", true, "While third-person is active, ask known model-swap mods to show the local custom model."); _cameraCloseSmoothTime = ((BaseUnityPlugin)this).Config.Bind("Camera", "CloseSmoothTime", 0.35f, new ConfigDescription("Seconds used to smooth camera distance when moving closer due to collision.", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 1f), Array.Empty())); _cameraFarSmoothTime = ((BaseUnityPlugin)this).Config.Bind("Camera", "FarSmoothTime", 0.35f, new ConfigDescription("Seconds used to smooth camera distance when moving farther away after collision clears.", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 1f), Array.Empty())); _grabCameraDistance = ((BaseUnityPlugin)this).Config.Bind("Camera", "GrabCameraDistance", 1.65f, new ConfigDescription("Temporary third-person camera distance while grabbing so heavy objects remain visible.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 4f), Array.Empty())); _grabCameraOffsetX = ((BaseUnityPlugin)this).Config.Bind("Camera", "GrabCameraOffsetX", 0.45f, new ConfigDescription("Temporary right shoulder camera offset while grabbing.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1.5f), Array.Empty())); _nearFadeStartZoomRatio = ((BaseUnityPlugin)this).Config.Bind("Camera", "NearFadeStartZoomRatio", 0.67f, new ConfigDescription("Start model fade only after zooming in this much of the zoom range (0-1). 0.67 means starts after zooming in about two-thirds.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _nearFadeMinAlpha = ((BaseUnityPlugin)this).Config.Bind("Camera", "NearFadeMinAlpha", 0.1f, new ConfigDescription("Minimum model alpha when camera is very close. 0.1 = about 90% transparent.", (AcceptableValueBase)(object)new AcceptableValueRange(0.02f, 1f), Array.Empty())); _lockRuntimeCameraTuning = ((BaseUnityPlugin)this).Config.Bind("Camera", "LockRuntimeTuning", true, "Lock mouse wheel zoom and runtime camera offset keys to the current config values."); _localTransparencyMode = ((BaseUnityPlugin)this).Config.Bind("Camera", "LocalTransparencyMode", "Disabled", new ConfigDescription("Local player near-camera visibility mode. Disabled keeps the local player model visible at all third-person camera distances.", (AcceptableValueBase)(object)new AcceptableValueList(new string[9] { "Disabled", "ContourOnly", "BoundsOutlineDebug", "SilhouetteClone", "MaterialAndPropertyBlock", "MaterialAlpha", "PropertyBlockOnly", "RendererDisable", "ShadowsOnly" }), Array.Empty())); _silhouetteScale = ((BaseUnityPlugin)this).Config.Bind("Camera", "SilhouetteScale", 1.035f, new ConfigDescription("Scale multiplier for the local-only silhouette clone when Camera.LocalTransparencyMode is SilhouetteClone.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 1.2f), Array.Empty())); _outlineWidth = ((BaseUnityPlugin)this).Config.Bind("Camera", "OutlineWidth", 0.025f, new ConfigDescription("Thickness for ContourOnly local player near-camera mode. BoundsOutlineDebug also uses this as line width.", (AcceptableValueBase)(object)new AcceptableValueRange(0.002f, 0.12f), Array.Empty())); _outlineColorR = ((BaseUnityPlugin)this).Config.Bind("Camera", "OutlineColorR", 0.25f, new ConfigDescription("ContourOnly outline red channel.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _outlineColorG = ((BaseUnityPlugin)this).Config.Bind("Camera", "OutlineColorG", 0.95f, new ConfigDescription("ContourOnly outline green channel.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _outlineColorB = ((BaseUnityPlugin)this).Config.Bind("Camera", "OutlineColorB", 1f, new ConfigDescription("ContourOnly outline blue channel.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _outlineColorA = ((BaseUnityPlugin)this).Config.Bind("Camera", "OutlineColorA", 0.9f, new ConfigDescription("ContourOnly outline alpha channel.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _thirdPersonMapOverlay = ((BaseUnityPlugin)this).Config.Bind("Map", "ThirdPersonScreenOverlay", true, "Show a local-only first-person-style map model in front of the camera while the map is open in third-person."); _mapOverlayX = ((BaseUnityPlugin)this).Config.Bind("Map", "OverlayX", 0f, new ConfigDescription("Local-only third-person map overlay X offset from the camera.", (AcceptableValueBase)(object)new AcceptableValueRange(-2f, 2f), Array.Empty())); _mapOverlayY = ((BaseUnityPlugin)this).Config.Bind("Map", "OverlayY", -0.55f, new ConfigDescription("Local-only third-person map overlay Y offset from the camera.", (AcceptableValueBase)(object)new AcceptableValueRange(-2f, 2f), Array.Empty())); _mapOverlayZ = ((BaseUnityPlugin)this).Config.Bind("Map", "OverlayZ", 0.73f, new ConfigDescription("Local-only third-person map overlay Z offset from the camera.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 3f), Array.Empty())); _mapOverlayScale = ((BaseUnityPlugin)this).Config.Bind("Map", "OverlayScale", 1.55f, new ConfigDescription("Local-only third-person map overlay scale.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 3f), Array.Empty())); _mapOverlayPitch = ((BaseUnityPlugin)this).Config.Bind("Map", "OverlayPitch", -90f, new ConfigDescription("Local-only third-person map overlay pitch.", (AcceptableValueBase)(object)new AcceptableValueRange(-90f, 90f), Array.Empty())); _mapOverlayYaw = ((BaseUnityPlugin)this).Config.Bind("Map", "OverlayYaw", 0f, new ConfigDescription("Local-only third-person map overlay yaw.", (AcceptableValueBase)(object)new AcceptableValueRange(-90f, 90f), Array.Empty())); _mapOverlayRoll = ((BaseUnityPlugin)this).Config.Bind("Map", "OverlayRoll", 0f, new ConfigDescription("Local-only third-person map overlay roll.", (AcceptableValueBase)(object)new AcceptableValueRange(-180f, 180f), Array.Empty())); LockAcceptedMapOverlaySettings(); LockAcceptedCameraCollisionSettings(); LockAcceptedGrabCameraSettings(); _debugShowCameraPoints = ((BaseUnityPlugin)this).Config.Bind("Debug", "ShowCameraPoints", false, "Show debug dots for camera anchor (green) and head center point (red)."); _debugShowGrabSelection = ((BaseUnityPlugin)this).Config.Bind("Debug", "ShowGrabSelection", true, "Show third-person grab debug lines and points. Yellow = camera crosshair ray, cyan/green = character grab ray/valid target, red = unreachable camera hit."); _debugLogCameraSettings = ((BaseUnityPlugin)this).Config.Bind("Debug", "LogCameraSettings", false, "Log camera distance, resolved collision distance, offsets, and aim/camera angles only when camera settings are adjusted."); _debugCameraLogInterval = ((BaseUnityPlugin)this).Config.Bind("Debug", "CameraLogInterval", 1f, new ConfigDescription("Seconds between camera setting logs when Debug.LogCameraSettings is enabled.", (AcceptableValueBase)(object)new AcceptableValueRange(0.2f, 10f), Array.Empty())); _currentDistance = ClampDistance(_defaultDistance.Value); _resolvedDistance = _currentDistance; _resolvedDistanceVelocity = 0f; _gameplayCameraPosition = Vector3.zero; _stableGrabOrigin = Vector3.zero; _grabCameraBlend = 0f; _grabCameraBlendVelocity = 0f; _wasLocalGrabActive = false; _hasGrabAimLockTarget = false; _startingOffsetX = Mathf.Max(0f, _offsetX?.Value ?? 0.45f); _startingOffsetY = _offsetY.Value; _runtimeOffsetX = _startingOffsetX; _runtimeOffsetY = _startingOffsetY; _collisionMask = LayerMask.GetMask(new string[3] { "Default", "Ground", "Wall" }); _selectionTransform = CreatePersistentTransform("REPO Native Third Person Selection Transform"); _debugAnchorPoint = CreateDebugPoint("REPO Native Third Person Anchor Debug", new Color(0.2f, 1f, 0.2f, 0.9f), 0.18f); _debugHeadPoint = CreateDebugPoint("REPO Native Third Person Head Debug", new Color(1f, 0.2f, 0.2f, 0.9f), 0.18f); _debugGrabOriginPoint = CreateDebugPoint("REPO Native Third Person Grab Origin Debug", new Color(0.25f, 0.95f, 1f, 0.95f), 0.16f); _debugGrabCameraHitPoint = CreateDebugPoint("REPO Native Third Person Grab Camera Hit Debug", new Color(1f, 0.85f, 0.1f, 0.95f), 0.14f); _debugGrabTargetPoint = CreateDebugPoint("REPO Native Third Person Grab Target Debug", new Color(0.2f, 1f, 0.2f, 0.95f), 0.18f); CreateInputActions(); _harmony = new Harmony("com.reponativemods.thirdperson"); _harmony.PatchAll(typeof(RepoUpdatePatches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Loaded action-movement build 56 with targeted grab and puke hotfixes. ToggleKey={_toggleKey.Value}, CollisionRadius={_collisionRadius.Value:0.###}, OffsetX={_runtimeOffsetX:0.###}, GrabOffset={_grabCameraOffsetX.Value:0.###}, DebugPoints={_debugShowCameraPoints.Value}, GrabDebug={_debugShowGrabSelection.Value}, TransparencyMode={_localTransparencyMode.Value}, SelectionOrigin={_selectionOriginMode.Value}, RuntimeTuningLocked={_lockRuntimeCameraTuning.Value}"); } private void LockAcceptedMapOverlaySettings() { if (_mapOverlayX != null) { _mapOverlayX.Value = 0f; } if (_mapOverlayY != null) { _mapOverlayY.Value = -0.55f; } if (_mapOverlayZ != null) { _mapOverlayZ.Value = 0.73f; } if (_mapOverlayScale != null) { _mapOverlayScale.Value = 1.55f; } if (_mapOverlayPitch != null) { _mapOverlayPitch.Value = -90f; } if (_mapOverlayYaw != null) { _mapOverlayYaw.Value = 0f; } if (_mapOverlayRoll != null) { _mapOverlayRoll.Value = 0f; } } private void LockAcceptedCameraCollisionSettings() { if (_collisionRadius != null) { _collisionRadius.Value = Mathf.Min(_collisionRadius.Value, 0.035f); } } private void LockAcceptedGrabCameraSettings() { if (_offsetX != null) { _offsetX.Value = 0.45f; } if (_grabCameraOffsetX != null) { _grabCameraOffsetX.Value = 0f; } } private static Transform CreatePersistentTransform(string objectName) { //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_000c: Expected O, but got Unknown GameObject val = new GameObject(objectName); KeepAliveOutsideScene(val); return val.transform; } private static void KeepAliveOutsideScene(GameObject owner) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)owner != (Object)null) { owner.transform.SetParent((Transform)null, true); ((Object)owner).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)owner); } } private void Update() { TickInput(); EnforceFirstPersonLocalModelHidden(); } internal void TickInput() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (_lastInputTickFrame != Time.frameCount) { _lastInputTickFrame = Time.frameCount; if ((IsActionPressedThisFrame(_toggleAction) || IsKeyPressedThisFrame(_toggleKey.Value)) && CanToggleThirdPerson()) { SetThirdPersonActive(!_thirdPersonActive, preserveCrosshair: true); } if (_thirdPersonActive) { HandleZoomInput(); HandleOffsetInput(); } } } internal void TickActionMovement() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //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_0066: 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_0079: Unknown result type (might be due to invalid IL or missing references) if (_lastActionMovementTickFrame == Time.frameCount) { return; } _lastActionMovementTickFrame = Time.frameCount; if (!CanAcceptActionMovementInput()) { return; } PlayerAvatar instance = PlayerAvatar.instance; CameraAim instance2 = CameraAim.Instance; if ((Object)instance != (Object)null && (Object)instance2 != (Object)null) { Vector3 val = ReadCameraRelativeMoveDirection(((Component)instance2).transform); if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { _lastActionMoveDirection = val; _lastActionMoveDirectionTime = Time.time; RotateAvatarTowardMovement(instance, val); } } } internal void TickActionMovementVisuals(PlayerAvatarVisuals visuals) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0027: 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_003b: Expected O, but got Unknown //IL_003b: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0053: 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_0068: Expected O, but got Unknown //IL_0068: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00af: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) if ((Object)visuals == (Object)null || (Object)visuals.playerAvatar == (Object)null || (Object)visuals.playerAvatar != (Object)PlayerAvatar.instance) { return; } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance == (Object)null || (Object)visuals != (Object)instance.playerAvatarVisuals || visuals.isMenuAvatar || (Object)visuals.playerAvatarMenu != (Object)null) { return; } Quaternion rotation2; if (IsLocalGrabActive() && TryGetGameplayAimRotation(out var rotation)) { Quaternion val = (_hasVisualFacingRotation ? _visualFacingRotation : ((Component)visuals).transform.rotation); float num = Mathf.Max(1f, (_actionTurnSpeed?.Value ?? 14f) * 1.5f); float num2 = 1f - Mathf.Exp(0f - num * Mathf.Max(0f, Time.deltaTime)); _visualFacingRotation = Quaternion.Slerp(val, rotation, num2); _hasVisualFacingRotation = true; ApplyVisualFacingRotation(visuals); } else if ((RepoUpdatePatches.IsActionMovementCameraLockHeld() || IsMapAimLockActive()) && TryGetGameplayAimRotation(out rotation2)) { Quaternion val2 = (_hasVisualFacingRotation ? _visualFacingRotation : ((Component)visuals).transform.rotation); float num3 = Mathf.Max(1f, _actionTurnSpeed?.Value ?? 14f); float num4 = 1f - Mathf.Exp(0f - num3 * Mathf.Max(0f, Time.deltaTime)); _visualFacingRotation = Quaternion.Slerp(val2, rotation2, num4); _hasVisualFacingRotation = true; ApplyVisualFacingRotation(visuals); } else { if (!CanAcceptActionMovementInput()) { return; } CameraAim instance2 = CameraAim.Instance; if ((Object)instance2 == (Object)null) { return; } Vector3 moveDirection = ReadGameInputCameraRelativeMoveDirection(((Component)instance2).transform); if (((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f) { if (Time.time - _lastActionMoveDirectionTime > 0.2f) { return; } moveDirection = _lastActionMoveDirection; } if (!(((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f)) { RotateTransformToward(((Component)visuals).transform, moveDirection); } } } private bool IsMapAimLockActive() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && (Object)Map.Instance != (Object)null) { return Map.Instance.Active; } return false; } private bool IsLocalGrabActive() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (!_thirdPersonActive || _temporarilyFirstPerson) { return false; } if ((Object)PhysGrabber.instance != (Object)null && PhysGrabber.instance.grabbed) { return true; } if ((Object)PlayerController.instance != (Object)null) { return PlayerController.instance.physGrabActive; } return false; } internal void BeginActionMovementRewrite(PlayerController controller) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0015: 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_0029: Expected O, but got Unknown //IL_0029: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) _rewriteMovementInput = false; if ((Object)controller == (Object)null || (Object)controller != (Object)PlayerController.instance || !CanAcceptActionMovementInput()) { return; } CameraAim instance = CameraAim.Instance; if ((Object)instance == (Object)null || RepoUpdatePatches.IsActionMovementCameraLockHeld()) { return; } float num = SemiFunc.InputMovementX(); float num2 = SemiFunc.InputMovementY(); if (!(Mathf.Abs(num) <= 0.001f) || !(Mathf.Abs(num2) <= 0.001f)) { Vector3 val = ReadCameraRelativeMoveDirection(((Component)instance).transform, num, num2); if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { _lastActionMoveDirection = val; _lastActionMoveDirectionTime = Time.time; Quaternion val2 = ExactLookRotation(val, ((Component)controller).transform.rotation); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(num, num2); float num3 = Mathf.Clamp01(((Vector2)(ref val3)).magnitude); _rewriteMovementX = 0f; _rewriteMovementY = Mathf.Max(0.01f, num3); _rewriteTurnYaw = ((Quaternion)(ref val2)).eulerAngles.y; _lastRewriteTurnYaw = _rewriteTurnYaw; _hasRewriteTurnYaw = true; _rewriteMovementInput = true; } } } internal void EndActionMovementRewrite() { _rewriteMovementInput = false; } internal void TickActionMovementAfterFixedUpdate(PlayerController controller) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0016: 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_002a: Expected O, but got Unknown //IL_002a: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //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) //IL_005d: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!_rewriteMovementInput || (Object)controller == (Object)null || (Object)controller != (Object)PlayerController.instance || !CanAcceptActionMovementInput() || (Object)CameraAim.Instance == (Object)null) { return; } Vector3 lastActionMoveDirection = _lastActionMoveDirection; if (!(((Vector3)(ref lastActionMoveDirection)).sqrMagnitude < 0.0001f)) { _lastActionMoveDirection = lastActionMoveDirection; _lastActionMoveDirectionTime = Time.time; PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance != (Object)null && (Object)instance.playerAvatarVisuals != (Object)null) { RotateVisualsTowardMovement(instance.playerAvatarVisuals, lastActionMoveDirection, Time.fixedDeltaTime); } } } internal void TickModdedModelPlayerAvatarPostUpdate(object moddedModelPlayerAvatar) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && moddedModelPlayerAvatar != null && IsLocalModdedModelPlayerAvatar(moddedModelPlayerAvatar)) { object obj = _currentModelInstanceField?.GetValue(moddedModelPlayerAvatar); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (!((Object)val == (Object)null)) { StabilizeLocalModdedModel(val); } } } private bool CanAcceptActionMovementInput() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown if (!_thirdPersonActive || _temporarilyFirstPerson || _actionMovementEnabled == null || !_actionMovementEnabled.Value) { return false; } if (!CanAcceptGameplayCameraInput()) { return false; } if (_actionMovementWhileGrabbing == null || !_actionMovementWhileGrabbing.Value) { if ((Object)PhysGrabber.instance != (Object)null && PhysGrabber.instance.grabbed) { return false; } if ((Object)PlayerController.instance != (Object)null && PlayerController.instance.physGrabActive) { return false; } } return true; } private static bool CanAcceptGameplayCameraInput() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Invalid comparison between Unknown and I4 if (!((Object)GameDirector.instance != (Object)null) || (int)GameDirector.instance.currentState != 2) { return false; } if (!((Object)PlayerController.instance != (Object)null) || !((Object)PlayerAvatar.instance != (Object)null) || !((Object)CameraAim.Instance != (Object)null)) { return false; } bool flag = (Object)Map.Instance != (Object)null && Map.Instance.Active; if (!flag && (int)Cursor.lockState != 1) { return false; } if (!flag && (IsAnyMenuPageOpen() || SemiFunc.MenuLevel() || !SemiFunc.NoTextInputsActive())) { return false; } return true; } private static bool CanToggleThirdPerson() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown if (!((Object)GameDirector.instance != (Object)null) || (int)GameDirector.instance.currentState != 2) { return false; } if (!((Object)PlayerController.instance != (Object)null) || !((Object)PlayerAvatar.instance != (Object)null) || !((Object)CameraAim.Instance != (Object)null)) { return false; } if (IsAnyMenuPageOpen() || SemiFunc.MenuLevel() || !SemiFunc.NoTextInputsActive()) { return false; } return true; } private static bool IsAnyMenuPageOpen() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown MenuManager instance = MenuManager.instance; if (!((Object)instance != (Object)null)) { return false; } if (_menuCurrentPageField == null) { _menuCurrentPageField = typeof(MenuManager).GetField("currentMenuPage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj = _menuCurrentPageField?.GetValue(instance); Object val = (Object)((obj is Object) ? obj : null); if (val != (Object)null) { return val != (Object)null; } return false; } private Vector3 ReadCameraRelativeMoveDirection(Transform cameraTransform) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = 0f; if (IsKeyHeld((KeyCode)119)) { num2 += 1f; } if (IsKeyHeld((KeyCode)115)) { num2 -= 1f; } if (IsKeyHeld((KeyCode)100)) { num += 1f; } if (IsKeyHeld((KeyCode)97)) { num -= 1f; } if (Mathf.Abs(num) <= 0.001f && Mathf.Abs(num2) <= 0.001f) { return Vector3.zero; } return ReadCameraRelativeMoveDirection(cameraTransform, num, num2); } private static Vector3 ReadGameInputCameraRelativeMoveDirection(Transform cameraTransform) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ReadCameraRelativeMoveDirection(cameraTransform, SemiFunc.InputMovementX(), SemiFunc.InputMovementY()); } private static Vector3 ReadCameraRelativeMoveDirection(Transform cameraTransform, float horizontal, float vertical) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if ((Object)cameraTransform == (Object)null || (Mathf.Abs(horizontal) <= 0.001f && Mathf.Abs(vertical) <= 0.001f)) { return Vector3.zero; } Vector3 val = cameraTransform.forward; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = cameraTransform.rotation * Vector3.forward; val.y = 0f; } val = ((Vector3)(ref val)).normalized; Vector3 val2 = cameraTransform.right; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.Cross(Vector3.up, val); } val2 = ((Vector3)(ref val2)).normalized; Vector3 result = val * vertical + val2 * horizontal; if (((Vector3)(ref result)).sqrMagnitude > 1f) { result = ((Vector3)(ref result)).normalized; } return result; } private Vector3 ReadActionMovementDirectionFromCamera() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //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_0014: 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_0036: 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) CameraAim instance = CameraAim.Instance; if ((Object)instance == (Object)null) { return Vector3.zero; } Vector3 val = ReadCameraRelativeMoveDirection(((Component)instance).transform); if (((Vector3)(ref val)).sqrMagnitude >= 0.0001f) { _lastActionMoveDirection = val; _lastActionMoveDirectionTime = Time.time; } return val; } private void RotateAvatarTowardMovement(PlayerAvatar avatar, Vector3 moveDirection) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) Transform actionMovementRotationTarget = GetActionMovementRotationTarget(avatar); if ((Object)actionMovementRotationTarget != (Object)null) { RotateTransformToward(actionMovementRotationTarget, moveDirection); } } private void RotateTransformToward(Transform target, Vector3 moveDirection) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) RotateTransformToward(target, moveDirection, Time.deltaTime); } private void RotateTransformToward(Transform target, Vector3 moveDirection, float deltaTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)target == (Object)null)) { moveDirection.y = 0f; if (!(((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f)) { target.rotation = SmoothedLookRotation(target.rotation, moveDirection, deltaTime); } } } private void RotateVisualsTowardMovement(PlayerAvatarVisuals visuals, Vector3 moveDirection, float deltaTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003c: 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_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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)visuals == (Object)null)) { moveDirection.y = 0f; if (!(((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f)) { Quaternion currentRotation = (_hasVisualFacingRotation ? _visualFacingRotation : ((Component)visuals).transform.rotation); _visualFacingRotation = SmoothedLookRotation(currentRotation, moveDirection, deltaTime); _hasVisualFacingRotation = true; ApplyVisualFacingRotation(visuals); } } } private void ApplyVisualFacingRotation(PlayerAvatarVisuals visuals) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_001b: 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) if (_hasVisualFacingRotation && !((Object)visuals == (Object)null)) { ((Component)visuals).transform.rotation = _visualFacingRotation; SetPlayerAvatarVisualsBodySpringTarget(visuals, _visualFacingRotation); } } private void SetPlayerAvatarVisualsBodySpringTarget(PlayerAvatarVisuals visuals, Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!((Object)visuals == (Object)null)) { if (_avatarVisualBodySpringTargetField == null) { _avatarVisualBodySpringTargetField = typeof(PlayerAvatarVisuals).GetField("bodySpringTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _avatarVisualBodySpringTargetField?.SetValue(visuals, rotation); } } private Quaternion SmoothedLookRotation(Quaternion currentRotation, Vector3 moveDirection, float deltaTime) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_006e: 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_0071: Unknown result type (might be due to invalid IL or missing references) moveDirection.y = 0f; if (((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f) { return currentRotation; } Quaternion val = Quaternion.LookRotation(((Vector3)(ref moveDirection)).normalized, Vector3.up); float num = Mathf.Max(1f, _actionTurnSpeed?.Value ?? 14f); float num2 = 1f - Mathf.Exp(0f - num * Mathf.Max(0f, deltaTime)); return Quaternion.Slerp(currentRotation, val, num2); } private void StabilizeCachedLocalModdedModel() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (_thirdPersonActive && !_temporarilyFirstPerson && !((Object)_cachedModelInstance == (Object)null)) { StabilizeLocalModdedModel(_cachedModelInstance); } } private void StabilizeLocalModdedModel(GameObject model) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //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) if (!((Object)model == (Object)null)) { model.transform.rotation = GetStableLocalModelRotation(model.transform.rotation); } } private void LockLocalAvatarVisualsToRoot() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //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_0063: 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) if (!_thirdPersonActive || _temporarilyFirstPerson) { return; } PlayerAvatar instance = PlayerAvatar.instance; if (!((Object)instance == (Object)null) && !((Object)instance.playerAvatarVisuals == (Object)null) && !IsAvatarDeadOrDisabled(instance)) { PlayerAvatarVisuals playerAvatarVisuals = instance.playerAvatarVisuals; Vector3 position = ((Component)instance).transform.position; ((Component)playerAvatarVisuals).transform.position = position; ApplyVisualFacingRotation(playerAvatarVisuals); if (_avatarVisualPositionField == null) { _avatarVisualPositionField = typeof(PlayerAvatarVisuals).GetField("visualPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_avatarVisualFollowLerpField == null) { _avatarVisualFollowLerpField = typeof(PlayerAvatarVisuals).GetField("visualFollowLerp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _avatarVisualPositionField?.SetValue(playerAvatarVisuals, position); _avatarVisualFollowLerpField?.SetValue(playerAvatarVisuals, 1f); } } private Quaternion GetStableLocalModelRotation(Quaternion fallbackRotation) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0007: 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_0043: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (_hasVisualFacingRotation) { return _visualFacingRotation; } PlayerController instance = PlayerController.instance; if ((Object)instance != (Object)null) { return ((Component)instance).transform.rotation; } if (_hasRewriteTurnYaw) { return Quaternion.Euler(0f, _lastRewriteTurnYaw, 0f); } if (((Vector3)(ref _lastActionMoveDirection)).sqrMagnitude > 0.0001f) { return ExactLookRotation(_lastActionMoveDirection, fallbackRotation); } return fallbackRotation; } private static Quaternion ExactLookRotation(Vector3 moveDirection, Quaternion fallbackRotation) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) moveDirection.y = 0f; if (((Vector3)(ref moveDirection)).sqrMagnitude < 0.0001f) { return fallbackRotation; } return Quaternion.LookRotation(((Vector3)(ref moveDirection)).normalized, Vector3.up); } private Transform GetActionMovementRotationTarget(PlayerAvatar avatar) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)avatar != (Object)null)) { return null; } return ((Component)avatar).transform; } private bool TryGetGameplayAimRotation(out Quaternion rotation) { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) rotation = Quaternion.identity; if (!_thirdPersonActive || _temporarilyFirstPerson || !CanAcceptGameplayCameraInput()) { return false; } CameraAim instance = CameraAim.Instance; if ((Object)instance == (Object)null) { return false; } Vector3 forward = ((Component)instance).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { return false; } rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized, Vector3.up); return true; } private bool TryGetGameplayAimYaw(out float yaw) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) yaw = 0f; if (!TryGetGameplayAimRotation(out var rotation)) { return false; } yaw = ((Quaternion)(ref rotation)).eulerAngles.y; return true; } private bool IsCameraLockTemporarilySuppressed() { return Time.time < _cameraLockSuppressUntilTime; } private void SuppressCameraLockForSeconds(float duration) { _cameraLockSuppressUntilTime = Mathf.Max(_cameraLockSuppressUntilTime, Time.time + Mathf.Max(0f, duration)); } private bool TryGetGrabAimRotation(out Quaternion rotation) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_006f: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) rotation = Quaternion.identity; if (!_thirdPersonActive || _temporarilyFirstPerson) { return false; } PhysGrabber instance = PhysGrabber.instance; if ((Object)instance == (Object)null || !instance.grabbed) { return false; } Transform grabbedObjectTransform = instance.grabbedObjectTransform; if ((Object)grabbedObjectTransform == (Object)null) { return false; } PlayerAvatar instance2 = PlayerAvatar.instance; Vector3 val = (((Object)instance2 != (Object)null) ? GetCharacterGrabOrigin(instance2) : Vector3.zero); Vector3 val2 = grabbedObjectTransform.position - val; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { return false; } rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up); return true; } private bool TryGetGrabAimYaw(out float yaw) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) yaw = 0f; if (!TryGetGrabAimRotation(out var rotation)) { return false; } yaw = ((Quaternion)(ref rotation)).eulerAngles.y; return true; } internal void OverridePukeDirection(ref Quaternion direction) { //IL_001c: 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) if (_thirdPersonActive && !_temporarilyFirstPerson && TryGetVisualFacingRotation(out var rotation)) { direction = rotation; } } private bool IsLocalModdedModelPlayerAvatar(object moddedModelPlayerAvatar) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0036: 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_004b: Expected O, but got Unknown //IL_004b: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_008b: Expected O, but got Unknown Component val = (Component)((moddedModelPlayerAvatar is Component) ? moddedModelPlayerAvatar : null); if ((Object)val == (Object)null) { return false; } if ((Object)_cachedModelComponent != (Object)null && (Object)val == (Object)_cachedModelComponent) { return true; } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance == (Object)null) { return false; } PlayerAvatar componentInParent = val.GetComponentInParent(); if ((Object)componentInParent != (Object)null) { return (Object)componentInParent == (Object)instance; } if ((Object)instance.playerAvatarVisuals != (Object)null) { return val.transform.IsChildOf(((Component)instance.playerAvatarVisuals).transform); } return false; } private bool TryGetVisualFacingRotation(out Quaternion rotation) { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0079: 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_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) rotation = Quaternion.identity; if (_hasVisualFacingRotation) { rotation = _visualFacingRotation; return true; } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance != (Object)null && (Object)instance.playerAvatarVisuals != (Object)null) { rotation = ((Component)instance.playerAvatarVisuals).transform.rotation; return true; } PlayerController instance2 = PlayerController.instance; if ((Object)instance2 != (Object)null) { rotation = ((Component)instance2).transform.rotation; return true; } return false; } private void LateUpdate() { TickCamera(); LockLocalAvatarVisualsToRoot(); StabilizeCachedLocalModdedModel(); UpdateThirdPersonMapOverlay(); UpdateLocalModelTransparency(); LogCameraSettingsIfNeeded(); } internal void TickCamera() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown if (_lastCameraTickFrame == Time.frameCount) { return; } _lastCameraTickFrame = Time.frameCount; HandleLifecycleReset(); if (!_thirdPersonActive) { return; } PlayerAvatar instance = PlayerAvatar.instance; CameraAim instance2 = CameraAim.Instance; CameraPosition instance3 = CameraPosition.instance; if (!((Object)instance != (Object)null) || !((Object)instance2 != (Object)null) || !((Object)instance3 != (Object)null)) { return; } if (!CanAcceptGameplayCameraInput()) { EnterTemporaryFirstPerson(instance3, instance); return; } ApplyThirdPersonCompatibility(active: true); if (ShouldTemporarilyUseFirstPerson()) { EnterTemporaryFirstPerson(instance3, instance); return; } _temporarilyFirstPerson = false; Transform transform = ((Component)instance2).transform; UpdateGrabAimLockState(instance); Vector3 val = CalculateCameraPosition(instance, transform); Ray thirdPersonGameplayRay = GetThirdPersonGameplayRay(instance, _gameplayCameraPosition, transform); UpdateSelectionTransform(instance, thirdPersonGameplayRay); Vector3 val2 = val; val2.y -= _thirdPersonCrouchYOffset; instance3.OverridePosition(val2, 0.1f); ((Component)instance3).transform.position = val2; if ((Object)instance.playerAvatarVisuals != (Object)null) { instance.playerAvatarVisuals.ShowSelfOverride(0.15f); } ApplyClipPlanes(); } private void HandleLifecycleReset() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar instance = PlayerAvatar.instance; int num = ((!((Object)GameDirector.instance != (Object)null)) ? (-1) : ((int)GameDirector.instance.currentState)); if (_lastGameState != num) { _lastGameState = num; if (_thirdPersonActive && num != 2) { ResetThirdPersonState("game state changed"); return; } } if ((Object)(object)_lastPlayerAvatar != (Object)(object)instance) { _lastPlayerAvatar = instance; if (_thirdPersonActive) { ResetThirdPersonState("local player changed"); return; } } if (_thirdPersonActive && IsAvatarDeadOrDisabled(instance)) { ResetThirdPersonState("local player died or disabled"); } } private bool IsAvatarDeadOrDisabled(PlayerAvatar avatar) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)avatar == (Object)null) { return true; } Type type = ((object)avatar).GetType(); if (_avatarIsDisabledField == null) { _avatarIsDisabledField = type.GetField("isDisabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_avatarDeadSetField == null) { _avatarDeadSetField = type.GetField("deadSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } try { bool flag = false; int num; if (_avatarIsDisabledField != null) { object value = _avatarIsDisabledField.GetValue(avatar); if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return true; } bool flag2 = false; int num2; if (_avatarDeadSetField != null) { object value2 = _avatarDeadSetField.GetValue(avatar); if (value2 is bool) { flag2 = (bool)value2; num2 = 1; } else { num2 = 0; } } else { num2 = 0; } if (((uint)num2 & (flag2 ? 1u : 0u)) != 0) { return true; } } catch { } return false; } private void ResetThirdPersonState(string reason) { //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) //IL_0053: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (_thirdPersonActive) { _thirdPersonActive = false; _temporarilyFirstPerson = false; _currentDistance = ClampDistance(_defaultDistance.Value); _resolvedDistance = _currentDistance; _resolvedDistanceVelocity = 0f; _gameplayCameraPosition = Vector3.zero; _stableGrabOrigin = Vector3.zero; _grabCameraBlend = 0f; _grabCameraBlendVelocity = 0f; _wasLocalGrabActive = false; _hasGrabAimLockTarget = false; _thirdPersonCrouchYOffset = 0f; _thirdPersonCrouchYOffsetVelocity = 0f; _forceFirstPersonLocalModelHiddenUntil = Time.time + 1f; ApplyThirdPersonCompatibility(active: false); CameraPosition instance = CameraPosition.instance; if ((Object)instance != (Object)null && (Object)instance.playerTransform != (Object)null) { ClearCameraOverride(instance); instance.OverridePosition(Vector3.zero, 0f); } PlayerAvatar instance2 = PlayerAvatar.instance; if ((Object)instance2 != (Object)null && (Object)instance2.playerAvatarVisuals != (Object)null) { instance2.playerAvatarVisuals.ShowSelfOverride(0f); } RestoreClipPlanes(); RestoreObstructionTransparency(); RestoreSilhouetteRenderers(); HideLocalMapOverlay(); HideDebugPoints(); _lastActionMoveDirection = Vector3.zero; _lastActionMoveDirectionTime = 0f; _hasRewriteTurnYaw = false; _hasVisualFacingRotation = false; SuppressCameraLockForSeconds(0.2f); RestoreLocalModelMotionVectors(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Third-person camera reset: " + reason + ".")); } } private void OnDisable() { SetThirdPersonActive(active: false); HideLocalMapOverlay(); } private void OnDestroy() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown SetThirdPersonActive(active: false); HideLocalMapOverlay(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _harmony = null; DisposeInputActions(); if ((Object)_selectionTransform != (Object)null) { Object.Destroy((Object)(object)((Component)_selectionTransform).gameObject); _selectionTransform = null; } if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void SetThirdPersonActive(bool active, bool preserveCrosshair = false) { //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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) if (_thirdPersonActive == active) { return; } Vector3 target = Vector3.zero; bool flag = preserveCrosshair && TryGetCurrentCrosshairWorldTarget(out target); _thirdPersonActive = active; if (active) { _currentDistance = ClampDistance(_defaultDistance.Value); _resolvedDistance = _currentDistance; _resolvedDistanceVelocity = 0f; _grabCameraBlend = 0f; _grabCameraBlendVelocity = 0f; _wasLocalGrabActive = false; _hasGrabAimLockTarget = false; _thirdPersonCrouchYOffset = 0f; _thirdPersonCrouchYOffsetVelocity = 0f; SuppressCameraLockForSeconds(0.2f); ApplyClipPlanes(); ApplyThirdPersonCompatibility(active: true); if (flag) { AlignAimToCrosshairTarget(target, enteringThirdPerson: true); } CaptureCurrentAimAsVisualFacing(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Third-person camera enabled."); return; } _currentDistance = ClampDistance(_defaultDistance.Value); _resolvedDistance = _currentDistance; _resolvedDistanceVelocity = 0f; _gameplayCameraPosition = Vector3.zero; _stableGrabOrigin = Vector3.zero; _grabCameraBlend = 0f; _grabCameraBlendVelocity = 0f; _wasLocalGrabActive = false; _hasGrabAimLockTarget = false; _forceFirstPersonLocalModelHiddenUntil = Time.time + 1f; RestoreLocalRendererTransparency(); ApplyThirdPersonCompatibility(active: false); CameraPosition instance = CameraPosition.instance; if ((Object)instance != (Object)null && (Object)instance.playerTransform != (Object)null) { ForceExitThirdPersonCamera(instance); } PlayerAvatar instance2 = PlayerAvatar.instance; if ((Object)instance2 != (Object)null && (Object)instance2.playerAvatarVisuals != (Object)null) { instance2.playerAvatarVisuals.ShowSelfOverride(0f); } if (flag) { AlignAimToCrosshairTarget(target, enteringThirdPerson: false); } RestoreObstructionTransparency(); RestoreClipPlanes(); HideDebugPoints(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Third-person camera disabled."); } private static bool ShouldTemporarilyUseFirstPerson() { return false; } private void CaptureCurrentAimAsVisualFacing() { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) CameraAim instance = CameraAim.Instance; Quaternion visualFacingRotation = Quaternion.identity; bool flag = false; if ((Object)instance != (Object)null) { Vector3 forward = ((Component)instance).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f) { visualFacingRotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized, Vector3.up); flag = true; } } if (!flag && (Object)PlayerController.instance != (Object)null) { visualFacingRotation = ((Component)PlayerController.instance).transform.rotation; flag = true; } if (flag) { _visualFacingRotation = visualFacingRotation; _hasVisualFacingRotation = true; } } private bool TryGetCurrentCrosshairWorldTarget(out Vector3 target) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //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_003b: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ba: 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_0088: Unknown result type (might be due to invalid IL or missing references) target = Vector3.zero; Camera main = Camera.main; if ((Object)main == (Object)null) { return false; } Ray val = main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); int mask = LayerMask.GetMask(new string[1] { "Player" }); int num = GetCameraOcclusionMask() & ~mask; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Ray)(ref val)).origin, ((Ray)(ref val)).direction, ref val2, 100f, num, (QueryTriggerInteraction)1)) { target = ((RaycastHit)(ref val2)).point; return true; } Vector3 origin = ((Ray)(ref val)).origin; Vector3 direction = ((Ray)(ref val)).direction; target = origin + ((Vector3)(ref direction)).normalized * 20f; return true; } private void AlignAimToCrosshairTarget(Vector3 target, bool enteringThirdPerson) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0048: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar instance = PlayerAvatar.instance; CameraAim instance2 = CameraAim.Instance; if ((Object)instance == (Object)null || (Object)instance2 == (Object)null) { return; } Quaternion val = ((Component)instance2).transform.rotation; for (int i = 0; i < 3; i++) { Vector3 val2 = (enteringThirdPerson ? EstimateThirdPersonCameraPosition(instance, val) : GetFirstPersonAimOrigin(instance)); Vector3 val3 = target - val2; if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f) { return; } val = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up); } instance2.SetPlayerAim(val, true); instance2.OverrideNoSmooth(0.08f); } private Vector3 EstimateThirdPersonCameraPosition(PlayerAvatar avatar, Quaternion aimRotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 headCenterPoint = GetHeadCenterPoint(avatar); float num = ClampDistance(_defaultDistance.Value); return headCenterPoint - aimRotation * Vector3.forward * num; } private Vector3 GetFirstPersonAimOrigin(PlayerAvatar avatar) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0022: 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) CameraPosition instance = CameraPosition.instance; if ((Object)instance != (Object)null) { return ((Component)instance).transform.position; } return GetHeadCenterPoint(avatar); } private void EnterTemporaryFirstPerson(CameraPosition cameraPosition, PlayerAvatar avatar) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown if (!_temporarilyFirstPerson) { _temporarilyFirstPerson = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Map/tablet active; temporarily using first-person camera."); } _forceFirstPersonLocalModelHiddenUntil = Time.time + 1f; if ((Object)cameraPosition != (Object)null && (Object)cameraPosition.playerTransform != (Object)null) { ForceExitThirdPersonCamera(cameraPosition); } RestoreLocalRendererTransparency(); if ((Object)avatar != (Object)null && (Object)avatar.playerAvatarVisuals != (Object)null) { avatar.playerAvatarVisuals.ShowSelfOverride(0f); } HideForcedLocalModel(); HideDebugPoints(); RestoreObstructionTransparency(); } private void EnforceFirstPersonLocalModelHidden() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if ((!_thirdPersonActive || _temporarilyFirstPerson) && (!_thirdPersonActive || !(Time.time > _forceFirstPersonLocalModelHiddenUntil))) { RestoreLocalRendererTransparency(); PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance != (Object)null && (Object)instance.playerAvatarVisuals != (Object)null) { instance.playerAvatarVisuals.ShowSelfOverride(0f); } HideForcedLocalModel(); } } private static void ClearCameraOverride(CameraPosition cameraPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_009e: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if ((Object)cameraPosition == (Object)null || (Object)cameraPosition.playerTransform == (Object)null) { return; } if ((Object)Instance != (Object)null) { if (Instance._cameraPositionOverrideTimerField == null) { Instance._cameraPositionOverrideTimerField = typeof(CameraPosition).GetField("overridePositionTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (Instance._cameraPositionOverrideTargetField == null) { Instance._cameraPositionOverrideTargetField = typeof(CameraPosition).GetField("overridePositionTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } } Vector3 val = cameraPosition.playerTransform.localPosition + cameraPosition.playerOffset; Instance?._cameraPositionOverrideTimerField?.SetValue(cameraPosition, 0f); Instance?._cameraPositionOverrideTargetField?.SetValue(cameraPosition, val); cameraPosition.PositionOverrideToggled(val, false); ((Component)cameraPosition).transform.localRotation = Quaternion.identity; } private void ForceExitThirdPersonCamera(CameraPosition cameraPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown if ((Object)cameraPosition == (Object)null || (Object)cameraPosition.playerTransform == (Object)null) { return; } Vector3 val = cameraPosition.playerTransform.localPosition + cameraPosition.playerOffset; ClearCameraOverride(cameraPosition); cameraPosition.OverridePosition(val, 0f); Transform transform = ((Component)cameraPosition).transform; transform.localPosition = val; if ((Object)transform.parent != (Object)null) { transform.position = transform.parent.TransformPoint(val); } else { transform.position = val; } transform.localRotation = Quaternion.identity; PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance != (Object)null) { PhysGrabber physGrabber = instance.physGrabber; if ((Object)(object)physGrabber != (Object)null) { physGrabber.SetThirdPerson(false); } FlashlightController flashlightController = instance.flashlightController; if ((Object)(object)flashlightController != (Object)null) { flashlightController.SetThirdPerson(false); } } } private void ForceCameraCrouchLocalPosition(CameraCrouchPosition crouchPosition) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!IsInGameplayAndNotMenu() || (Object)crouchPosition == (Object)null) { return; } if (_cameraCrouchLerpField == null) { _cameraCrouchLerpField = typeof(CameraCrouchPosition).GetField("Lerp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (!(_cameraCrouchLerpField == null)) { object value = _cameraCrouchLerpField.GetValue(crouchPosition); if (value is float) { float num = (float)value; float num2 = Mathf.Clamp01(num); float num3 = crouchPosition.AnimationCurve.Evaluate(num2) * crouchPosition.Position; ((Component)crouchPosition).transform.localPosition = new Vector3(0f, num3, 0f); } } } private void ForceCameraCrawlLocalPosition(CameraCrawlPosition crawlPosition) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!IsInGameplayAndNotMenu() || (Object)crawlPosition == (Object)null) { return; } if (_cameraCrawlLerpField == null) { _cameraCrawlLerpField = typeof(CameraCrawlPosition).GetField("Lerp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (!(_cameraCrawlLerpField == null)) { object value = _cameraCrawlLerpField.GetValue(crawlPosition); if (value is float) { float num = (float)value; float num2 = Mathf.Clamp01(num); float num3 = crawlPosition.AnimationCurve.Evaluate(num2) * crawlPosition.Position; ((Component)crawlPosition).transform.localPosition = new Vector3(0f, num3, 0f); } } } private void ApplyFirstPersonCrouchLocalOffset(CameraPosition cameraPosition) { } private float GetCrouchCameraYOffset() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_005b: 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) PlayerController instance = PlayerController.instance; if ((Object)instance == (Object)null) { return 0f; } if (!instance.Crouching && !instance.Crawling && !instance.Sliding) { return 0f; } float num = 0f; if ((Object)CameraCrouchPosition.instance != (Object)null) { num += ((Component)CameraCrouchPosition.instance).transform.localPosition.y; } if ((Object)CameraCrawlPosition.instance != (Object)null) { num += ((Component)CameraCrawlPosition.instance).transform.localPosition.y; } if (Mathf.Abs(num) <= 0.001f) { if (instance.Crawling) { num = -1.05f; } else if (instance.Crouching || instance.Sliding) { num = -0.65f; } } return Mathf.Clamp(num, -1.4f, 0.05f); } private void NormalizeFirstPersonOverrideActive(PlayerLocalCamera localCamera, ref bool overrideActive) { if (ShouldForceFirstPersonCrouchMode(localCamera)) { overrideActive = false; } } private void NormalizeFirstPersonOverrideTransform(PlayerLocalCamera localCamera, ref Transform transform) { if (ShouldForceFirstPersonCrouchMode(localCamera)) { transform = ((Component)localCamera).transform; } } private bool ShouldForceFirstPersonCrouchMode(PlayerLocalCamera localCamera) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown if (!IsInGameplayAndNotMenu()) { return false; } if ((Object)localCamera == (Object)null || (Object)localCamera.playerAvatar == (Object)null || (Object)(object)localCamera.playerAvatar != (Object)(object)PlayerAvatar.instance) { return false; } if (_thirdPersonActive || _temporarilyFirstPerson) { return false; } if ((Object)Map.Instance != (Object)null && Map.Instance.Active) { return false; } return true; } private bool IsInGameplayAndNotMenu() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if ((Object)GameDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2) { return false; } if (SemiFunc.MenuLevel()) { return false; } if ((Object)PlayerController.instance == (Object)null || (Object)PlayerAvatar.instance == (Object)null) { return false; } return true; } private void ApplyThirdPersonCompatibility(bool active) { _localModdedModelVisible = false; if (_forceLocalModdedModel == null || !_forceLocalModdedModel.Value) { return; } if (!EnsureModdedModelCompatibilityCached()) { if (active && !_loggedModelCompatibilityMissing) { _loggedModelCompatibilityMissing = true; ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find ModdedModelPlayerAvatar.ForceShowLocalModel yet; local model compatibility will retry occasionally while third-person is active."); } return; } _forceShowLocalModelField?.SetValue(null, active); if (active) { _localModdedModelVisible = ForceVisibleLocalModdedModel(PlayerAvatar.instance); return; } HideForcedLocalModel(); _cachedModelAvatar = null; _cachedModelComponent = null; _cachedModelInstance = null; _cachedForcedRenderers = null; _localModdedModelVisible = false; } private bool ForceVisibleLocalModdedModel(PlayerAvatar avatar) { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown if (_forceLocalModdedModel == null || !_forceLocalModdedModel.Value || !_thirdPersonActive || _temporarilyFirstPerson || !((Object)avatar != (Object)null)) { return false; } if (!EnsureModdedModelCompatibilityCached()) { return false; } _forceShowLocalModelField?.SetValue(null, true); if ((Object)(object)_cachedModelAvatar != (Object)(object)avatar || (Object)_cachedModelComponent == (Object)null) { _cachedModelAvatar = avatar; _cachedModelComponent = ((Component)avatar).GetComponent(_moddedModelPlayerAvatarType) ?? ((Component)avatar).GetComponentInChildren(_moddedModelPlayerAvatarType, true); _cachedModelInstance = null; _cachedForcedRenderers = null; } Component cachedModelComponent = _cachedModelComponent; if (!((Object)cachedModelComponent != (Object)null)) { return false; } object obj = _currentModelInstanceField?.GetValue(cachedModelComponent); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (!((Object)val != (Object)null) && _applyModelToVisualMethod != null && (Object)avatar.playerAvatarVisuals != (Object)null && Time.time >= _nextModelCompatibilityRetryTime) { _nextModelCompatibilityRetryTime = Time.time + 1f; try { _applyModelToVisualMethod.Invoke(cachedModelComponent, new object[1] { avatar.playerAvatarVisuals }); object obj2 = _currentModelInstanceField?.GetValue(cachedModelComponent); val = (GameObject)((obj2 is GameObject) ? obj2 : null); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[ThirdPersonCompat] ApplyModelToVisual failed: " + ex.Message)); } } if (!((Object)val != (Object)null)) { return false; } val.SetActive(true); if ((Object)(object)_cachedModelInstance != (Object)(object)val) { _cachedModelInstance = val; List list = new List(); if (_cachedModelRenderersField?.GetValue(cachedModelComponent) is IEnumerable enumerable) { foreach (object item in enumerable) { Renderer val2 = (Renderer)((item is Renderer) ? item : null); if ((Object)(object)val2 != (Object)null && (Object)val2 != (Object)null) { list.Add(val2); } } } if (list.Count == 0) { list.AddRange(val.GetComponentsInChildren(true)); } _cachedForcedRenderers = list.ToArray(); _nextRendererRefreshTime = 0f; } if (_cachedForcedRenderers != null && Time.time >= _nextRendererRefreshTime) { _nextRendererRefreshTime = Time.time + 0.5f; Renderer[] cachedForcedRenderers = _cachedForcedRenderers; foreach (Renderer val3 in cachedForcedRenderers) { if ((Object)val3 != (Object)null) { val3.enabled = true; } } ApplyLocalVisibleModelRendererCompatibility(_cachedForcedRenderers); } if (!_loggedModelCompatibility) { _loggedModelCompatibility = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Forced local ModdedModelPlayerAvatar model visible for third-person camera."); } return true; } private void HideForcedLocalModel() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (_cachedForcedRenderers != null) { Renderer[] cachedForcedRenderers = _cachedForcedRenderers; foreach (Renderer val in cachedForcedRenderers) { if ((Object)val != (Object)null) { val.enabled = false; } } } if ((Object)_cachedModelInstance != (Object)null) { _cachedModelInstance.SetActive(false); } _forceShowLocalModelField?.SetValue(null, false); _localModdedModelVisible = false; } private void ApplyNoMotionVectorsToAvatarVisuals(PlayerAvatarVisuals visuals) { } private void ApplyLocalVisibleModelRendererCompatibility(IEnumerable renderers) { } private void RestoreLocalModelMotionVectors() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown RestoreLocalRendererTransparency(); foreach (KeyValuePair originalRendererMotionVector in _originalRendererMotionVectors) { if ((Object)originalRendererMotionVector.Key != (Object)null) { originalRendererMotionVector.Key.motionVectorGenerationMode = originalRendererMotionVector.Value; } } _originalRendererMotionVectors.Clear(); foreach (KeyValuePair originalRendererLayer in _originalRendererLayers) { if ((Object)originalRendererLayer.Key != (Object)null) { originalRendererLayer.Key.layer = originalRendererLayer.Value; } } _originalRendererLayers.Clear(); _cachedAvatarVisualsForMotionVectors = null; _cachedAvatarVisualRenderers = null; _nextAvatarRendererRefreshTime = 0f; } private void ApplyThirdPersonMotionBlurOverride(bool active) { if (!active) { RestoreThirdPersonMotionBlurOverride(); } } private void UpdateThirdPersonMapOverlay() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00fd: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (!_thirdPersonActive || _temporarilyFirstPerson || _thirdPersonMapOverlay == null || !_thirdPersonMapOverlay.Value) { HideLocalMapOverlay(); return; } MapToolController instance = MapToolController.instance; if ((Object)instance == (Object)null || (Object)instance.VisualTransform == (Object)null || (Object)Map.Instance == (Object)null || !Map.Instance.Active) { HideLocalMapOverlay(); return; } Camera main = Camera.main; if ((Object)main == (Object)null) { HideLocalMapOverlay(); return; } EnsureLocalMapOverlay(instance); if (!((Object)_localMapOverlayClone == (Object)null)) { Transform transform = ((Component)main).transform; _localMapOverlayClone.transform.SetParent((Transform)null, true); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(_mapOverlayX.Value, _mapOverlayY.Value, _mapOverlayZ.Value); _localMapOverlayClone.transform.position = transform.TransformPoint(val); _localMapOverlayClone.transform.rotation = transform.rotation * Quaternion.Euler(_mapOverlayPitch.Value, _mapOverlayYaw.Value, _mapOverlayRoll.Value); _localMapOverlayClone.transform.localScale = Vector3.one * _mapOverlayScale.Value; ResetLocalMapOverlayVisualPose(instance); if (!_localMapOverlayClone.activeSelf) { _localMapOverlayClone.SetActive(true); } LogMapOverlaySettingsIfNeeded(); } } private void LogMapOverlaySettingsIfNeeded() { if (!(Time.time < _nextMapOverlayLogTime)) { _nextMapOverlayLogTime = Time.time + 1f; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[ThirdPersonMapOverlay] x={_mapOverlayX.Value:0.###}, y={_mapOverlayY.Value:0.###}, z={_mapOverlayZ.Value:0.###}, scale={_mapOverlayScale.Value:0.###}, pitch={_mapOverlayPitch.Value:0.###}, yaw={_mapOverlayYaw.Value:0.###}, roll={_mapOverlayRoll.Value:0.###}"); } } private void EnsureLocalMapOverlay(MapToolController controller) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00a5: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown if ((Object)_localMapOverlayClone != (Object)null && (Object)(object)_localMapOverlaySource == (Object)(object)controller) { return; } HideLocalMapOverlay(); if ((Object)controller == (Object)null || (Object)controller.VisualTransform == (Object)null) { return; } _localMapOverlaySource = controller; _localMapOverlayClone = new GameObject("REPO Native Third Person Local Map Overlay"); KeepAliveOutsideScene(_localMapOverlayClone); GameObject val = Object.Instantiate(((Component)controller.VisualTransform).gameObject); ((Object)val).name = "REPO Native Third Person Local Map Overlay Visual"; val.transform.SetParent(_localMapOverlayClone.transform, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; _localMapOverlayVisualRoot = val.transform; MonoBehaviour[] componentsInChildren = _localMapOverlayClone.GetComponentsInChildren(true); foreach (MonoBehaviour val2 in componentsInChildren) { if ((Object)val2 != (Object)null) { ((Behaviour)val2).enabled = false; } } Collider[] componentsInChildren2 = _localMapOverlayClone.GetComponentsInChildren(true); foreach (Collider val3 in componentsInChildren2) { if ((Object)val3 != (Object)null) { val3.enabled = false; } } Renderer[] componentsInChildren3 = _localMapOverlayClone.GetComponentsInChildren(true); foreach (Renderer val4 in componentsInChildren3) { if ((Object)val4 != (Object)null) { val4.shadowCastingMode = (ShadowCastingMode)0; val4.receiveShadows = false; } } int num = LayerMask.NameToLayer("TopLayer"); if (num < 0) { num = LayerMask.NameToLayer("PlayerVisualsLocal"); } if (num >= 0) { SetLayerRecursive(_localMapOverlayClone, num); } _localMapOverlayClone.SetActive(false); ResetLocalMapOverlayVisualPose(controller); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Created local-only third-person map overlay clone."); } private void HideLocalMapOverlay() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)_localMapOverlayClone != (Object)null) { Object.Destroy((Object)(object)_localMapOverlayClone); _localMapOverlayClone = null; } _localMapOverlayVisualRoot = null; _localMapOverlaySource = null; } private void ResetLocalMapOverlayVisualPose(MapToolController controller) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0027: 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_0047: Unknown result type (might be due to invalid IL or missing references) if (!((Object)_localMapOverlayVisualRoot == (Object)null) && !((Object)controller == (Object)null)) { _localMapOverlayVisualRoot.localPosition = Vector3.zero; _localMapOverlayVisualRoot.localRotation = Quaternion.identity; _localMapOverlayVisualRoot.localScale = Vector3.one; ResetClonedLocalRotation(controller.HideTransform); ResetClonedLocalRotation(controller.displaySpringTransform); ResetClonedLocalRotation(controller.mainSpringTransform); } } private void ResetClonedLocalRotation(Transform source) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) Transform val = FindLocalMapOverlayCloneTransform(source); if (!((Object)val == (Object)null)) { val.localRotation = Quaternion.identity; } } private Transform FindLocalMapOverlayCloneTransform(Transform source) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown if ((Object)source == (Object)null || (Object)_localMapOverlaySource == (Object)null || (Object)_localMapOverlaySource.VisualTransform == (Object)null || (Object)_localMapOverlayVisualRoot == (Object)null) { return null; } string relativeTransformPath = GetRelativeTransformPath(_localMapOverlaySource.VisualTransform, source); if (!string.IsNullOrEmpty(relativeTransformPath)) { return _localMapOverlayVisualRoot.Find(relativeTransformPath); } return _localMapOverlayVisualRoot; } private static string GetRelativeTransformPath(Transform root, Transform child) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_001f: 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_002f: Expected O, but got Unknown //IL_002f: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_008b: Expected O, but got Unknown //IL_0068: 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_0078: Expected O, but got Unknown //IL_0078: Expected O, but got Unknown if ((Object)root == (Object)null || (Object)child == (Object)null) { return null; } if ((Object)root == (Object)child) { return string.Empty; } Stack stack = new Stack(); Transform val = child; while ((Object)val != (Object)null && (Object)val != (Object)root) { stack.Push(((Object)((Component)val).gameObject).name); val = val.parent; } if ((Object)val != (Object)root) { return null; } return string.Join("/", stack.ToArray()); } private static void SetLayerRecursive(GameObject owner, int layer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if ((Object)owner == (Object)null) { return; } owner.layer = layer; Transform[] componentsInChildren = owner.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if ((Object)val != (Object)null) { ((Component)val).gameObject.layer = layer; } } } private void RestoreThirdPersonMotionBlurOverride() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (_motionBlurOverrideActive) { MotionBlur postProcessingMotionBlur = GetPostProcessingMotionBlur(); if ((Object)postProcessingMotionBlur != (Object)null) { ((ParameterOverride)(object)postProcessingMotionBlur.shutterAngle).value = _motionBlurOriginalShutterAngle; ((PostProcessEffectSettings)postProcessingMotionBlur).active = _motionBlurOriginalActive; } _motionBlurOverrideActive = false; } } private MotionBlur GetPostProcessingMotionBlur() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown PostProcessing instance = PostProcessing.Instance; if ((Object)instance == (Object)null) { return null; } if (_postProcessingMotionBlurField == null) { _postProcessingMotionBlurField = typeof(PostProcessing).GetField("motionBlur", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj = _postProcessingMotionBlurField?.GetValue(instance); return (MotionBlur)((obj is MotionBlur) ? obj : null); } private bool EnsureModdedModelCompatibilityCached() { if (_moddedModelPlayerAvatarType != null) { return true; } if (Time.time < _nextModelCompatibilityRetryTime) { return false; } _nextModelCompatibilityRetryTime = Time.time + 1f; _moddedModelPlayerAvatarType = FindLoadedType("ModdedModelPlayerAvatar"); if (_moddedModelPlayerAvatarType == null || !typeof(Component).IsAssignableFrom(_moddedModelPlayerAvatarType)) { _moddedModelPlayerAvatarType = null; return false; } _forceShowLocalModelField = _moddedModelPlayerAvatarType.GetField("ForceShowLocalModel", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _currentModelInstanceField = _moddedModelPlayerAvatarType.GetField("currentModelInstance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _cachedModelRenderersField = _moddedModelPlayerAvatarType.GetField("_cachedModelRenderers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _applyModelToVisualMethod = _moddedModelPlayerAvatarType.GetMethod("ApplyModelToVisual", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); TryPatchModdedModelUpdate(); return _forceShowLocalModelField != null; } private void TryPatchModdedModelUpdate() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if (_moddedModelUpdatePatched || _harmony == null || _moddedModelPlayerAvatarType == null) { return; } MethodInfo method = _moddedModelPlayerAvatarType.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method2 = typeof(RepoUpdatePatches).GetMethod("ModdedModelPlayerAvatarUpdatePostfix", BindingFlags.Static | BindingFlags.NonPublic); if (method == null || method2 == null) { return; } try { HarmonyMethod val = new HarmonyMethod(method2); val.priority = 0; _harmony.Patch((MethodBase)method, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _moddedModelUpdatePatched = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched ModdedModelPlayerAvatar.Update for action-movement facing."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[ThirdPersonCompat] Failed to patch ModdedModelPlayerAvatar.Update: " + ex.Message)); } } private static bool SetKnownStaticBool(string typeName, string fieldName, bool value) { Type type = FindLoadedType(typeName); if (type == null) { return false; } FieldInfo field = type.GetField(fieldName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(bool)) { field.SetValue(null, value); return true; } return false; } private static Type FindLoadedType(string typeName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = assembly.GetType(typeName); if (type != null) { return type; } try { Type[] types = assembly.GetTypes(); foreach (Type type2 in types) { if (type2.Name == typeName) { return type2; } } } catch (ReflectionTypeLoadException ex) { Type[] types = ex.Types; foreach (Type type3 in types) { if (type3 != null && type3.Name == typeName) { return type3; } } } } return null; } private void HandleZoomInput() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (_lockRuntimeCameraTuning != null && _lockRuntimeCameraTuning.Value) { _currentDistance = ClampDistance(_defaultDistance?.Value ?? 3f); } else if (CanAcceptZoomInput()) { float currentDistance = _currentDistance; float num = ReadScrollWheel(); if (Mathf.Abs(num) > 0.001f) { _currentDistance -= num * _scrollSensitivity.Value; } if (IsActionHeld(_zoomInAction) || IsKeyHeld(_zoomInKey.Value)) { _currentDistance -= _keyZoomSpeed.Value * Time.deltaTime; } if (IsActionHeld(_zoomOutAction) || IsKeyHeld(_zoomOutKey.Value)) { _currentDistance += _keyZoomSpeed.Value * Time.deltaTime; } _currentDistance = ClampDistance(_currentDistance); if (Mathf.Abs(_currentDistance - currentDistance) > 0.001f) { LogCameraSettings("Camera distance adjusted"); } } } private void HandleOffsetInput() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (_lockRuntimeCameraTuning != null && _lockRuntimeCameraTuning.Value) { _runtimeOffsetX = _startingOffsetX; _runtimeOffsetY = _startingOffsetY; } else { if (!CanAcceptOffsetInput()) { return; } if (IsKeyPressedThisFrame(_resetOffsetsKey.Value)) { _runtimeOffsetX = _startingOffsetX; _runtimeOffsetY = _startingOffsetY; LogCameraSettings("Camera offset reset"); return; } float num = _offsetAdjustSpeed.Value * Time.deltaTime; if (!(num <= 0f)) { float runtimeOffsetY = _runtimeOffsetY; if (IsKeyHeld((KeyCode)273)) { _runtimeOffsetY += num; } if (IsKeyHeld((KeyCode)274)) { _runtimeOffsetY -= num; } if (Mathf.Abs(_runtimeOffsetY - runtimeOffsetY) > 0.001f) { LogCameraSettings("Camera offset adjusted"); } } } } private static bool CanAcceptZoomInput() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (!CanAcceptGameplayCameraInput()) { return false; } if ((Object)PhysGrabber.instance != (Object)null && PhysGrabber.instance.grabbed) { return false; } if ((Object)PlayerController.instance != (Object)null && PlayerController.instance.physGrabActive) { return false; } return true; } private static bool CanAcceptOffsetInput() { return CanAcceptGameplayCameraInput(); } private void LogCameraSettingsIfNeeded() { } private void LogCameraSettings(string reason) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0099: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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) Transform val = (((Object)CameraAim.Instance != (Object)null) ? ((Component)CameraAim.Instance).transform : null); Camera main = Camera.main; Vector3 val2; Quaternion rotation; if (!((Object)val != (Object)null)) { val2 = Vector3.zero; } else { rotation = val.rotation; val2 = ((Quaternion)(ref rotation)).eulerAngles; } Vector3 val3 = val2; Vector3 val4; if (!((Object)main != (Object)null)) { val4 = Vector3.zero; } else { rotation = ((Component)main).transform.rotation; val4 = ((Quaternion)(ref rotation)).eulerAngles; } Vector3 val5 = val4; Vector3 val6 = (((Object)main != (Object)null) ? ((Component)main).transform.position : Vector3.zero); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[ThirdPersonCameraSettings] {reason}: distance={_currentDistance:0.###}, resolved={_resolvedDistance:0.###}, offsetX={_runtimeOffsetX:0.###}, offsetY={_runtimeOffsetY:0.###}, min={_minDistance.Value:0.###}, max={_maxDistance.Value:0.###}, closeSmooth={_cameraCloseSmoothTime.Value:0.###}, farSmooth={_cameraFarSmoothTime.Value:0.###}, aimEuler={val3}, cameraEuler={val5}, cameraPos={val6}"); } private Vector3 GetDynamicCameraAnchor(PlayerAvatar avatar, Transform aimTransform) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GetHeadCenterPoint(avatar); } private Vector3 GetHeadCenterPoint(PlayerAvatar avatar) { //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_003a: 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_0065: 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) Vector3 position = ((Component)avatar).transform.position; float crouchCameraYOffset = GetCrouchCameraYOffset(); _thirdPersonCrouchYOffset = Mathf.SmoothDamp(_thirdPersonCrouchYOffset, crouchCameraYOffset, ref _thirdPersonCrouchYOffsetVelocity, 0.12f, float.PositiveInfinity, Time.deltaTime); float num = position.y + Mathf.Clamp(_runtimeOffsetY + _thirdPersonCrouchYOffset, 0.15f, 2.2f); return new Vector3(position.x, num, position.z); } private Vector3 CalculateCameraPosition(PlayerAvatar avatar, Transform aimTransform) { //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_000a: 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_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) //IL_0036: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0084: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (_stableGrabOrigin = GetHeadCenterPoint(avatar)); UpdateGrabCameraBlend(); float effectiveCameraDistance = GetEffectiveCameraDistance(); float effectiveCameraOffsetX = GetEffectiveCameraOffsetX(); Vector3 val2 = (_gameplayCameraPosition = val - aimTransform.forward * effectiveCameraDistance + aimTransform.right * effectiveCameraOffsetX) - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude <= 0.001f) { _resolvedDistance = 0.05f; _gameplayCameraPosition = val; _stableGrabOrigin = val; return val; } Vector3 val3 = val2 / magnitude; int cameraOcclusionMask = GetCameraOcclusionMask(); float num = magnitude; float num2 = Mathf.Clamp((_collisionRadius != null) ? _collisionRadius.Value : 0.035f, 0.005f, 0.05f); RaycastHit[] array = Physics.SphereCastAll(val - val3 * 0.08f, num2, val3, magnitude + 0.08f, cameraOcclusionMask, (QueryTriggerInteraction)1); if (array != null && array.Length > 1) { Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); } if (array != null) { RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit hit = array2[i]; if (!((Object)((RaycastHit)(ref hit)).collider == (Object)null) && !(((RaycastHit)(ref hit)).distance <= 0.001f) && IsCameraOcclusionHitBehindHead(val, val3, hit)) { num = Mathf.Max(0.05f, ((RaycastHit)(ref hit)).distance - 0.08f - _collisionPadding.Value); break; } } } num = Mathf.Min(num, ResolveReverseCameraOcclusionDistance(val, val3, magnitude, num2, cameraOcclusionMask)); float num3 = Mathf.Clamp((_resolvedDistance > 0f) ? _resolvedDistance : _currentDistance, 0.05f, _maxDistance.Value); float num4 = ((num < num3) ? _cameraCloseSmoothTime.Value : _cameraFarSmoothTime.Value); _resolvedDistance = Mathf.SmoothDamp(num3, num, ref _resolvedDistanceVelocity, Mathf.Max(0.01f, num4), float.PositiveInfinity, Time.deltaTime); _resolvedDistance = Mathf.Clamp(_resolvedDistance, 0.05f, _maxDistance.Value); Vector3 val4 = val + val3 * _resolvedDistance; UpdateLineOfSightTransparency(val4, val, cameraOcclusionMask); UpdateDebugPoints(val, val); return val4; } private float GetEffectiveCameraDistance() { return ClampDistance(_currentDistance); } private float GetEffectiveCameraOffsetX() { return Mathf.Max(0f, _runtimeOffsetX); } private void UpdateGrabAimLockState(PlayerAvatar avatar) { bool flag = IsLocalGrabActive(); if (flag && !_wasLocalGrabActive) { CaptureGrabAimLockTarget(avatar); } else if (!flag && _wasLocalGrabActive) { _hasGrabAimLockTarget = false; } else if (!flag) { _hasGrabAimLockTarget = false; } _wasLocalGrabActive = flag; } private void CaptureGrabAimLockTarget(PlayerAvatar avatar) { //IL_0016: 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) if (TryGetCurrentPhysGrabPoint(out var target) || TryGetSelectionTarget(avatar, out target)) { _grabAimLockTarget = target; _grabAimLockUntilTime = Time.time + 0.05f; _hasGrabAimLockTarget = true; } } private bool TryGetCurrentPhysGrabPoint(out Vector3 target) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) target = Vector3.zero; PhysGrabber instance = PhysGrabber.instance; if ((Object)instance == (Object)null || !instance.grabbed) { return false; } if ((Object)instance.physGrabPoint != (Object)null) { target = instance.physGrabPoint.position; return true; } if ((Object)instance.grabbedObjectTransform != (Object)null) { target = instance.grabbedObjectTransform.position; return true; } return false; } private bool TryGetSelectionTarget(PlayerAvatar avatar, out Vector3 target) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //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_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_0053: 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_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_006b: Unknown result type (might be due to invalid IL or missing references) target = Vector3.zero; if ((Object)_selectionTransform == (Object)null || (Object)avatar == (Object)null) { return false; } Vector3 characterGrabOrigin = GetCharacterGrabOrigin(avatar); Vector3 forward = _selectionTransform.forward; if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { return false; } target = characterGrabOrigin + ((Vector3)(ref forward)).normalized * GetCurrentGrabRange(); return true; } private bool IsGrabAimLockActive() { if (_hasGrabAimLockTarget && IsLocalGrabActive()) { return Time.time <= _grabAimLockUntilTime; } return false; } private void UpdateGrabCameraBlend() { float num = (IsLocalGrabActive() ? 1f : 0f); _grabCameraBlend = Mathf.SmoothDamp(_grabCameraBlend, num, ref _grabCameraBlendVelocity, 0.08f, float.PositiveInfinity, Time.deltaTime); if (Mathf.Abs(_grabCameraBlend - num) < 0.001f) { _grabCameraBlend = num; _grabCameraBlendVelocity = 0f; } } private float GetSmoothedGrabCameraBlend() { float num = Mathf.Clamp01(_grabCameraBlend); return num * num * (3f - 2f * num); } private int GetCameraOcclusionMask() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) int mask = LayerMask.GetMask(new string[1] { "Player" }); int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()); int num2 = ((_collisionMask != 0) ? _collisionMask : LayerMask.GetMask(new string[3] { "Default", "Ground", "Wall" })); int num3 = num | num2; if (num3 == 0) { return ~mask; } return num3 & ~mask; } private float ResolveReverseCameraOcclusionDistance(Vector3 headCenter, Vector3 directionFromHead, float desiredDistance, float castRadius, int mask) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //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_007f: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = Physics.SphereCastAll(headCenter + directionFromHead * desiredDistance, castRadius, -directionFromHead, desiredDistance, mask, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return desiredDistance; } Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit hit = array2[i]; if (!((Object)((RaycastHit)(ref hit)).collider == (Object)null) && !(((RaycastHit)(ref hit)).distance <= 0.001f) && IsCameraOcclusionHitBehindHead(headCenter, directionFromHead, hit)) { float num = desiredDistance - ((RaycastHit)(ref hit)).distance; return Mathf.Max(0.05f, num - _collisionPadding.Value); } } return desiredDistance; } private static bool IsCameraOcclusionHitBehindHead(Vector3 headCenter, Vector3 directionFromHeadToCamera, RaycastHit hit) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //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_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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((Object)((RaycastHit)(ref hit)).collider == (Object)null) { return false; } Vector3 val = ((RaycastHit)(ref hit)).point; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = ((RaycastHit)(ref hit)).collider.ClosestPoint(headCenter); } if (Vector3.Dot(val - headCenter, directionFromHeadToCamera) <= 0.03f) { return false; } return true; } private static void AddColliderRenderers(Collider collider, HashSet renderers) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown if ((Object)collider == (Object)null || renderers == null) { return; } Renderer[] array = ((Component)collider).GetComponentsInParent(); if (array == null || array.Length == 0) { array = ((Component)collider).GetComponentsInChildren(); } if (array == null) { return; } Renderer[] array2 = array; foreach (Renderer val in array2) { if ((Object)val != (Object)null) { renderers.Add(val); } } } private void UpdateLineOfSightTransparency(Vector3 cameraPosition, Vector3 headCenter, int mask) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006c: Expected O, but got Unknown Vector3 val = headCenter - cameraPosition; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.05f) { RestoreObstructionTransparency(); return; } Vector3 val2 = val / magnitude; RaycastHit[] array = Physics.RaycastAll(cameraPosition, val2, magnitude, mask, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { RestoreObstructionTransparency(); return; } HashSet hashSet = new HashSet(); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val3 = array2[i]; if (!((Object)((RaycastHit)(ref val3)).collider == (Object)null)) { AddColliderRenderers(((RaycastHit)(ref val3)).collider, hashSet); } } if (hashSet.Count == 0) { RestoreObstructionTransparency(); } else { UpdateObstructionTransparency(hashSet); } } private void UpdateObstructionTransparency(HashSet current) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown if (current == null || current.Count == 0) { RestoreObstructionTransparency(); return; } foreach (Renderer item in current) { if (!((Object)item == (Object)null) && !IsLocalPlayerRenderer(item)) { ApplyTransparencyToRenderer(item, 0.28f); } } List list = new List(); foreach (Renderer activeObstructionTransparentRenderer in _activeObstructionTransparentRenderers) { if ((Object)activeObstructionTransparentRenderer != (Object)null && !current.Contains(activeObstructionTransparentRenderer) && !_activeTransparentRenderers.Contains(activeObstructionTransparentRenderer)) { list.Add(activeObstructionTransparentRenderer); } } foreach (Renderer item2 in list) { RestoreRendererTransparency(item2); _activeObstructionTransparentRenderers.Remove(item2); } foreach (Renderer item3 in current) { if ((Object)item3 != (Object)null && !IsLocalPlayerRenderer(item3)) { _activeObstructionTransparentRenderers.Add(item3); } } } private void RestoreObstructionTransparency() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (_activeObstructionTransparentRenderers.Count == 0) { if (_activeTransparentRenderers.Count == 0) { CleanupTransparentRendererMaterials(); } return; } foreach (Renderer activeObstructionTransparentRenderer in _activeObstructionTransparentRenderers) { if ((Object)activeObstructionTransparentRenderer != (Object)null && !_activeTransparentRenderers.Contains(activeObstructionTransparentRenderer)) { RestoreRendererTransparency(activeObstructionTransparentRenderer); } } _activeObstructionTransparentRenderers.Clear(); if (_activeTransparentRenderers.Count == 0) { CleanupTransparentRendererMaterials(); } } private float ResolveOcclusionDistance(Vector3 source, Vector3 candidatePosition, int collisionMask) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = candidatePosition - source; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.001f) { return 0.05f; } Vector3 val2 = val / magnitude; RaycastHit val3 = default(RaycastHit); if (!Physics.SphereCast(source, Mathf.Max(0.05f, _collisionRadius.Value * 0.9f), val2, ref val3, magnitude, collisionMask, (QueryTriggerInteraction)1)) { return magnitude; } return Mathf.Max(0.05f, ((RaycastHit)(ref val3)).distance - _collisionPadding.Value); } private void UpdateLocalModelTransparency() { RestoreLocalRendererTransparency(); } private float GetLocalModelTransparencyAlpha() { float num = Mathf.Max(0.05f, (_minDistance != null) ? _minDistance.Value : 0.1f); float num2 = Mathf.Max(num, (_maxDistance != null) ? _maxDistance.Value : (num + 1f)); float num3 = Mathf.Clamp01((_nearFadeStartZoomRatio != null) ? _nearFadeStartZoomRatio.Value : 0.67f); float num4 = Mathf.Lerp(num2, num, num3); float num5 = num; float num6 = Mathf.InverseLerp(num4, num5, _resolvedDistance); num6 = Mathf.Clamp01(num6); num6 = num6 * num6 * (3f - 2f * num6); float num7 = Mathf.Clamp((_nearFadeMinAlpha != null) ? _nearFadeMinAlpha.Value : 0.1f, 0.02f, 1f); return Mathf.Lerp(1f, num7, num6); } private void CollectLocalAvatarRenderers(List renderers) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown PlayerAvatar instance = PlayerAvatar.instance; PlayerAvatarVisuals val = instance?.playerAvatarVisuals; Renderer[] componentsInChildren; if ((Object)instance != (Object)null) { componentsInChildren = ((Component)instance).GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { if ((Object)val2 != (Object)null) { renderers.Add(val2); } } } if ((Object)val == (Object)null) { _cachedAvatarVisualsForMotionVectors = null; _cachedAvatarVisualRenderers = null; return; } if ((Object)(object)_cachedAvatarVisualsForMotionVectors != (Object)(object)val || _cachedAvatarVisualRenderers == null || Time.time >= _nextAvatarRendererRefreshTime) { _cachedAvatarVisualsForMotionVectors = val; _cachedAvatarVisualRenderers = ((Component)val).GetComponentsInChildren(true); _nextAvatarRendererRefreshTime = Time.time + 0.5f; } if (_cachedAvatarVisualRenderers == null) { return; } componentsInChildren = _cachedAvatarVisualRenderers; foreach (Renderer val3 in componentsInChildren) { if ((Object)val3 != (Object)null) { renderers.Add(val3); } } } private void CollectForcedModelRenderers(List renderers) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (_cachedForcedRenderers == null) { return; } Renderer[] cachedForcedRenderers = _cachedForcedRenderers; foreach (Renderer val in cachedForcedRenderers) { if ((Object)val != (Object)null) { renderers.Add(val); } } } private bool IsLocalPlayerRenderer(Renderer renderer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown if ((Object)renderer == (Object)null) { return false; } Transform transform = ((Component)renderer).transform; PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance != (Object)null && transform.IsChildOf(((Component)instance).transform)) { return true; } PlayerAvatarVisuals val = instance?.playerAvatarVisuals; if ((Object)val != (Object)null && transform.IsChildOf(((Component)val).transform)) { return true; } if ((Object)_cachedModelInstance != (Object)null && transform.IsChildOf(_cachedModelInstance.transform)) { return true; } if (_cachedForcedRenderers != null && Array.IndexOf(_cachedForcedRenderers, renderer) >= 0) { return true; } return false; } private void ApplyTransparencyToRenderer(Renderer renderer, float alpha, bool useLocalTransparencyMode = false) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Expected O, but got Unknown //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) Material[] sharedMaterials = renderer.sharedMaterials; if (sharedMaterials == null || sharedMaterials.Length == 0) { return; } if (!_originalRendererEnabledStates.ContainsKey(renderer)) { _originalRendererEnabledStates[renderer] = renderer.enabled; } if (!_originalRendererShadowModes.ContainsKey(renderer)) { _originalRendererShadowModes[renderer] = renderer.shadowCastingMode; } string text = (useLocalTransparencyMode ? GetLocalTransparencyMode() : "materialandpropertyblock"); int num; switch (text) { case "contouronly": if (UpdateContourOutline(renderer, alpha)) { renderer.enabled = alpha >= 0.999f; renderer.shadowCastingMode = (ShadowCastingMode)((alpha < 0.999f) ? 3 : ((int)_originalRendererShadowModes[renderer])); } else { renderer.enabled = !_originalRendererEnabledStates.TryGetValue(renderer, out var value) || value; renderer.shadowCastingMode = (_originalRendererShadowModes.TryGetValue(renderer, out var value2) ? value2 : renderer.shadowCastingMode); } return; case "outlineonly": case "boundsoutlinedebug": if (UpdateContourOutline(renderer, alpha)) { renderer.enabled = alpha >= 0.999f; renderer.shadowCastingMode = (ShadowCastingMode)3; } else { HideBoundsOutline(renderer); renderer.enabled = alpha >= 0.999f; renderer.shadowCastingMode = (ShadowCastingMode)3; } return; case "silhouetteclone": renderer.enabled = alpha >= 0.999f; renderer.shadowCastingMode = (ShadowCastingMode)3; UpdateSilhouetteClone(renderer, alpha); return; case "rendererdisable": renderer.enabled = alpha >= 0.999f; return; case "shadowsonly": renderer.enabled = true; renderer.shadowCastingMode = (ShadowCastingMode)((alpha < 0.999f) ? 3 : ((int)_originalRendererShadowModes[renderer])); return; default: num = ((text == "materialandpropertyblock") ? 1 : 0); break; case "materialalpha": num = 1; break; } bool flag = (byte)num != 0; bool flag2 = text == "propertyblockonly" || text == "materialandpropertyblock"; Material[] array = (flag ? GetTransparentMaterialsForRenderer(renderer, sharedMaterials) : sharedMaterials); bool flag3 = false; Material[] array2 = array; foreach (Material val in array2) { if (!((Object)val == (Object)null)) { flag3 |= SetMaterialAlpha(val, alpha); } } if (flag2) { _transparencyPropertyBlock.Clear(); _transparencyPropertyBlock.SetFloat("_Alpha", alpha); _transparencyPropertyBlock.SetFloat("_Opacity", alpha); if (array.Length != 0 && (Object)array[0] != (Object)null) { if (array[0].HasProperty("_Color")) { Color color = array[0].GetColor("_Color"); color.a = alpha; _transparencyPropertyBlock.SetColor("_Color", color); } if (array[0].HasProperty("_BaseColor")) { Color color2 = array[0].GetColor("_BaseColor"); color2.a = alpha; _transparencyPropertyBlock.SetColor("_BaseColor", color2); } } renderer.SetPropertyBlock(_transparencyPropertyBlock); } else { renderer.SetPropertyBlock((MaterialPropertyBlock)null); } if (flag3 || flag2) { renderer.enabled = true; renderer.shadowCastingMode = (_originalRendererShadowModes.TryGetValue(renderer, out var value3) ? value3 : renderer.shadowCastingMode); if (flag && !_activeTransparentRenderers.Contains(renderer)) { renderer.sharedMaterials = array; } } } private void HideFirstPersonBodyRenderersFromTransparencySet() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (_activeTransparentRenderers.Count == 0) { return; } foreach (Renderer activeTransparentRenderer in _activeTransparentRenderers) { if (!((Object)activeTransparentRenderer == (Object)null) && IsLikelyPlayerBodyContourRenderer(activeTransparentRenderer, requireSkinned: false, ignoreVolumeThreshold: true)) { activeTransparentRenderer.enabled = false; } } } private string GetLocalTransparencyMode() { string text = ((_localTransparencyMode != null) ? _localTransparencyMode.Value : "MaterialAndPropertyBlock"); if (!string.IsNullOrWhiteSpace(text)) { return text.Trim().ToLowerInvariant(); } return "materialandpropertyblock"; } private bool IsLocalTransparencyMode(string mode) { return string.Equals(GetLocalTransparencyMode(), mode, StringComparison.OrdinalIgnoreCase); } private bool HasUsableSkinnedContourRenderer(IEnumerable renderers) { if (renderers == null) { return false; } foreach (Renderer renderer in renderers) { if (renderer is SkinnedMeshRenderer && IsLikelyPlayerBodyContourRenderer(renderer, requireSkinned: true)) { return true; } } return false; } private float GetContourBodyVolumeThreshold(IEnumerable renderers, bool requireSkinned) { //IL_0036: 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_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_004a: 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_006d: Unknown result type (might be due to invalid IL or missing references) float num = 0f; if (renderers == null) { return 0f; } foreach (Renderer renderer in renderers) { if ((!requireSkinned || renderer is SkinnedMeshRenderer) && IsLikelyPlayerBodyContourRenderer(renderer, requireSkinned, ignoreVolumeThreshold: true)) { Bounds bounds = renderer.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num2 = Mathf.Max(0f, size.x) * Mathf.Max(0f, size.y) * Mathf.Max(0f, size.z); if (num2 > num) { num = num2; } } } if (!(num > 0f)) { return 0f; } return Mathf.Max(0.005f, num * (requireSkinned ? 0.18f : 0.3f)); } private bool IsLikelyPlayerBodyContourRenderer(Renderer renderer, bool requireSkinned) { return IsLikelyPlayerBodyContourRenderer(renderer, requireSkinned, ignoreVolumeThreshold: false); } private bool IsLikelyPlayerBodyContourRenderer(Renderer renderer, bool requireSkinned, bool ignoreVolumeThreshold) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) if ((Object)renderer == (Object)null) { return false; } if (requireSkinned && !(renderer is SkinnedMeshRenderer)) { return false; } string text = ((object)renderer).GetType().Name.ToLowerInvariant(); if (renderer is LineRenderer || renderer is TrailRenderer || text.Contains("particle")) { return false; } GameObject gameObject = ((Component)renderer).gameObject; string text2 = GetTransformPath(gameObject.transform).ToLowerInvariant(); string[] array = new string[28] { "outline", "silhouette", "contour", "debug", "map", "tool", "item", "prop", "phys", "grab", "flashlight", "light", "weapon", "valuable", "cart", "ui", "text", "particle", "effect", "fx", "flash", "beam", "spot", "cone", "orb", "marker", "gizmo", "helper" }; for (int i = 0; i < array.Length; i++) { if (text2.Contains(array[i])) { return false; } } PlayerAvatar instance = PlayerAvatar.instance; if ((Object)instance == (Object)null) { return true; } Vector3 position = ((Component)instance).transform.position; Bounds bounds = renderer.bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 size = ((Bounds)(ref bounds)).size; float num = Mathf.Max(0f, size.x) * Mathf.Max(0f, size.y) * Mathf.Max(0f, size.z); if (!ignoreVolumeThreshold && _contourBodyVolumeThreshold > 0f) { if (_contourPreferSkinnedRenderers && renderer is SkinnedMeshRenderer && num < _contourBodyVolumeThreshold) { return false; } if (!_contourPreferSkinnedRenderers && num < _contourBodyVolumeThreshold) { return false; } } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(center.x - position.x, center.z - position.z); if (((Vector2)(ref val)).magnitude > 1.25f) { return false; } float num2 = center.y - position.y; if (num2 < -0.55f || num2 > 2.75f) { return false; } return true; } private string GetTransformPath(Transform transform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if ((Object)transform == (Object)null) { return string.Empty; } string text = ((Object)transform).name; Transform parent = transform.parent; while ((Object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private Color GetOutlineColor() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) return new Color((_outlineColorR != null) ? _outlineColorR.Value : 0.25f, (_outlineColorG != null) ? _outlineColorG.Value : 0.95f, (_outlineColorB != null) ? _outlineColorB.Value : 1f, (_outlineColorA != null) ? _outlineColorA.Value : 0.9f); } private bool UpdateContourOutline(Renderer source, float alpha) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)source == (Object)null) { return false; } if (!IsLikelyPlayerBodyContourRenderer(source, _contourPreferSkinnedRenderers)) { SetRendererActive(GetExistingContourRenderer(source, depthOnly: true), active: false); SetRendererActive(GetExistingContourRenderer(source, depthOnly: false), active: false); return false; } bool flag = alpha < 0.999f; Renderer orCreateContourRenderer = GetOrCreateContourRenderer(source, depthOnly: true); Renderer orCreateContourRenderer2 = GetOrCreateContourRenderer(source, depthOnly: false); SetRendererActive(orCreateContourRenderer, flag); SetRendererActive(orCreateContourRenderer2, flag); if (!flag) { return false; } SyncContourRenderer(source, orCreateContourRenderer, 1f, GetContourDepthMaterial()); float scale = 1f + ((_outlineWidth != null) ? _outlineWidth.Value : 0.025f); SyncContourRenderer(source, orCreateContourRenderer2, scale, GetContourOutlineMaterial()); return true; } private void SetRendererActive(Renderer renderer, bool active) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)renderer == (Object)null)) { ((Component)renderer).gameObject.SetActive(active); renderer.enabled = active; } } private Renderer GetOrCreateContourRenderer(Renderer source, bool depthOnly) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown Dictionary dictionary = (depthOnly ? _contourDepthRenderers : _contourOutlineRenderers); if (dictionary.TryGetValue(source, out var value) && (Object)value != (Object)null) { return value; } GameObject val = new GameObject(depthOnly ? "REPO Native Third Person Contour Depth" : "REPO Native Third Person Contour Outline"); KeepAliveOutsideScene(val); val.layer = ((Component)source).gameObject.layer; Renderer val2 = null; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)((source is SkinnedMeshRenderer) ? source : null); if ((Object)(object)val3 != (Object)null) { SkinnedMeshRenderer obj = val.AddComponent(); obj.sharedMesh = val3.sharedMesh; obj.rootBone = val3.rootBone; obj.bones = val3.bones; obj.updateWhenOffscreen = true; val2 = (Renderer)obj; } else if (source is MeshRenderer) { MeshFilter component = ((Component)source).GetComponent(); MeshFilter val4 = val.AddComponent(); if ((Object)component != (Object)null) { val4.sharedMesh = component.sharedMesh; } val2 = (Renderer)val.AddComponent(); } if ((Object)val2 == (Object)null) { Object.Destroy((Object)(object)val); return null; } val2.shadowCastingMode = (ShadowCastingMode)0; val2.receiveShadows = false; val2.sharedMaterial = (depthOnly ? GetContourDepthMaterial() : GetContourOutlineMaterial()); val.SetActive(false); dictionary[source] = val2; return val2; } private Renderer GetExistingContourRenderer(Renderer source, bool depthOnly) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)source == (Object)null) { return null; } if (!(depthOnly ? _contourDepthRenderers : _contourOutlineRenderers).TryGetValue(source, out var value)) { return null; } return value; } private void SyncContourRenderer(Renderer source, Renderer clone, float scale, Material material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_002c: 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_0043: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown if ((Object)source == (Object)null || (Object)clone == (Object)null) { return; } Transform transform = ((Component)source).transform; Transform transform2 = ((Component)clone).transform; transform2.position = transform.position; transform2.rotation = transform.rotation; transform2.localScale = transform.lossyScale * scale; clone.sharedMaterial = material; clone.shadowCastingMode = (ShadowCastingMode)0; clone.receiveShadows = false; SkinnedMeshRenderer val = (SkinnedMeshRenderer)((source is SkinnedMeshRenderer) ? source : null); if ((Object)(object)val != (Object)null) { SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)((clone is SkinnedMeshRenderer) ? clone : null); if ((Object)(object)val2 != (Object)null) { val2.sharedMesh = val.sharedMesh; val2.rootBone = val.rootBone; val2.bones = val.bones; val2.updateWhenOffscreen = true; return; } } if (source is MeshRenderer && clone is MeshRenderer) { MeshFilter component = ((Component)source).GetComponent(); MeshFilter component2 = ((Component)clone).GetComponent(); if ((Object)component != (Object)null && (Object)component2 != (Object)null) { component2.sharedMesh = component.sharedMesh; } } } private Material GetContourDepthMaterial() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) if ((Object)_contourDepthMaterial != (Object)null) { return _contourDepthMaterial; } Shader val = Shader.Find("Hidden/Internal-Colored") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard"); if ((Object)val == (Object)null) { return null; } _contourDepthMaterial = new Material(val); ((Object)_contourDepthMaterial).name = "REPO Native Third Person Contour Depth Material"; if (_contourDepthMaterial.HasProperty("_Color")) { _contourDepthMaterial.SetColor("_Color", new Color(0f, 0f, 0f, 0f)); } if (_contourDepthMaterial.HasProperty("_ColorMask")) { _contourDepthMaterial.SetFloat("_ColorMask", 0f); } if (_contourDepthMaterial.HasProperty("_ZWrite")) { _contourDepthMaterial.SetFloat("_ZWrite", 1f); } if (_contourDepthMaterial.HasProperty("_ZTest")) { _contourDepthMaterial.SetFloat("_ZTest", 4f); } if (_contourDepthMaterial.HasProperty("_Cull")) { _contourDepthMaterial.SetFloat("_Cull", 0f); } _contourDepthMaterial.renderQueue = 2990; return _contourDepthMaterial; } private Material GetContourOutlineMaterial() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0031: 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_0093: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if ((Object)_contourOutlineMaterial != (Object)null) { if (_contourOutlineMaterial.HasProperty("_Color")) { _contourOutlineMaterial.SetColor("_Color", GetOutlineColor()); } return _contourOutlineMaterial; } Shader val = Shader.Find("Hidden/Internal-Colored") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Standard"); if ((Object)val == (Object)null) { return null; } _contourOutlineMaterial = new Material(val); ((Object)_contourOutlineMaterial).name = "REPO Native Third Person Contour Outline Material"; if (_contourOutlineMaterial.HasProperty("_Color")) { _contourOutlineMaterial.SetColor("_Color", GetOutlineColor()); } if (_contourOutlineMaterial.HasProperty("_SrcBlend")) { _contourOutlineMaterial.SetFloat("_SrcBlend", 5f); } if (_contourOutlineMaterial.HasProperty("_DstBlend")) { _contourOutlineMaterial.SetFloat("_DstBlend", 10f); } if (_contourOutlineMaterial.HasProperty("_ZWrite")) { _contourOutlineMaterial.SetFloat("_ZWrite", 0f); } if (_contourOutlineMaterial.HasProperty("_ZTest")) { _contourOutlineMaterial.SetFloat("_ZTest", 4f); } if (_contourOutlineMaterial.HasProperty("_Cull")) { _contourOutlineMaterial.SetFloat("_Cull", 1f); } _contourOutlineMaterial.renderQueue = 3000; _contourOutlineMaterial.SetOverrideTag("RenderType", "Transparent"); _contourOutlineMaterial.EnableKeyword("_ALPHABLEND_ON"); return _contourOutlineMaterial; } private void HideBoundsOutline(Renderer source) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if ((Object)source == (Object)null || !_outlineRenderers.TryGetValue(source, out var value) || value == null) { return; } LineRenderer[] array = value; foreach (LineRenderer val in array) { if ((Object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } } } private void UpdateBoundsOutline(Renderer source, float alpha) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //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_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_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_0044: 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_0050: 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_005b: 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_0069: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0120: 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) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) if ((Object)source == (Object)null) { return; } LineRenderer[] orCreateBoundsOutline = GetOrCreateBoundsOutline(source); if (orCreateBoundsOutline == null) { return; } bool flag = alpha < 0.999f; Bounds bounds = source.bounds; Vector3 min = ((Bounds)(ref bounds)).min; Vector3 max = ((Bounds)(ref bounds)).max; Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(max.x, max.y, max.z), new Vector3(min.x, max.y, max.z) }; int[,] array2 = new int[12, 2] { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 }, { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }; float widthMultiplier = ((_outlineWidth != null) ? _outlineWidth.Value : 0.018f); Color outlineColor = GetOutlineColor(); for (int i = 0; i < orCreateBoundsOutline.Length; i++) { LineRenderer val = orCreateBoundsOutline[i]; if (!((Object)val == (Object)null)) { ((Component)val).gameObject.SetActive(flag); if (flag) { val.widthMultiplier = widthMultiplier; val.startColor = outlineColor; val.endColor = outlineColor; val.SetPosition(0, array[array2[i, 0]]); val.SetPosition(1, array[array2[i, 1]]); } } } } private LineRenderer[] GetOrCreateBoundsOutline(Renderer source) { //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_0047: Expected O, but got Unknown //IL_0047: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (_outlineRenderers.TryGetValue(source, out var value) && value != null && value.Length == 12) { return value; } LineRenderer[] array = (LineRenderer[])(object)new LineRenderer[12]; Material outlineMaterial = GetOutlineMaterial(); for (int i = 0; i < array.Length; i++) { GameObject val = new GameObject("REPO Native Third Person Outline Line"); KeepAliveOutsideScene(val); val.layer = ((Component)source).gameObject.layer; LineRenderer val2 = val.AddComponent(); val2.positionCount = 2; val2.useWorldSpace = true; val2.loop = false; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; ((Renderer)val2).material = outlineMaterial; val2.startColor = new Color(0.25f, 0.95f, 1f, 0.9f); val2.endColor = new Color(0.25f, 0.95f, 1f, 0.9f); val.SetActive(false); array[i] = val2; } _outlineRenderers[source] = array; return array; } private Material GetOutlineMaterial() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) if ((Object)_outlineMaterial != (Object)null) { return _outlineMaterial; } Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard"); if ((Object)val == (Object)null) { return null; } _outlineMaterial = new Material(val); ((Object)_outlineMaterial).name = "REPO Native Third Person Outline Material"; if (_outlineMaterial.HasProperty("_Color")) { _outlineMaterial.SetColor("_Color", new Color(0.25f, 0.95f, 1f, 0.9f)); } _outlineMaterial.renderQueue = 3100; return _outlineMaterial; } private void UpdateSilhouetteClone(Renderer source, float alpha) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_004e: 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_0065: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown if ((Object)source == (Object)null) { return; } Renderer orCreateSilhouetteRenderer = GetOrCreateSilhouetteRenderer(source); if ((Object)orCreateSilhouetteRenderer == (Object)null) { return; } bool flag = alpha < 0.999f; ((Component)orCreateSilhouetteRenderer).gameObject.SetActive(flag); if (!flag) { return; } Transform transform = ((Component)source).transform; Transform transform2 = ((Component)orCreateSilhouetteRenderer).transform; transform2.position = transform.position; transform2.rotation = transform.rotation; transform2.localScale = transform.lossyScale * ((_silhouetteScale != null) ? _silhouetteScale.Value : 1.035f); orCreateSilhouetteRenderer.enabled = true; orCreateSilhouetteRenderer.shadowCastingMode = (ShadowCastingMode)0; orCreateSilhouetteRenderer.receiveShadows = false; Material silhouetteMaterial = GetSilhouetteMaterial(); if ((Object)silhouetteMaterial != (Object)null) { Color val = default(Color); ((Color)(ref val))..ctor(0.25f, 0.95f, 1f, 0.72f); if (silhouetteMaterial.HasProperty("_Color")) { silhouetteMaterial.SetColor("_Color", val); } orCreateSilhouetteRenderer.sharedMaterial = silhouetteMaterial; } SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)((source is SkinnedMeshRenderer) ? source : null); if ((Object)(object)val2 != (Object)null) { SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)((orCreateSilhouetteRenderer is SkinnedMeshRenderer) ? orCreateSilhouetteRenderer : null); if ((Object)(object)val3 != (Object)null) { val3.sharedMesh = val2.sharedMesh; val3.rootBone = val2.rootBone; val3.bones = val2.bones; val3.updateWhenOffscreen = true; return; } } if (source is MeshRenderer && orCreateSilhouetteRenderer is MeshRenderer) { MeshFilter component = ((Component)source).GetComponent(); MeshFilter component2 = ((Component)orCreateSilhouetteRenderer).GetComponent(); if ((Object)component != (Object)null && (Object)component2 != (Object)null) { component2.sharedMesh = component.sharedMesh; } } } private Renderer GetOrCreateSilhouetteRenderer(Renderer source) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown if (_silhouetteRenderers.TryGetValue(source, out var value) && (Object)value != (Object)null) { return value; } GameObject val = new GameObject("REPO Native Third Person Silhouette"); KeepAliveOutsideScene(val); val.layer = ((Component)source).gameObject.layer; Renderer val2 = null; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)((source is SkinnedMeshRenderer) ? source : null); if ((Object)(object)val3 != (Object)null) { SkinnedMeshRenderer obj = val.AddComponent(); obj.sharedMesh = val3.sharedMesh; obj.rootBone = val3.rootBone; obj.bones = val3.bones; obj.updateWhenOffscreen = true; val2 = (Renderer)obj; } else if (source is MeshRenderer) { MeshFilter component = ((Component)source).GetComponent(); MeshFilter val4 = val.AddComponent(); if ((Object)component != (Object)null) { val4.sharedMesh = component.sharedMesh; } val2 = (Renderer)val.AddComponent(); } if ((Object)val2 == (Object)null) { Object.Destroy((Object)(object)val); return null; } val2.sharedMaterial = GetSilhouetteMaterial(); val2.shadowCastingMode = (ShadowCastingMode)0; val2.receiveShadows = false; val.SetActive(false); _silhouetteRenderers[source] = val2; return val2; } private Material GetSilhouetteMaterial() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) if ((Object)_silhouetteMaterial != (Object)null) { return _silhouetteMaterial; } Shader val = Shader.Find("Unlit/Color") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Standard"); if ((Object)val == (Object)null) { return null; } _silhouetteMaterial = new Material(val); ((Object)_silhouetteMaterial).name = "REPO Native Third Person Silhouette Material"; if (_silhouetteMaterial.HasProperty("_Color")) { _silhouetteMaterial.SetColor("_Color", new Color(0.25f, 0.95f, 1f, 0.72f)); } if (_silhouetteMaterial.HasProperty("_Mode")) { _silhouetteMaterial.SetFloat("_Mode", 3f); } if (_silhouetteMaterial.HasProperty("_SrcBlend")) { _silhouetteMaterial.SetFloat("_SrcBlend", 5f); } if (_silhouetteMaterial.HasProperty("_DstBlend")) { _silhouetteMaterial.SetFloat("_DstBlend", 10f); } if (_silhouetteMaterial.HasProperty("_ZWrite")) { _silhouetteMaterial.SetFloat("_ZWrite", 0f); } _silhouetteMaterial.renderQueue = 3000; _silhouetteMaterial.SetOverrideTag("RenderType", "Transparent"); _silhouetteMaterial.EnableKeyword("_ALPHABLEND_ON"); return _silhouetteMaterial; } private void RestoreSilhouetteRenderers() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown RestoreBoundsOutlines(); RestoreContourRenderers(); foreach (KeyValuePair silhouetteRenderer in _silhouetteRenderers) { if ((Object)silhouetteRenderer.Value != (Object)null) { Object.Destroy((Object)(object)((Component)silhouetteRenderer.Value).gameObject); } } _silhouetteRenderers.Clear(); if ((Object)_silhouetteMaterial != (Object)null) { Object.Destroy((Object)(object)_silhouetteMaterial); _silhouetteMaterial = null; } } private void RestoreContourRenderers() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown foreach (KeyValuePair contourDepthRenderer in _contourDepthRenderers) { if ((Object)contourDepthRenderer.Value != (Object)null) { Object.Destroy((Object)(object)((Component)contourDepthRenderer.Value).gameObject); } } foreach (KeyValuePair contourOutlineRenderer in _contourOutlineRenderers) { if ((Object)contourOutlineRenderer.Value != (Object)null) { Object.Destroy((Object)(object)((Component)contourOutlineRenderer.Value).gameObject); } } _contourDepthRenderers.Clear(); _contourOutlineRenderers.Clear(); if ((Object)_contourDepthMaterial != (Object)null) { Object.Destroy((Object)(object)_contourDepthMaterial); _contourDepthMaterial = null; } if ((Object)_contourOutlineMaterial != (Object)null) { Object.Destroy((Object)(object)_contourOutlineMaterial); _contourOutlineMaterial = null; } } private void RestoreBoundsOutlines() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown foreach (KeyValuePair outlineRenderer in _outlineRenderers) { LineRenderer[] value = outlineRenderer.Value; if (value == null) { continue; } LineRenderer[] array = value; foreach (LineRenderer val in array) { if ((Object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } _outlineRenderers.Clear(); if ((Object)_outlineMaterial != (Object)null) { Object.Destroy((Object)(object)_outlineMaterial); _outlineMaterial = null; } } private void RestoreLocalRendererTransparency(bool restoreRendererEnabled = true) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown RestoreSilhouetteRenderers(); if (_activeTransparentRenderers.Count == 0) { if (_activeObstructionTransparentRenderers.Count == 0) { CleanupTransparentRendererMaterials(); } return; } foreach (Renderer activeTransparentRenderer in _activeTransparentRenderers) { if ((Object)activeTransparentRenderer != (Object)null) { RestoreRendererTransparency(activeTransparentRenderer, restoreRendererEnabled); } } if (restoreRendererEnabled) { _activeTransparentRenderers.Clear(); if (_activeObstructionTransparentRenderers.Count == 0) { CleanupTransparentRendererMaterials(); } } } private void CleanupTransparentRendererMaterials() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown foreach (KeyValuePair transparentRendererMaterial in _transparentRendererMaterials) { Material[] value = transparentRendererMaterial.Value; if (value == null) { continue; } Material[] array = value; foreach (Material val in array) { if ((Object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } _transparentRendererMaterials.Clear(); _originalRendererMaterials.Clear(); _originalRendererEnabledStates.Clear(); _originalRendererShadowModes.Clear(); } private Material[] GetTransparentMaterialsForRenderer(Renderer renderer, Material[] sharedMaterials) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (_transparentRendererMaterials.TryGetValue(renderer, out var value) && value != null && value.Length == sharedMaterials.Length) { return value; } _originalRendererMaterials[renderer] = sharedMaterials; Material[] array = (Material[])(object)new Material[sharedMaterials.Length]; for (int i = 0; i < sharedMaterials.Length; i++) { Material val = sharedMaterials[i]; if (!((Object)val == (Object)null)) { Material val2 = CreateTransparentMaterialCopy(val); ConfigureMaterialForTransparency(val2); array[i] = val2; } } _transparentRendererMaterials[renderer] = array; return array; } private Material CreateTransparentMaterialCopy(Material source) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown return new Material(source); } private void ConfigureMaterialForTransparency(Material material) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if (!((Object)material == (Object)null)) { if (material.HasProperty("_Surface")) { material.SetFloat("_Surface", 1f); } if (material.HasProperty("_Blend")) { material.SetFloat("_Blend", 0f); } if (material.HasProperty("_SrcBlend")) { material.SetFloat("_SrcBlend", 5f); } if (material.HasProperty("_DstBlend")) { material.SetFloat("_DstBlend", 10f); } if (material.HasProperty("_ZWrite")) { material.SetFloat("_ZWrite", 0f); } if (material.HasProperty("_Mode")) { material.SetFloat("_Mode", 3f); } if (material.HasProperty("_UseBaseColorAlpha")) { material.SetFloat("_UseBaseColorAlpha", 1f); } if (material.HasProperty("_AlphaClip")) { material.SetFloat("_AlphaClip", 0f); } material.DisableKeyword("_ALPHATEST_ON"); material.EnableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.EnableKeyword("_USEBASECOLORALPHA_ON"); material.renderQueue = 3000; material.SetOverrideTag("RenderType", "Transparent"); } } private static bool SetMaterialAlpha(Material material, float alpha) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) bool result = false; if (material.HasProperty("_Color")) { Color color = material.GetColor("_Color"); color.a = alpha; material.SetColor("_Color", color); result = true; } if (material.HasProperty("_BaseColor")) { Color color2 = material.GetColor("_BaseColor"); color2.a = alpha; material.SetColor("_BaseColor", color2); result = true; } if (material.HasProperty("_MainColor")) { Color color3 = material.GetColor("_MainColor"); color3.a = alpha; material.SetColor("_MainColor", color3); result = true; } if (material.HasProperty("_TintColor")) { Color color4 = material.GetColor("_TintColor"); color4.a = alpha; material.SetColor("_TintColor", color4); result = true; } if (material.HasProperty("_Alpha")) { material.SetFloat("_Alpha", alpha); result = true; } if (material.HasProperty("_Opacity")) { material.SetFloat("_Opacity", alpha); result = true; } return result; } private bool TryGetStableLocalPlayerBounds(out Bounds bounds) { //IL_0001: 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_003c: Expected O, but got Unknown //IL_005b: 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_0050: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); List list = new List(32); CollectLocalAvatarRenderers(list); CollectForcedModelRenderers(list); bool flag = false; foreach (Renderer item in list) { if (!((Object)item == (Object)null) && item.enabled) { if (!flag) { bounds = item.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } } } return flag; } private void RestoreRendererTransparency(Renderer renderer) { RestoreRendererTransparency(renderer, restoreRendererEnabled: true); } private void RestoreRendererTransparency(Renderer renderer, bool restoreRendererEnabled) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)renderer == (Object)null)) { renderer.SetPropertyBlock((MaterialPropertyBlock)null); if (_originalRendererMaterials.TryGetValue(renderer, out var value) && value != null) { renderer.sharedMaterials = value; } if (restoreRendererEnabled && _originalRendererEnabledStates.TryGetValue(renderer, out var value2)) { renderer.enabled = value2; } if (_originalRendererShadowModes.TryGetValue(renderer, out var value3)) { renderer.shadowCastingMode = value3; } } } private static Ray GetThirdPersonCenterRay(Vector3 origin, Quaternion fallbackRotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_002f: 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) Camera main = Camera.main; if ((Object)main != (Object)null) { Ray val = main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); return new Ray(origin, ((Ray)(ref val)).direction); } return new Ray(origin, fallbackRotation * Vector3.forward); } private Ray GetThirdPersonGameplayRay(PlayerAvatar avatar, Vector3 visualCameraPosition, Transform aimTransform) { //IL_0000: 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_000d: Expected O, but got Unknown //IL_0017: 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_001c: Unknown result type (might be due to invalid IL or missing references) return GetThirdPersonCenterRay(visualCameraPosition, ((Object)aimTransform != (Object)null) ? aimTransform.rotation : Quaternion.identity); } private void UpdateSelectionTransform(PlayerAvatar avatar, Ray cameraCenterRay) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_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_00be: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)_selectionTransform != (Object)null) || !((Object)avatar != (Object)null)) { return; } Transform visionTransform = avatar.PlayerVisionTarget?.VisionTransform; Vector3 val = ((_selectionOriginMode == null || !string.Equals(_selectionOriginMode.Value, "PlayerVision", StringComparison.OrdinalIgnoreCase)) ? GetCharacterGrabOrigin(avatar) : GetStableVisionOrigin(avatar, visionTransform)); Vector3 direction = ((Ray)(ref cameraCenterRay)).direction; Vector3 normalized = ((Vector3)(ref direction)).normalized; float currentGrabRange = GetCurrentGrabRange(); Vector3 val2 = ResolveCharacterReachCrosshairTarget(val, cameraCenterRay, currentGrabRange); int mask = LayerMask.GetMask(new string[1] { "Player" }); int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) - mask; RaycastHit val3 = default(RaycastHit); bool hasCameraHit = false; bool hitIsReachable = false; Vector3 cameraHitPoint = ((Ray)(ref cameraCenterRay)).origin + normalized * Mathf.Min(_selectionMaxDistance.Value, currentGrabRange + _resolvedDistance + 2f); if (IsLocalGrabActive()) { cameraHitPoint = val2; hasCameraHit = true; hitIsReachable = true; } else if (IsGrabAimLockActive()) { val2 = _grabAimLockTarget; cameraHitPoint = _grabAimLockTarget; hasCameraHit = true; hitIsReachable = Vector3.Distance(val, val2) <= currentGrabRange + 0.05f; } else if (Physics.Raycast(((Ray)(ref cameraCenterRay)).origin, normalized, ref val3, _selectionMaxDistance.Value, num, (QueryTriggerInteraction)1)) { hasCameraHit = true; cameraHitPoint = ((RaycastHit)(ref val3)).point; if (IsForwardReachableGrabPoint(val, ((RaycastHit)(ref val3)).point, normalized, currentGrabRange)) { hitIsReachable = true; val2 = ((RaycastHit)(ref val3)).point; } } Vector3 val4 = val2 - val; if (((Vector3)(ref val4)).sqrMagnitude < 0.0001f) { val4 = normalized; } _selectionTransform.position = val; _selectionTransform.rotation = Quaternion.LookRotation(((Vector3)(ref val4)).normalized, Vector3.up); UpdateGrabDebugVisuals(val, GetCharacterBodyDebugOrigin(avatar, val), cameraHitPoint, val2, currentGrabRange, hasCameraHit, hitIsReachable); } private Vector3 GetCharacterGrabOrigin(PlayerAvatar avatar) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: 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_0037: Unknown result type (might be due to invalid IL or missing references) if ((Object)avatar == (Object)null) { return Vector3.zero; } if (_thirdPersonActive && !_temporarilyFirstPerson && ((Vector3)(ref _stableGrabOrigin)).sqrMagnitude > 0.0001f) { return _stableGrabOrigin; } return GetHeadCenterPoint(avatar); } private Vector3 GetStableVisionOrigin(PlayerAvatar avatar, Transform visionTransform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0043: 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_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)avatar == (Object)null) { return Vector3.zero; } if (_thirdPersonActive && !_temporarilyFirstPerson) { return GetCharacterGrabOrigin(avatar); } if (!((Object)visionTransform != (Object)null)) { return GetCharacterGrabOrigin(avatar); } return visionTransform.position; } private static bool IsForwardReachableGrabPoint(Vector3 origin, Vector3 point, Vector3 aimDirection, float grabRange) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - origin; if (Vector3.Dot(val, ((Vector3)(ref aimDirection)).normalized) <= 0.03f) { return false; } return ((Vector3)(ref val)).magnitude <= grabRange + 0.05f; } private float GetCurrentGrabRange() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PhysGrabber instance = PhysGrabber.instance; if ((Object)instance != (Object)null && instance.grabRange > 0.1f) { return instance.grabRange; } return Mathf.Max(0.1f, (_selectionMaxDistance != null) ? Mathf.Min(_selectionMaxDistance.Value, 4f) : 4f); } private static Vector3 ResolveCharacterReachCrosshairTarget(Vector3 characterOrigin, Ray cameraCenterRay, float grabRange) { //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_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_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_004b: 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_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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) Vector3 direction = ((Ray)(ref cameraCenterRay)).direction; Vector3 normalized = ((Vector3)(ref direction)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude < 0.0001f) { return characterOrigin + Vector3.forward * grabRange; } float num = Mathf.Max(0.1f, grabRange); Vector3 val = ((Ray)(ref cameraCenterRay)).origin - characterOrigin; float num2 = Vector3.Dot(val, normalized); float num3 = ((Vector3)(ref val)).sqrMagnitude - num * num; float num4 = num2 * num2 - num3; if (num4 >= 0f) { float num5 = Mathf.Sqrt(num4); float num6 = 0f - num2 - num5; float num7 = 0f - num2 + num5; float num8 = ((num7 >= 0f) ? num7 : num6); if (num8 >= 0f) { return ((Ray)(ref cameraCenterRay)).origin + normalized * num8; } } float num9 = Mathf.Max(0f, 0f - num2); Vector3 val2 = ((Ray)(ref cameraCenterRay)).origin + normalized * num9 - characterOrigin; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = normalized; } return characterOrigin + ((Vector3)(ref val2)).normalized * num; } internal bool TryGetSelectionOverride(PlayerLocalCamera localCamera, ref Transform result) { if (!CanOverrideSelection(localCamera)) { return false; } result = _selectionTransform; return true; } internal bool TryGetSelectionOverrideActive(PlayerLocalCamera localCamera, ref bool result) { if (!CanOverrideSelection(localCamera)) { return false; } result = true; return true; } private bool CanOverrideSelection(PlayerLocalCamera localCamera) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if (!_thirdPersonActive || !_cameraCenteredSelection.Value || _temporarilyFirstPerson) { return false; } if (!((Object)_selectionTransform != (Object)null) || !((Object)localCamera != (Object)null)) { return false; } return (Object)(object)localCamera.playerAvatar == (Object)(object)PlayerAvatar.instance; } private float ClampDistance(float distance) { float num = Mathf.Max(0.1f, _minDistance?.Value ?? 1f); float num2 = Mathf.Max(num, _maxDistance?.Value ?? 10f); return Mathf.Clamp(distance, num, num2); } private void ApplyClipPlanes() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown CollectCameras(); foreach (Camera item in _cameraBuffer) { if ((Object)item != (Object)null) { if (!_originalClipPlanes.ContainsKey(item)) { _originalClipPlanes.Add(item, new ClipPlaneState { Near = item.nearClipPlane, Far = item.farClipPlane }); } ClipPlaneState clipPlaneState = _originalClipPlanes[item]; item.nearClipPlane = Mathf.Min(clipPlaneState.Near, _nearClipPlane.Value); item.farClipPlane = Mathf.Max(clipPlaneState.Far, _minimumFarClipPlane.Value); } } } private void RestoreClipPlanes() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown foreach (KeyValuePair originalClipPlane in _originalClipPlanes) { Camera key = originalClipPlane.Key; if ((Object)key != (Object)null) { key.nearClipPlane = originalClipPlane.Value.Near; key.farClipPlane = originalClipPlane.Value.Far; } } _originalClipPlanes.Clear(); _cameraBuffer.Clear(); } private void CollectCameras() { _cameraBuffer.Clear(); AddCamera(Camera.main); Camera[] allCameras = Camera.allCameras; for (int i = 0; i < allCameras.Length; i++) { AddCamera(allCameras[i]); } CameraZoom instance = CameraZoom.Instance; if (instance?.cams == null) { return; } foreach (Camera cam in instance.cams) { AddCamera(cam); } } private void AddCamera(Camera cam) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown if ((Object)cam != (Object)null && !cam.orthographic && !_cameraBuffer.Contains(cam)) { _cameraBuffer.Add(cam); } } private void CreateInputActions() { //IL_0012: 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_0048: Unknown result type (might be due to invalid IL or missing references) DisposeInputActions(); _toggleAction = CreateKeyboardAction("REPO Native Third Person Toggle", _toggleKey.Value); _zoomInAction = CreateKeyboardAction("REPO Native Third Person Zoom In", _zoomInKey.Value); _zoomOutAction = CreateKeyboardAction("REPO Native Third Person Zoom Out", _zoomOutKey.Value); } private static InputAction CreateKeyboardAction(string name, KeyCode keyCode) { //IL_0000: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown string text = KeyCodeToKeyboardPath(keyCode); if (string.IsNullOrEmpty(text)) { return null; } InputAction val = new InputAction(name, (InputActionType)1, text, (string)null, (string)null, (string)null); val.Enable(); return val; } private void DisposeInputActions() { DisposeInputAction(ref _toggleAction); DisposeInputAction(ref _zoomInAction); DisposeInputAction(ref _zoomOutAction); } private static void DisposeInputAction(ref InputAction action) { if (action != null) { action.Disable(); action.Dispose(); action = null; } } private static bool IsActionPressedThisFrame(InputAction action) { if (action != null && action.enabled) { return action.WasPressedThisFrame(); } return false; } private static bool IsActionHeld(InputAction action) { if (action != null && action.enabled) { return action.IsPressed(); } return false; } private static bool IsKeyPressedThisFrame(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) try { return Input.GetKeyDown(key); } catch { return false; } } private static bool IsKeyHeld(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) try { return Input.GetKey(key); } catch { return false; } } private static float ReadScrollWheel() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0047: 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) if ((Object)InputManager.instance != (Object)null) { float scrollY = InputManager.instance.GetScrollY(); if (Mathf.Abs(scrollY) > 0.001f) { return Mathf.Sign(scrollY); } } if (Mouse.current != null) { float y = ((InputControl)(object)Mouse.current.scroll).ReadValue().y; if (Mathf.Abs(y) > 0.001f) { return Mathf.Sign(y); } } try { return Input.mouseScrollDelta.y; } catch { return 0f; } } private static bool TryGetKeyboardKey(KeyCode keyCode, out Key key) { key = (Key)0; return false; } private static string KeyCodeToKeyboardPath(KeyCode keyCode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown int num = (int)keyCode; if (num >= 97 && num <= 122) { return $"/{(char)num}"; } if (num >= 48 && num <= 57) { return $"/{num - 48}"; } if (num >= 256 && num <= 265) { return $"/numpad{num - 256}"; } switch (num) { case 8: return "/backspace"; case 9: return "/tab"; case 13: return "/enter"; case 27: return "/escape"; case 32: return "/space"; case 43: case 61: return "/equals"; case 45: return "/minus"; case 127: return "/delete"; case 273: return "/upArrow"; case 274: return "/downArrow"; case 275: return "/rightArrow"; case 276: return "/leftArrow"; case 277: return "/insert"; case 278: return "/home"; case 279: return "/end"; case 280: return "/pageUp"; case 281: return "/pageDown"; default: if (num >= 282 && num <= 293) { return $"/f{num - 281}"; } return null; } } } }