Decompiled source of ZoomSpeed v0.1.0

plugins/ZoomSpeed.dll

Decompiled 18 hours ago
using System;
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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ZoomSpeed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZoomSpeed")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
namespace ZoomSpeed;

[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
internal static class UpdateCameraPatch
{
	private static float _vanillaZoomSens;

	private static void Prefix(GameCamera __instance)
	{
		if (_vanillaZoomSens == 0f)
		{
			_vanillaZoomSens = __instance.m_zoomSens;
		}
		__instance.m_zoomSens = _vanillaZoomSens * ZoomSpeed.ScrollMultiplier.Value;
	}
}
[BepInPlugin("orax.ZoomSpeed", "ZoomSpeed", "0.1.0")]
internal class ZoomSpeed : BaseUnityPlugin
{
	public const string PluginGUID = "orax.ZoomSpeed";

	public const string PluginName = "ZoomSpeed";

	public const string PluginVersion = "0.1.0";

	internal static ManualLogSource Log;

	internal static ConfigEntry<float> ScrollMultiplier;

	private Harmony _harmony;

	private void Awake()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"ZoomSpeed has landed");
		ScrollMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom", "ScrollMultiplier", 2f, new ConfigDescription("Mouse wheel zoom speed multiplier (1 = vanilla).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
		_harmony = new Harmony("orax.ZoomSpeed");
		_harmony.PatchAll();
	}

	private void OnDestroy()
	{
		Harmony harmony = _harmony;
		if (harmony != null)
		{
			harmony.UnpatchSelf();
		}
	}
}