using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BoatAttachZoom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BoatAttachZoom")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace BoatAttachZoom;
[BepInPlugin("com.willhodges.BoatAttachZoom", "BoatAttachZoom", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class BoatAttachZoom : BaseUnityPlugin
{
[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
public static class GameCameraUpdateCamera
{
public static void Prefix(GameCamera __instance, float dt)
{
Player localPlayer = Player.m_localPlayer;
if (!IsNull(localPlayer) && ((Character)localPlayer).IsAttachedToShip())
{
MaxDistance = __instance.m_maxDistance;
__instance.m_maxDistance = __instance.m_maxDistanceBoat;
ModifiedZoom = true;
}
}
public static void Postfix(GameCamera __instance, float dt)
{
if (ModifiedZoom)
{
__instance.m_maxDistance = MaxDistance;
ModifiedZoom = false;
}
}
}
public const string PluginGUID = "com.willhodges.BoatAttachZoom";
public const string PluginName = "BoatAttachZoom";
public const string PluginVersion = "0.0.1";
public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();
public static float MaxDistance { get; set; }
public static bool ModifiedZoom { get; set; }
private void Awake()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.willhodges.BoatAttachZoom");
}
public static bool IsNull(object obj)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
return (Object)obj == (Object)null;
}
}