using System;
using System.Collections.Generic;
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 UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FovUpdate")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FovUpdate")]
[assembly: AssemblyTitle("FovUpdate")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.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]
[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 FovUpdate
{
internal static class FovConfig
{
internal static ConfigEntry<bool> DeveloperLogging;
internal static ConfigEntry<float> UserDefinedFov;
internal static void Init()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
DeveloperLogging = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Debug", "Developer Logging", false, new ConfigDescription("Enable this to see developer logging output", (AcceptableValueBase)null, Array.Empty<object>()));
UserDefinedFov = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("Settings", "Fov", 70f, new ConfigDescription("Set this to desired Fov value", (AcceptableValueBase)(object)new AcceptableValueRange<float>(45f, 140f), Array.Empty<object>()));
}
}
[HarmonyPatch(typeof(CameraZoom), "Awake")]
public class CameraPatchThings
{
public static void Postfix(CameraZoom __instance)
{
if (ShouldChangeFov())
{
CollectionExtensions.Do<Camera>((IEnumerable<Camera>)__instance.cams, (Action<Camera>)delegate(Camera x)
{
Plugin.Spam($"Original Fov of {((Object)x).name} is {x.fieldOfView}");
x.fieldOfView = FovConfig.UserDefinedFov.Value;
Plugin.Spam($"Field of view for {((Object)x).name} set to {FovConfig.UserDefinedFov.Value}");
});
__instance.zoomPrev = FovConfig.UserDefinedFov.Value;
__instance.zoomNew = FovConfig.UserDefinedFov.Value;
__instance.zoomCurrent = FovConfig.UserDefinedFov.Value;
__instance.playerZoomDefault = FovConfig.UserDefinedFov.Value;
}
}
private static bool ShouldChangeFov()
{
if (SemiFunc.IsMainMenu())
{
return false;
}
if (SemiFunc.RunIsLobbyMenu())
{
return false;
}
if (SemiFunc.RunIsLobby())
{
return false;
}
return true;
}
}
[BepInPlugin("com.github.darmuh.FovUpdate", "FovUpdate", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.github.darmuh.FovUpdate";
public const string PLUGIN_NAME = "FovUpdate";
public const string PLUGIN_VERSION = "0.1.0";
}
public static Plugin instance;
internal static ManualLogSource Log;
private void Awake()
{
instance = this;
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"FovUpdate is loading with version 0.1.0!");
FovConfig.Init();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
Log.LogInfo((object)"FovUpdate load complete!");
}
internal static void Spam(string message)
{
if (FovConfig.DeveloperLogging.Value)
{
Log.LogDebug((object)message);
}
}
internal static void ERROR(string message)
{
Log.LogError((object)message);
}
internal static void WARNING(string message)
{
Log.LogWarning((object)message);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}