Decompiled source of ViewMultiplier v1.0.0

ViewMultiplier.dll

Decompiled 3 months 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;
using ViewMultiplier.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("ViewMultiplier")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Multiplies views by desired amount.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ViewMultiplier")]
[assembly: AssemblyTitle("ViewMultiplier")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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 ViewMultiplier
{
	[BepInPlugin("ViewMultiplier", "ViewMultiplier", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("ViewMultiplier");

		public static ConfigFile? ViewMultiplierCFG;

		public static ManualLogSource? VMLogger;

		private void Awake()
		{
			VMLogger = ((BaseUnityPlugin)this).Logger;
			VMLogger.LogInfo((object)"Plugin ViewMultiplier is loaded!");
			ViewMultiplierCFG = ((BaseUnityPlugin)this).Config;
			ConfigFile? viewMultiplierCFG = ViewMultiplierCFG;
			if (viewMultiplierCFG != null)
			{
				viewMultiplierCFG.Bind<int>("Settings", "ViewMultiplier", 2, "Multiplies views by this integer. Default value is 2.");
			}
			VMLogger.LogInfo((object)"Config file is loaded!");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(ViewCalculationPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ViewMultiplier";

		public const string PLUGIN_NAME = "ViewMultiplier";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ViewMultiplier.Patches
{
	[HarmonyPatch(typeof(ContentBuffer))]
	internal class ViewCalculationPatch
	{
		internal static float MultiplierValue
		{
			get
			{
				ConfigFile? viewMultiplierCFG = Plugin.ViewMultiplierCFG;
				return ((viewMultiplierCFG != null) ? new int?(viewMultiplierCFG.Bind<int>("Settings", "ViewMultiplier", 2, "Multiplies views by this integer. Default value is 2.").Value) : null).Value;
			}
		}

		[HarmonyPatch("GetScore")]
		[HarmonyPostfix]
		private static void MultiplierPatch(ref float __result)
		{
			float multiplierValue = MultiplierValue;
			__result *= multiplierValue;
		}
	}
}