Decompiled source of ZoomOutMod v1.0.0

ZoomOutMod.dll

Decompiled a day ago
using System;
using System.Diagnostics;
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 HarmonyLib;
using Microsoft.CodeAnalysis;

[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("ZoomOutMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ZoomOutMod")]
[assembly: AssemblyTitle("ZoomOutMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 ZoomOutMod
{
	[BepInPlugin("com.github.antigravity.zoomoutmod", "Zoom Out Mod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource? Log;

		private Harmony? _harmony;

		public static ConfigEntry<float>? MaxZoomMultiplier;

		private void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Sineus Arena Zoom Out Mod is initializing...");
			try
			{
				MaxZoomMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "MaxZoomMultiplier", 2f, "Multiplier for the maximum camera zoom out distance (e.g. 2.0 doubles it).");
				_harmony = new Harmony("com.github.antigravity.zoomoutmod");
				_harmony.PatchAll();
				Log.LogInfo((object)"Harmony patches for Zoom Out Mod applied successfully!");
			}
			catch (Exception ex)
			{
				Log.LogError((object)("Failed to initialize Zoom Out Mod: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(CameraScrollZoom), "Awake")]
	public static class CameraScrollZoom_Awake_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(CameraScrollZoom __instance)
		{
			try
			{
				Traverse obj = Traverse.Create((object)__instance);
				float value = obj.Field<float>("maxCameraDistance").Value;
				float num = Plugin.MaxZoomMultiplier?.Value ?? 2f;
				float num2 = value * num;
				obj.Field("maxCameraDistance").SetValue((object)num2);
				ManualLogSource? log = Plugin.Log;
				if (log != null)
				{
					log.LogInfo((object)$"[CameraScrollZoom] Applied multiplier {num}. Modified maxCameraDistance from {value} to {num2}");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? log2 = Plugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)("Error in CameraScrollZoom Awake Postfix: " + ex));
				}
			}
		}
	}
	[HarmonyPatch(typeof(CinemachineZoomController), "Start")]
	public static class CinemachineZoomController_Start_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(CinemachineZoomController __instance)
		{
			try
			{
				Traverse obj = Traverse.Create((object)__instance);
				float value = obj.Field<float>("maxDistance").Value;
				float num = Plugin.MaxZoomMultiplier?.Value ?? 2f;
				float num2 = value * num;
				obj.Field("maxDistance").SetValue((object)num2);
				ManualLogSource? log = Plugin.Log;
				if (log != null)
				{
					log.LogInfo((object)$"[CinemachineZoomController] Applied multiplier {num}. Modified maxDistance from {value} to {num2}");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource? log2 = Plugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)("Error in CinemachineZoomController Start Postfix: " + ex));
				}
			}
		}
	}
}