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 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[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]
[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 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.2.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class UltraFNAF : BaseUnityPlugin
{
private ConfigBuilder config;
public static UltraFNAF 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(NewMovement), "GetHurt")]
internal class GetHurtPatch
{
private const int SW_MINIMIZE = 6;
[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public static void Postfix()
{
if (MonoSingleton<NewMovement>.Instance.dead && ((ConfigValueElement<bool>)(object)FNAFConfig.modEnabled).Value)
{
string gamePath = FNAFConfig.gamePath;
bool value = ((ConfigValueElement<bool>)(object)FNAFConfig.deathClose).Value;
Process.Start(gamePath);
if (!value)
{
Process.GetCurrentProcess().Kill();
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);
}
}