Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of WiresSailingCamera v0.2.2
WiresSailingCamera.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("WiresSailingCamera")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WiresSailingCamera")] [assembly: AssemblyTitle("WiresSailingCamera")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WiresSailingCamera { [BepInPlugin("wire.valheim.sailingcamera", "Wire's Sailing Camera", "0.2.2")] [BepInProcess("valheim.exe")] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "wire.valheim.sailingcamera"; public const string Name = "Wire's Sailing Camera"; public const string Version = "0.2.2"; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<float> HeightOffset; internal static ConfigEntry<float> MaximumZoom; private Harmony _harmony; private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable the sailing-only camera height adjustment."); HeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Sailing Camera", "Height Offset", 7.5f, new ConfigDescription("Extra world-space camera pivot height in metres while steering a ship. Higher positions place the ship and character below the crosshair rather than near its centre. Vanilla camera distance and sideways position remain unchanged.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>())); MaximumZoom = ((BaseUnityPlugin)this).Config.Bind<float>("Sailing Camera", "Maximum Zoom", 30f, new ConfigDescription("Maximum third-person camera distance in metres while steering a ship. Vanilla is 6 m. Default 30 m for a much farther-back view; scroll back to zoom out. Does not change the camera height or on-foot view.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(6f, 60f), Array.Empty<object>())); _harmony = new Harmony("wire.valheim.sailingcamera"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Wire's Sailing Camera 0.2.2 loaded (height + extended boat zoom)."); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(GameCamera), "GetCameraBaseOffset")] internal static class SailingHeightPatch { private static readonly FieldRef<GameCamera, float> Distance = AccessTools.FieldRefAccess<GameCamera, float>("m_distance"); [HarmonyPostfix] private static void Postfix(GameCamera __instance, Player player, ref Vector3 __result) { //IL_005d: 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_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_007b: Unknown result type (might be due to invalid IL or missing references) if (Plugin.Enabled != null && Plugin.Enabled.Value && !((Object)(object)__instance == (Object)null) && !((Object)(object)player == (Object)null) && !((Object)(object)player != (Object)(object)Player.m_localPlayer) && !((Object)(object)player.GetControlledShip() == (Object)null) && !(Distance.Invoke(__instance) <= 0.05f) && !GameCamera.InFreeFly()) { __result += Vector3.up * Plugin.HeightOffset.Value; } } } [HarmonyPatch(typeof(GameCamera), "LateUpdate")] internal static class SailingZoomPatch { [HarmonyPrefix] private static void Prefix(GameCamera __instance, out float __state) { __state = __instance.m_maxDistanceBoat; if (Plugin.Enabled != null && Plugin.Enabled.Value) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)localPlayer.GetControlledShip() == (Object)null) && !GameCamera.InFreeFly()) { __instance.m_maxDistanceBoat = Mathf.Max(__state, Plugin.MaximumZoom.Value); } } } [HarmonyPostfix] private static void Postfix(GameCamera __instance, float __state) { __instance.m_maxDistanceBoat = __state; } [HarmonyFinalizer] private static Exception Finalizer(GameCamera __instance, float __state, Exception __exception) { __instance.m_maxDistanceBoat = __state; return __exception; } } }