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 Configgy;
using HarmonyLib;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("UKMOD")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UKMOD")]
[assembly: AssemblyTitle("UKMOD")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace UKMOD
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "UKMOD";
public const string PLUGIN_NAME = "UKMOD";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace FNAF
{
[BepInPlugin("com.derp.fnaf", "UltraFNAF", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private ConfigBuilder config;
public static Plugin Instance;
private void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
config = new ConfigBuilder("com.derp.fnaf", "UltraFNAF");
config.BuildAll();
Instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded plugin.");
Harmony val = new Harmony("com.derp.fnaf");
val.PatchAll();
}
}
[HarmonyPatch(typeof(LaughingSkull), "Start")]
internal class PatchDeath
{
private const int SW_MINIMIZE = 6;
[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private static void Postfix()
{
if (((ConfigValueElement<bool>)(object)FNAFConfig.modEnabled).Value)
{
string gamePath = FNAFConfig.gamePath;
bool value = ((ConfigValueElement<bool>)(object)FNAFConfig.deathClose).Value;
Process.Start(gamePath);
if (!value)
{
Application.Quit();
return;
}
IntPtr mainWindowHandle = Process.GetCurrentProcess().MainWindowHandle;
ShowWindow(mainWindowHandle, 6);
}
}
}
public class FNAFConfig : MonoBehaviour
{
[Configgable("", "Enable Mod", 0, null)]
public static ConfigToggle modEnabled = new ConfigToggle(true);
[Configgable("", "Game Path", 0, null)]
public static string gamePath = "C:/Program Files (x86)/Steam/steamapps/common/Five Nights at Freddy's 2/FiveNightsatFreddys2.exe";
[Configgable("", "Minimize Game on Death", 0, null)]
public static ConfigToggle deathClose = new ConfigToggle(false);
}
}