Decompiled source of CrimsonFOV v0.2.0

CrimsonFOV.dll

Decompiled 6 months ago
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Bloodstone.API;
using CrimsonFOV.Structs;
using HarmonyLib;
using ProjectM;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CrimsonFOV")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Modifies the camera field of view")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0+4.Branch.master.Sha.e54c4154eba8f32cfde33495c27497c588e6fe42")]
[assembly: AssemblyProduct("CrimsonFOV")]
[assembly: AssemblyTitle("CrimsonFOV")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.0.0")]
[module: UnverifiableCode]
namespace CrimsonFOV
{
	[BepInPlugin("CrimsonFOV", "CrimsonFOV", "0.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[Reloadable]
	public class Plugin : BasePlugin
	{
		private Harmony _harmony;

		public static Settings Settings { get; private set; }

		public static ManualLogSource Logger { get; private set; }

		public override void Load()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			Settings = new Settings(((BasePlugin)this).Config);
			Logger = ((BasePlugin)this).Log;
			ManualLogSource logger = Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CrimsonFOV");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.2.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			logger.LogInfo(val);
			_harmony = new Harmony("CrimsonFOV");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}

		public override bool Unload()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CrimsonFOV";

		public const string PLUGIN_NAME = "CrimsonFOV";

		public const string PLUGIN_VERSION = "0.2.0";
	}
}
namespace CrimsonFOV.Structs
{
	public readonly struct Settings
	{
		internal readonly ConfigFile CONFIG;

		internal readonly ConfigEntry<bool> ENABLE_MOD;

		internal readonly ConfigEntry<float> FIELD_OF_VIEW;

		public Settings(ConfigFile config)
		{
			CONFIG = config;
			ENABLE_MOD = config.Bind<bool>("Config", "EnableMod", true, "Enable or disable the mod");
			FIELD_OF_VIEW = config.Bind<float>("Config", "FieldOfView", 60f, "The desired field of view");
		}
	}
}
namespace CrimsonFOV.Hooks
{
	[HarmonyPatch]
	public class Bootstrap
	{
		[HarmonyPatch(typeof(GameBootstrap), "Start")]
		[HarmonyPostfix]
		public static void Postfix(GameBootstrap __instance)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			if (Application.productName == "VRisingServer")
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("This is a client-only mod.");
				}
				logger.LogWarning(val);
			}
			else
			{
				CameraManager.GetCamera().fieldOfView = Plugin.Settings.FIELD_OF_VIEW.Value;
			}
		}
	}
}