using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CameraRootUpdater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CameraRootUpdater")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6bc82119-9b4f-4f0e-b518-085743e75688")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CameraRootUpdater;
[HarmonyPatch(typeof(StartOfRound))]
public class CameraUpdater : MonoBehaviour
{
private PlayerControllerB localPlayer;
private Vector3 cameraOffset = Vector3.zero;
private UpdateItemRoot ItemRootUpdater;
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void PostFix(StartOfRound __instance)
{
((Component)__instance).gameObject.AddComponent<CameraUpdater>();
}
private void Start()
{
//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)
cameraOffset = new Vector3(0f, CameraUpdaterBase.cameraHeight.Value, 0f);
if ((Object)(object)ItemRootUpdater == (Object)null)
{
ItemRootUpdater = ((Component)this).gameObject.AddComponent<UpdateItemRoot>();
}
}
private void Update()
{
//IL_0095: 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)
if ((Object)(object)localPlayer == (Object)null)
{
localPlayer = StartOfRound.Instance.localPlayerController;
ItemRootUpdater.plrCntrB = localPlayer;
}
else if (!localPlayer.isPlayerDead && !localPlayer.inSpecialInteractAnimation && !localPlayer.inTerminalMenu)
{
((Component)localPlayer.gameplayCamera).transform.localPosition = cameraOffset;
}
else
{
((Component)localPlayer.gameplayCamera).transform.localPosition = Vector3.zero;
}
}
private void OnDisable()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)localPlayer))
{
((Component)localPlayer.gameplayCamera).transform.localPosition = Vector3.zero;
}
}
}
[BepInPlugin("CameraRootUpdater.makoalass", "CameraRootUpdater", "0.0.0.1")]
public class CameraUpdaterBase : BaseUnityPlugin
{
public static ConfigFile config;
private const string modGUID = "CameraRootUpdater.makoalass";
private const string modNAME = "CameraRootUpdater";
private const string modVER = "0.0.0.1";
private readonly Harmony harmony = new Harmony("CameraRootUpdater.makoalass");
private static CameraUpdaterBase instance;
internal ManualLogSource mls;
public static ConfigEntry<bool> modEnabled { get; private set; }
public static ConfigEntry<float> cameraHeight { get; private set; }
private static string GetAssemblyName()
{
return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0];
}
private static void InitConfig()
{
modEnabled = config.Bind<bool>("Enabled", "", true, "Enables / Disables the mod");
cameraHeight = config.Bind<float>("Camera Height", "Set Height", 0f, "Sets how high or low the camera should be offset by");
}
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
config = ((BaseUnityPlugin)this).Config;
mls = Logger.CreateLogSource("CameraRootUpdater.makoalass");
InitConfig();
harmony.PatchAll(typeof(CameraUpdaterBase));
harmony.PatchAll(typeof(CameraUpdater));
mls.LogInfo((object)"CameraRootUpdater Loaded");
}
}
[DefaultExecutionOrder(-1)]
internal class UpdateItemRoot : MonoBehaviour
{
internal PlayerControllerB plrCntrB;
private GameObject offsetBuild;
private Vector3 org;
private void LateUpdate()
{
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_011d: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)plrCntrB == (Object)null)
{
return;
}
if ((Object)(object)offsetBuild == (Object)null || (Object)(object)offsetBuild.transform.parent == (Object)null)
{
object obj = this;
obj = ((!((Object)(object)offsetBuild == (Object)null)) ? ((object)offsetBuild) : ((object)new GameObject("LocalOffset")));
((UpdateItemRoot)obj).offsetBuild = (GameObject)obj;
offsetBuild.transform.parent = plrCntrB.localArmsTransform.parent;
org = offsetBuild.transform.parent.localPosition;
return;
}
org = offsetBuild.transform.parent.localPosition;
Vector3 val = org;
if (!plrCntrB.inTerminalMenu && !plrCntrB.inSpecialInteractAnimation)
{
val += new Vector3(0f, CameraUpdaterBase.cameraHeight.Value, 0f);
}
offsetBuild.transform.parent.localPosition = val;
}
}