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.Logging;
using Configgy;
using Microsoft.CodeAnalysis;
using UnityEngine;
[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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("FurfFPSmod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Furf FPS Mod")]
[assembly: AssemblyTitle("FurfFPSmod")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace FurfFPSmod
{
[BepInPlugin("FurfFPSmod", "Furf FPS Mod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
[Configgable("", "Mod enabled", 0, null)]
public static bool enab = true;
[Configgable("", "Low Health FPS", 0, null)]
public static int MinFPS = 5;
[Configgable("", "Max Health FPS", 0, null)]
public static int MaxFPS = 120;
[Configgable("", "Uncap when full", 0, null)]
public static bool overflow = true;
private void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
ConfigBuilder val = new ConfigBuilder("FurfFPSmod", "Furf FPS Mod");
val.BuildAll();
Logger.LogInfo((object)"Plugin FurfFPSmod is loaded!");
}
private void Update()
{
if (Application.isPlaying && enab && MonoSingleton<NewMovement>.Instance != null)
{
NewMovement instance = MonoSingleton<NewMovement>.Instance;
int hp = instance.hp;
int num = ((MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0) == 0) ? 200 : 100);
bool flag = hp < 1;
bool flag2 = hp >= num;
bool flag3 = hp > num;
if (flag || (flag2 && (MaxFPS == 0 || overflow)))
{
Application.targetFrameRate = MaxFPS;
}
else
{
double num2 = (double)hp / (double)num;
if (MinFPS > MaxFPS)
{
num2 = Math.Max(1.0 - num2, 0.0);
}
int num3 = Math.Abs(MaxFPS - MinFPS);
int targetFrameRate = Math.Min(MinFPS, MaxFPS) + (int)Math.Ceiling(num2 * (double)num3);
Application.targetFrameRate = targetFrameRate;
}
}
if (!enab)
{
Application.targetFrameRate = 0;
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "FurfFPSmod";
public const string PLUGIN_NAME = "Furf FPS Mod";
public const string PLUGIN_VERSION = "1.0.0";
}
}