using System;
using System.Collections;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using GlimpseChallenge.Comps;
using GlimpseChallenge.Utils;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[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("GlimpseChallenge.zeeblo.dev")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("GlimpseChallenge.zeeblo.dev")]
[assembly: AssemblyTitle("GlimpseChallenge")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.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 GlimpseChallenge
{
[BepInPlugin("GlimpseChallenge.zeeblo.dev", "GlimpseChallenge", "0.1.1")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("GlimpseChallenge.zeeblo.dev");
public const string Id = "GlimpseChallenge.zeeblo.dev";
internal static ManualLogSource Log { get; private set; }
public static string Name => "GlimpseChallenge";
public static string Version => "0.1.1";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
_harmony.PatchAll(Assembly.GetExecutingAssembly());
ZConfig.AllConfigs(((BaseUnityPlugin)this).Config);
}
public static void SendLog(string text)
{
Log.LogInfo((object)text);
}
}
}
namespace GlimpseChallenge.Utils
{
public class ZConfig
{
public static ConfigEntry<float> MAX_BlindTime;
public static ConfigEntry<float> MAX_VisionTime;
public static ConfigEntry<float> Min_BlindTime;
public static ConfigEntry<float> Min_VisionTime;
public static void AllConfigs(ConfigFile cfg)
{
MAX_BlindTime = cfg.Bind<float>("General", "MAX Blind Time", 120f, "The MAXIMUM seconds the user will remain blinded");
MAX_VisionTime = cfg.Bind<float>("General", "MAX Vision Time", 35f, "The MAXIMUM seconds the user can see");
Min_BlindTime = cfg.Bind<float>("General", "Min Blind Time", 25f, "The minimum seconds the user will remain blinded");
Min_VisionTime = cfg.Bind<float>("General", "Min Vision Time", 10f, "The minimum seconds the user can see");
}
}
}
namespace GlimpseChallenge.Scripts
{
[HarmonyPatch]
internal class Start
{
[HarmonyPatch(typeof(GUIManager), "SetHeroTitle")]
[HarmonyPostfix]
private static void GiveComponent()
{
Glimpse glimpse = ((Component)Character.localCharacter).gameObject.GetComponent<Glimpse>();
if ((Object)(object)glimpse == (Object)null)
{
glimpse = ((Component)Character.localCharacter).gameObject.AddComponent<Glimpse>();
}
else
{
((Behaviour)glimpse).enabled = true;
}
glimpse.paused = false;
}
[HarmonyPatch(typeof(Campfire), "HoverEnter")]
[HarmonyPostfix]
private static void CampfirePatch()
{
Glimpse component = ((Component)Character.localCharacter).GetComponent<Glimpse>();
if ((Object)(object)component != (Object)null)
{
component.paused = true;
component.blackScreen.SetActive(false);
}
}
[HarmonyPatch(typeof(Character), "RPCA_Die")]
[HarmonyPostfix]
private static void PlayerDiedPatch()
{
Character localCharacter = Character.localCharacter;
if (localCharacter.data.dead)
{
ResetVars();
}
}
[HarmonyPatch(typeof(Character), "EndGame")]
[HarmonyPrefix]
private static bool EndGamePatch()
{
ResetVars();
return true;
}
private static void ResetVars()
{
Character localCharacter = Character.localCharacter;
if (!((Object)(object)localCharacter == (Object)null))
{
Glimpse component = ((Component)Character.localCharacter).GetComponent<Glimpse>();
if ((Object)(object)component != (Object)null)
{
component.paused = true;
component.blackScreen.SetActive(false);
((Behaviour)component).enabled = false;
}
}
}
}
}
namespace GlimpseChallenge.Comps
{
public class Glimpse : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DisableBlind>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Glimpse <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisableBlind>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//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;
Glimpse glimpse = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
if (glimpse.CheckConditions())
{
return false;
}
glimpse.blackScreen.SetActive(false);
float num2 = Random.Range(ZConfig.Min_VisionTime.Value, ZConfig.MAX_VisionTime.Value);
glimpse.UpdateText($"Disable Blind: {num2}");
<>2__current = (object)new WaitForSeconds(num2);
<>1__state = 1;
return true;
}
case 1:
<>1__state = -1;
((MonoBehaviour)GUIManager.instance).StartCoroutine(glimpse.EnableBlind());
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 <EnableBlind>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Glimpse <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <EnableBlind>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//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;
Glimpse glimpse = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
if (glimpse.CheckConditions())
{
return false;
}
glimpse.blackScreen.SetActive(true);
float num2 = Random.Range(ZConfig.Min_BlindTime.Value, ZConfig.MAX_BlindTime.Value);
glimpse.UpdateText($"Enable Blind: {num2}");
<>2__current = (object)new WaitForSeconds(num2);
<>1__state = 1;
return true;
}
case 1:
<>1__state = -1;
((MonoBehaviour)GUIManager.instance).StartCoroutine(glimpse.DisableBlind());
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();
}
}
public GameObject blackScreen;
private static bool blinded;
public bool paused;
public GameObject _textt;
private void Start()
{
paused = false;
blinded = false;
BlindUser();
((MonoBehaviour)GUIManager.instance).StartCoroutine(EnableBlind());
}
private void OnDestroy()
{
if ((Object)(object)blackScreen != (Object)null)
{
Object.Destroy((Object)(object)blackScreen);
blinded = false;
}
}
private void _Test_ShowTimer()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("GAME/GUIManager/Canvas_HUD");
_textt = new GameObject("text");
_textt.transform.SetParent(val.transform, false);
TextMeshProUGUI val2 = _textt.AddComponent<TextMeshProUGUI>();
((Graphic)val2).color = Color.white;
}
private void UpdateText(string txt)
{
_ = (Object)(object)_textt == (Object)null;
}
private void BlindUser()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (!blinded)
{
GameObject val = GameObject.Find("GAME/GUIManager/Canvas_HUD");
blackScreen = new GameObject("blackScreen");
blackScreen.transform.SetParent(val.transform, false);
((Graphic)blackScreen.AddComponent<Image>()).color = Color.black;
blackScreen.transform.SetAsFirstSibling();
RectTransform component = blackScreen.GetComponent<RectTransform>();
component.sizeDelta = new Vector2(7200f, 7200f);
blackScreen.SetActive(false);
blinded = true;
}
}
private bool CheckConditions()
{
if ((Object)(object)blackScreen == (Object)null || !blinded || paused)
{
return true;
}
return false;
}
[IteratorStateMachine(typeof(<EnableBlind>d__10))]
public IEnumerator EnableBlind()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <EnableBlind>d__10(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<DisableBlind>d__11))]
public IEnumerator DisableBlind()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisableBlind>d__11(0)
{
<>4__this = this
};
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}