using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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;
using UnityEngine.Audio;
[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("RandomJumpscares")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: AssemblyInformationalVersion("1.0.6+3fb81d8eaa9f39c3a43280bf8f9fdb77e37f94e5")]
[assembly: AssemblyProduct("RandomJumpscares")]
[assembly: AssemblyTitle("Random Jumpscares")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.6.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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace RandomJumpscares
{
[BepInPlugin("RandomJumpscares", "Random Jumpscares", "1.0.6")]
public class Plugin : BaseUnityPlugin
{
private class Patcher
{
[CompilerGenerated]
private sealed class <SpawnJumpscareAfterWait>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnJumpscareAfterWait>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Object.Instantiate<GameObject>(jumpscarePrefab);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPatch(typeof(RunManager), "StartRun")]
[HarmonyPostfix]
private static void RunManagerStartRunPostfix(RunManager __instance)
{
if (!Character.localCharacter.inAirport)
{
((MonoBehaviour)__instance).StartCoroutine(SpawnJumpscareAfterWait());
}
}
[IteratorStateMachine(typeof(<SpawnJumpscareAfterWait>d__1))]
private static IEnumerator SpawnJumpscareAfterWait()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnJumpscareAfterWait>d__1(0);
}
}
internal static AssetBundle jumpscareAssetBundle;
internal static GameObject jumpscarePrefab;
private ConfigEntry<bool> configFoxyBool;
private ConfigEntry<bool> configBadBoneBool;
private ConfigEntry<float> configFoxyVolume;
private ConfigEntry<float> configBadBoneVolume;
private ConfigEntry<int> configFoxyOdds;
private ConfigEntry<int> configBadBoneOdds;
public const string Id = "RandomJumpscares";
internal static ManualLogSource Log { get; private set; }
public static string Name => "Random Jumpscares";
public static string Version => "1.0.6";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(Patcher), (string)null);
configFoxyBool = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "FoxyToggle", true, "Enables the Foxy jumpscare if true, disables if false");
configBadBoneBool = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "BadToTheBoneToggle", true, "Enables the Bad To The Bone riff if true, disables if false");
configFoxyVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "FoxyVolumeAdjust", 0f, "Adjusts the volume of the Foxy jumpscare by decibels (max +10dB because this is loud by default, min -80dB)");
configBadBoneVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "BadToTheBoneVolumeAdjust", 0f, "Adjusts the volume of the Bad To The Bone riff by decibels (max +20dB, min -80dB)");
configFoxyOdds = ((BaseUnityPlugin)this).Config.Bind<int>("Jumpscare Odds", "FoxyOdds", 10000, "If this is X, there is a 1 in X chance of the Foxy jumpscare every single second");
configBadBoneOdds = ((BaseUnityPlugin)this).Config.Bind<int>("Jumpscare Odds", "BadToTheBoneOdds", 2500, "If this is X, there is a 1 in X chance of the Bad To The Bone riff every single second");
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "randomjumpscares");
jumpscareAssetBundle = AssetBundle.LoadFromFile(text);
jumpscarePrefab = jumpscareAssetBundle.LoadAsset<GameObject>("JumpscareCanvas.prefab");
AudioMixer mixer = jumpscareAssetBundle.LoadAsset<AudioMixer>("JumpscareAudioMixer.mixer");
RandomJumpscares randomJumpscares = jumpscarePrefab.AddComponent<RandomJumpscares>();
randomJumpscares.mixer = mixer;
randomJumpscares.configFoxyBool = configFoxyBool.Value;
randomJumpscares.configBadBoneBool = configBadBoneBool.Value;
randomJumpscares.configFoxyVolume = configFoxyVolume.Value;
randomJumpscares.configBadBoneVolume = configBadBoneVolume.Value;
randomJumpscares.configFoxyOdds = configFoxyOdds.Value;
randomJumpscares.configBadBoneOdds = configBadBoneOdds.Value;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
}
}
public class RandomJumpscares : MonoBehaviour
{
[CompilerGenerated]
private sealed class <PlayFoxyJumpscare>d__15 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RandomJumpscares <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PlayFoxyJumpscare>d__15(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
int num = <>1__state;
RandomJumpscares randomJumpscares = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
((Behaviour)randomJumpscares.foxyAnimator).enabled = true;
randomJumpscares.foxyAudio.Play();
randomJumpscares.foxyAnimator.Play("FoxyJumpscare");
AnimatorStateInfo currentAnimatorStateInfo = randomJumpscares.foxyAnimator.GetCurrentAnimatorStateInfo(0);
<>2__current = (object)new WaitForSeconds(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length / randomJumpscares.foxyAnimator.speed);
<>1__state = 1;
return true;
}
case 1:
<>1__state = -1;
((Behaviour)randomJumpscares.foxyAnimator).enabled = false;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <TryJumpscare>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RandomJumpscares <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TryJumpscare>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
int num = <>1__state;
RandomJumpscares randomJumpscares = <>4__this;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
}
else
{
<>1__state = -1;
}
if (Random.Range(1, randomJumpscares.configFoxyOdds) == 1 && randomJumpscares.configFoxyBool)
{
randomJumpscares.mixer.SetFloat("FoxyVolume", Mathf.Min(randomJumpscares.configFoxyVolume, randomJumpscares.MAX_FOXY_VOLUME));
((MonoBehaviour)randomJumpscares).StartCoroutine(randomJumpscares.PlayFoxyJumpscare());
}
if (Random.Range(1, randomJumpscares.configBadBoneOdds) == 1 && randomJumpscares.configBadBoneBool)
{
randomJumpscares.mixer.SetFloat("BadToTheBoneVolume", Mathf.Min(randomJumpscares.configBadBoneVolume, randomJumpscares.MAX_BONE_VOLUME));
randomJumpscares.badBoneAudio.Play();
}
<>2__current = (object)new WaitForSeconds(5f);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private AudioSource badBoneAudio;
private GameObject foxy;
private AudioSource foxyAudio;
private Animator foxyAnimator;
public AudioMixer mixer;
public bool configFoxyBool;
public bool configBadBoneBool;
public float configFoxyVolume;
public float configBadBoneVolume;
public int configFoxyOdds;
public int configBadBoneOdds;
private float MAX_FOXY_VOLUME = 10f;
private float MAX_BONE_VOLUME = 20f;
private void Start()
{
badBoneAudio = ((Component)((Component)this).transform.Find("BadToTheBone")).GetComponent<AudioSource>();
foxy = ((Component)((Component)this).transform.Find("Foxy")).gameObject;
foxyAudio = foxy.GetComponent<AudioSource>();
foxyAnimator = foxy.GetComponent<Animator>();
((MonoBehaviour)this).StartCoroutine(TryJumpscare());
}
[IteratorStateMachine(typeof(<TryJumpscare>d__14))]
private IEnumerator TryJumpscare()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TryJumpscare>d__14(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<PlayFoxyJumpscare>d__15))]
private IEnumerator PlayFoxyJumpscare()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PlayFoxyJumpscare>d__15(0)
{
<>4__this = this
};
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}