using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LCThirdPerson.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LCThirdPerson")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+43bdbd5b92a026ab31d642a3f279dee5063ee55a")]
[assembly: AssemblyProduct("LCThirdPerson")]
[assembly: AssemblyTitle("LCThirdPerson")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 LCThirdPerson
{
[BepInPlugin("LCThirdPerson", "LCThirdPerson", "1.0.0")]
public class ThirdPersonPlugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("LCThirdPerson");
private bool tpEnabled;
public static ThirdPersonPlugin Instance { get; private set; }
public static Transform Camera { get; internal set; }
public static Transform OriginalTransform { get; internal set; }
public static Transform VrmHeadTransform { get; internal set; }
public static Sprite CrosshairSprite { get; internal set; }
public ConfigEntry<KeyboardShortcut> Enable { get; internal set; }
public ConfigEntry<bool> ShowCursor { get; set; }
public ConfigEntry<bool> StartEnabled { get; set; }
public ConfigEntry<Vector3> Offset { get; set; }
public ConfigEntry<float> CameraMaxHeight { get; set; }
public ConfigEntry<float> CameraLookDownOffset { get; set; }
public ConfigEntry<bool> AlwaysHideVisor { get; set; }
public ConfigEntry<bool> FirstPersonVrm { get; set; }
public ConfigEntry<float> FirstPersonVrmHeadHideDistance { get; set; }
public bool Enabled
{
get
{
return tpEnabled;
}
set
{
SetEnabled(value);
}
}
internal static ManualLogSource Log { get; set; }
internal UnityEvent OnEnable { get; private set; }
internal UnityEvent OnDisable { get; private set; }
private void Awake()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LCThirdPerson is loaded!");
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
Log = Logger.CreateLogSource("LCThirdPerson");
OnEnable = new UnityEvent();
OnDisable = new UnityEvent();
SetConfig();
SetCrosshairSprite();
harmony.PatchAll(typeof(ThirdPersonPlugin));
harmony.PatchAll(typeof(CameraPatch));
harmony.PatchAll(typeof(CursorPatch));
harmony.PatchAll(typeof(HUDPatch));
}
internal void SetConfig()
{
//IL_0018: 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)
Enable = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "Toggle", new KeyboardShortcut((KeyCode)118, Array.Empty<KeyCode>()), (ConfigDescription)null);
ShowCursor = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "ShowCursor", true, (ConfigDescription)null);
StartEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "StartEnabled", true, (ConfigDescription)null);
Offset = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Options", "CameraOffset", new Vector3(0.4f, 0f, -2f), (ConfigDescription)null);
CameraMaxHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Options", "CameraMaxHeight", 1f, (ConfigDescription)null);
CameraLookDownOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Options", "CameraLookDownOffset", 0.2f, (ConfigDescription)null);
AlwaysHideVisor = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "AlwaysHideVisor", false, (ConfigDescription)null);
FirstPersonVrm = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "FirstPersonVRM", false, (ConfigDescription)null);
FirstPersonVrmHeadHideDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Options", "VrmHeadHideDistance", 0.5f, (ConfigDescription)null);
Enabled = StartEnabled.Value;
}
internal void SetCrosshairSprite()
{
CrosshairSprite = CursorPatch.CreateCrosshairSprite();
}
internal void CheckEnable()
{
//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)
KeyboardShortcut value = Enable.Value;
if (((KeyboardShortcut)(ref value)).IsUp())
{
Enabled = !Enabled;
}
}
public void SetEnabled(bool value)
{
tpEnabled = value;
if (tpEnabled)
{
OnEnable.Invoke();
}
else
{
OnDisable.Invoke();
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LCThirdPerson";
public const string PLUGIN_NAME = "LCThirdPerson";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LCThirdPerson.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class CameraPatch
{
[CompilerGenerated]
private static class <>O
{
public static UnityAction <0>__OnEnable;
public static UnityAction <1>__OnDisable;
}
private static PlayerControllerB Instance;
private static bool TriggerAwake;
private static int OriginalCullingMask;
private static ShadowCastingMode OriginalShadowCastingMode;
private static readonly string[] IgnoreGameObjectPrefixes = new string[1] { "VolumeMain" };
public static void OnEnable()
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
ThirdPersonPlugin.Log.LogInfo((object)"Enabled");
Transform localVisor = Instance.localVisor;
SkinnedMeshRenderer thisPlayerModel = Instance.thisPlayerModel;
MeshRenderer componentInChildren = ((Component)localVisor).GetComponentInChildren<MeshRenderer>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
((Renderer)componentInChildren).enabled = false;
}
((Renderer)thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1;
((Renderer)Instance.thisPlayerModelArms).enabled = false;
Instance.gameplayCamera.cullingMask = OriginalCullingMask | 0x800000;
Instance.grabDistance = Math.Max(5f - ThirdPersonPlugin.Instance.Offset.Value.z, 5f);
}
public static void OnDisable()
{
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
ThirdPersonPlugin.Log.LogInfo((object)"Disabled");
Transform localVisor = Instance.localVisor;
SkinnedMeshRenderer thisPlayerModel = Instance.thisPlayerModel;
MeshRenderer componentInChildren = ((Component)localVisor).GetComponentInChildren<MeshRenderer>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
((Renderer)componentInChildren).enabled = !ThirdPersonPlugin.Instance.AlwaysHideVisor.Value;
}
if (ThirdPersonPlugin.Instance.FirstPersonVrm.Value)
{
((Renderer)thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1;
((Renderer)Instance.thisPlayerModelArms).enabled = false;
Instance.gameplayCamera.cullingMask = OriginalCullingMask | 0x800000;
}
else
{
((Renderer)thisPlayerModel).shadowCastingMode = OriginalShadowCastingMode;
((Renderer)Instance.thisPlayerModelArms).enabled = true;
Instance.gameplayCamera.cullingMask = OriginalCullingMask;
}
Instance.grabDistance = 5f;
}
[HarmonyPostfix]
[HarmonyPatch("Awake")]
private static void Awake()
{
TriggerAwake = true;
}
[HarmonyPrefix]
[HarmonyPatch("Update")]
private static void PatchUpdate(ref PlayerControllerB __instance, ref bool ___isCameraDisabled, ref bool ___isPlayerControlled)
{
//IL_003a: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: 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)
//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_0093: Expected O, but got Unknown
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
if (!___isPlayerControlled | ___isCameraDisabled)
{
return;
}
if (TriggerAwake)
{
Instance = __instance;
OriginalCullingMask = Instance.gameplayCamera.cullingMask;
OriginalShadowCastingMode = ((Renderer)Instance.thisPlayerModel).shadowCastingMode;
UnityEvent onEnable = ThirdPersonPlugin.Instance.OnEnable;
object obj = <>O.<0>__OnEnable;
if (obj == null)
{
UnityAction val = OnEnable;
<>O.<0>__OnEnable = val;
obj = (object)val;
}
onEnable.AddListener((UnityAction)obj);
UnityEvent onDisable = ThirdPersonPlugin.Instance.OnDisable;
object obj2 = <>O.<1>__OnDisable;
if (obj2 == null)
{
UnityAction val2 = OnDisable;
<>O.<1>__OnDisable = val2;
obj2 = (object)val2;
}
onDisable.AddListener((UnityAction)obj2);
if (ThirdPersonPlugin.Instance.Enabled)
{
OnEnable();
}
TriggerAwake = false;
}
if ((Object)(object)Instance == (Object)null)
{
return;
}
if ((Object)(object)ThirdPersonPlugin.OriginalTransform == (Object)null)
{
ThirdPersonPlugin.OriginalTransform = CopyTransform(((Component)Instance.gameplayCamera).transform, "LCThirdPerson_Original Camera Position");
ThirdPersonPlugin.Camera = CopyTransform(((Component)Instance.gameplayCamera).transform, "LCThirdPerson_Camera Position");
}
ThirdPersonPlugin.Camera.position = ((Component)Instance.gameplayCamera).transform.position;
ThirdPersonPlugin.Camera.rotation = ((Component)Instance.gameplayCamera).transform.rotation;
((Component)Instance.gameplayCamera).transform.rotation = ((Component)ThirdPersonPlugin.OriginalTransform).transform.rotation;
((Component)Instance.gameplayCamera).transform.position = ((Component)ThirdPersonPlugin.OriginalTransform).transform.position;
if (Instance.inTerminalMenu || Instance.isTypingChat)
{
return;
}
if (ThirdPersonPlugin.Instance.FirstPersonVrm.Value)
{
Transform headBone = GetHeadBone();
if ((Object)(object)headBone != (Object)null && (Object)(object)ThirdPersonPlugin.Camera != (Object)null)
{
if (Vector3.Distance(headBone.position, ThirdPersonPlugin.Camera.position) > ThirdPersonPlugin.Instance.FirstPersonVrmHeadHideDistance.Value)
{
headBone.localScale = new Vector3(1f, 1f, 1f);
}
else
{
headBone.localScale = new Vector3(0f, 0f, 0f);
}
}
}
ThirdPersonPlugin.Instance.CheckEnable();
}
[HarmonyPostfix]
[HarmonyPatch("LateUpdate")]
private static void PatchCamera(ref bool ___isCameraDisabled, ref bool ___isPlayerControlled)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: 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_01c8: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: 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_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
Transform originalTransform = ThirdPersonPlugin.OriginalTransform;
if ((!___isPlayerControlled | ___isCameraDisabled) || (Object)(object)originalTransform == (Object)null)
{
return;
}
Vector3 up = originalTransform.up;
up.y = 0f;
up *= ThirdPersonPlugin.Instance.CameraLookDownOffset.Value;
Camera gameplayCamera = Instance.gameplayCamera;
((Component)originalTransform).transform.rotation = ((Component)gameplayCamera).transform.rotation;
if (ThirdPersonPlugin.Instance.Enabled && !Instance.inTerminalMenu)
{
Vector3 val = ((Component)originalTransform).transform.right * ThirdPersonPlugin.Instance.Offset.Value.x + ((Component)originalTransform).transform.up * ThirdPersonPlugin.Instance.Offset.Value.y;
Vector3 position = ((Component)originalTransform).transform.position;
Vector3 val2 = ((Component)originalTransform).transform.position + up + val + ((Component)originalTransform).transform.forward * ThirdPersonPlugin.Instance.Offset.Value.z;
RaycastHit val3 = default(RaycastHit);
val = ((!Physics.Linecast(position, val2, ref val3, StartOfRound.Instance.collidersAndRoomMask) || IgnoreCollision(((Object)((RaycastHit)(ref val3)).transform).name)) ? (val + ((Component)originalTransform).transform.forward * ThirdPersonPlugin.Instance.Offset.Value.z) : (val + ((Component)originalTransform).transform.forward * (0f - Mathf.Max(((RaycastHit)(ref val3)).distance, 0f))));
val.y = Math.Min(val.y, ThirdPersonPlugin.Instance.CameraMaxHeight.Value);
((Component)gameplayCamera).transform.position = ((Component)originalTransform).transform.position + up + val;
if (!Instance.isClimbingLadder)
{
typeof(PlayerControllerB).GetMethod("SetHoverTipAndCurrentInteractTrigger", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(Instance, new object[0]);
}
}
}
[HarmonyPrefix]
[HarmonyPatch("SetFaceUnderwaterFilters")]
private static void UnderwaterPrepatch()
{
//IL_0034: 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)
if (!((Object)(object)Instance == (Object)null) && !((Object)(object)ThirdPersonPlugin.Camera == (Object)null))
{
((Component)Instance.gameplayCamera).transform.position = ((Component)ThirdPersonPlugin.Camera).transform.position;
((Component)Instance.gameplayCamera).transform.rotation = ((Component)ThirdPersonPlugin.Camera).transform.rotation;
}
}
[HarmonyPostfix]
[HarmonyPatch("SetFaceUnderwaterFilters")]
private static void UnderwaterPostpatch()
{
//IL_0034: 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)
if (!((Object)(object)Instance == (Object)null) && !((Object)(object)ThirdPersonPlugin.OriginalTransform == (Object)null))
{
((Component)Instance.gameplayCamera).transform.position = ((Component)ThirdPersonPlugin.OriginalTransform).transform.position;
((Component)Instance.gameplayCamera).transform.rotation = ((Component)ThirdPersonPlugin.OriginalTransform).transform.rotation;
}
}
[HarmonyPostfix]
[HarmonyPatch("SpawnPlayerAnimation")]
private static void SpawnPlayerPostpatch(ref bool ___isPlayerControlled)
{
if (!((Object)(object)Instance == (Object)null) && ___isPlayerControlled && ThirdPersonPlugin.Instance.Enabled)
{
OnEnable();
}
}
private static Transform CopyTransform(Transform copyTransform, string gameObjectName)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
Transform transform = new GameObject(gameObjectName).transform;
transform.position = copyTransform.position;
transform.rotation = copyTransform.rotation;
transform.parent = copyTransform.parent;
return transform;
}
private static bool IgnoreCollision(string name)
{
return IgnoreGameObjectPrefixes.Any((string prefix) => name.StartsWith(prefix));
}
private static Transform GetHeadBone()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)ThirdPersonPlugin.VrmHeadTransform == (Object)null)
{
Scene scene = ((Component)Instance.localVisor).gameObject.scene;
GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
Transform val = null;
GameObject[] array = rootGameObjects;
foreach (GameObject val2 in array)
{
if (!((Object)val2).name.StartsWith("LethalVRM Character Model"))
{
continue;
}
Transform val3 = RecursiveFindChild(val2.transform, "Head");
if ((Object)(object)val3 != (Object)null && Vector3.Distance(val3.position, ThirdPersonPlugin.OriginalTransform.position) < 0.5f)
{
if ((Object)(object)val != (Object)null)
{
return null;
}
val = val3;
}
}
if ((Object)(object)val != (Object)null)
{
return ThirdPersonPlugin.VrmHeadTransform = val;
}
return null;
}
return ThirdPersonPlugin.VrmHeadTransform;
}
private static Transform RecursiveFindChild(Transform parent, string childName)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
foreach (Transform item in parent)
{
Transform val = item;
if (((Object)val).name.ToLower() == childName.ToLower())
{
return val;
}
Transform val2 = RecursiveFindChild(val, childName);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
return null;
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class CursorPatch
{
internal static Sprite CreateCrosshairSprite()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
string name = "LCThirdPerson.crosshair.png";
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
Texture2D val = new Texture2D(2, 2);
using (MemoryStream memoryStream = new MemoryStream())
{
manifestResourceStream.CopyTo(memoryStream);
ImageConversion.LoadImage(val, memoryStream.ToArray());
}
((Texture)val).filterMode = (FilterMode)0;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2((float)(((Texture)val).width / 2), (float)(((Texture)val).height / 2)));
}
[HarmonyPostfix]
[HarmonyPatch("LateUpdate")]
private static void PatchUpdate(ref PlayerControllerB __instance, ref bool ___isCameraDisabled)
{
if (!(!__instance.isPlayerControlled | ___isCameraDisabled) && ThirdPersonPlugin.Instance.Enabled && ThirdPersonPlugin.Instance.ShowCursor.Value && !__instance.inTerminalMenu && !((Behaviour)__instance.cursorIcon).enabled)
{
((Behaviour)__instance.cursorIcon).enabled = true;
__instance.cursorIcon.sprite = ThirdPersonPlugin.CrosshairSprite;
}
}
}
[HarmonyPatch(typeof(HUDManager))]
internal class HUDPatch
{
[HarmonyPrefix]
[HarmonyPatch("UpdateScanNodes")]
private static void UnderwaterPrepatch(PlayerControllerB playerScript)
{
//IL_0023: 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)
if (!((Object)(object)ThirdPersonPlugin.Camera == (Object)null))
{
((Component)playerScript.gameplayCamera).transform.position = ((Component)ThirdPersonPlugin.Camera).transform.position;
((Component)playerScript.gameplayCamera).transform.rotation = ((Component)ThirdPersonPlugin.Camera).transform.rotation;
}
}
[HarmonyPostfix]
[HarmonyPatch("UpdateScanNodes")]
private static void UnderwaterPostpatch(PlayerControllerB playerScript)
{
//IL_0023: 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)
if (!((Object)(object)ThirdPersonPlugin.OriginalTransform == (Object)null))
{
((Component)playerScript.gameplayCamera).transform.position = ((Component)ThirdPersonPlugin.OriginalTransform).transform.position;
((Component)playerScript.gameplayCamera).transform.rotation = ((Component)ThirdPersonPlugin.OriginalTransform).transform.rotation;
}
}
}
}