using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn;
using Jotunn.Managers;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FramePerSecondPlus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FramePerSecondPlus")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("29e9acb2-0bb6-4c4e-b615-90240624b221")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FramePerSecondPlus;
[BepInPlugin("vsp.FramePerSecondPlus", "FramePerSecondPlus", "1.1.4")]
public class FramePerSecondPlus : BaseUnityPlugin
{
[HarmonyPatch(typeof(ClutterSystem), "Awake")]
private static class ClutterSystem_Awake_Patch
{
private static void Prefix(ClutterSystem __instance)
{
__instance.m_grassPatchSize = 20f;
}
}
[HarmonyPatch(typeof(LightFlicker), "CustomUpdate")]
private class LightFlicker_Update_Patch : MonoBehaviour
{
private static bool Prefix(LightFlicker __instance)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Invalid comparison between Unknown and I4
if (!Object.op_Implicit((Object)(object)__instance.m_light))
{
return false;
}
if (Settings.ReduceFlashingLights)
{
if ((int)__instance.m_flashingLightsSetting == 2)
{
__instance.m_light.intensity = 0f;
return false;
}
if ((int)__instance.m_flashingLightsSetting == 3)
{
__instance.m_light.intensity = 1f;
return false;
}
}
__instance.m_light.intensity = __instance.m_baseIntensity;
return false;
}
}
[HarmonyPatch(typeof(SceneLoader), "Start")]
private class SceneLoaderOff
{
private static void Prefix(SceneLoader __instance)
{
__instance._showLogos = !skipIntro.Value;
}
}
[HarmonyPatch(typeof(Smoke), "CustomUpdate")]
private class SlowUpdaterFix
{
private static bool Prefix(Smoke __instance, float deltaTime, float time)
{
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
if (__instance.m_fadeTimer >= 0f)
{
__instance.m_fadeTimer += deltaTime;
if (__instance.m_fadeTimer >= __instance.m_fadetime)
{
Object.Destroy((Object)(object)((Component)__instance).gameObject);
}
return false;
}
__instance.m_time += deltaTime;
if (__instance.m_time > __instance.m_ttl)
{
__instance.StartFadeOut();
return false;
}
float num = 1f - __instance.m_time / __instance.m_ttl;
float mass = num * num;
__instance.m_body.mass = mass;
Vector3 velocity = __instance.m_body.velocity;
Vector3 vel = __instance.m_vel;
vel.y *= num;
Vector3 val = (vel - velocity) * (__instance.m_force * deltaTime);
__instance.m_body.AddForce(val, (ForceMode)2);
return false;
}
}
private static ManualLogSource Log;
private string[] PrefabLightNames = new string[6] { "piece_groundtorch", "piece_groundtorch_blue", "piece_groundtorch_green", "piece_groundtorch_mist", "piece_groundtorch_wood", "piece_walltorch" };
private static ConfigEntry<bool> skipIntro;
private ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description)
{
return ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, description);
}
private void AddConfiguration()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
skipIntro = config("General", "SkipIntro", value: true, new ConfigDescription("Skip the game logo to speed up the loading of the game", (AcceptableValueBase)null, Array.Empty<object>()));
}
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
AddConfiguration();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
QualitySettings.realtimeReflectionProbes = false;
QualitySettings.softParticles = false;
QualitySettings.particleRaycastBudget = 1024;
QualitySettings.softVegetation = false;
PrefabManager.OnPrefabsRegistered += CustomAwake;
}
private void CustomAwake()
{
for (int i = 0; i < PrefabLightNames.Length; i++)
{
TorchParticles(PrefabManager.Instance.GetPrefab(PrefabLightNames[i]));
}
}
private void TorchParticles(GameObject gameObject)
{
string text = "fx_Torch_Basic";
if (((Object)gameObject).name == "piece_groundtorch_blue")
{
text = "fx_Torch_Blue";
}
else if (((Object)gameObject).name == "piece_groundtorch_green")
{
text = "fx_Torch_Green";
}
else if (((Object)gameObject).name == "piece_groundtorch_mist")
{
text = "sparcs_front";
}
ParticleSystem component = ((Component)ExposedGameObjectExtension.FindDeepChild(gameObject, text, (IterativeSearchType)1)).GetComponent<ParticleSystem>();
component.startLifetime = 0.2f;
component.gravityModifier = -0.3f;
}
}