using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using HarmonyLib;
using Il2CppSystem;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SnatcherBugFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SnatcherBugFix")]
[assembly: AssemblyTitle("SnatcherBugFix")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
namespace SnatcherBugFix
{
[BepInPlugin("Amor.SnatcherBugFix", "SnatcherBugFix", "0.0.1")]
internal class EntryPoint : BasePlugin
{
public override void Load()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("_SnatcherBugFix").PatchAll();
((BasePlugin)this).Log.LogMessage((object)"SnatcherBugFix is now loaded!");
}
}
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_Logger = new ManualLogSource("SnatcherBugFix");
Logger.Sources.Add((ILogSource)(object)_Logger);
}
private static string Format(object msg)
{
return msg.ToString();
}
public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
{
_Logger.LogDebug(handler);
}
public static void Debug(string str)
{
_Logger.LogDebug((object)str);
}
public static void Debug(object data)
{
_Logger.LogDebug((object)Format(data));
}
public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
{
_Logger.LogWarning(handler);
}
public static void Warn(string str)
{
_Logger.LogWarning((object)str);
}
public static void Warn(object data)
{
_Logger.LogWarning((object)Format(data));
}
}
[HarmonyPatch]
internal class Patch_SnatcherFX
{
[HarmonyPatch(typeof(PouncerScreenFX), "SetCovered", new Type[] { typeof(bool) })]
public static void Prefix(bool value)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
FocusStateManager.ChangeState((eFocusState)4, true);
if (value)
{
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
Dimension val = default(Dimension);
if (Builder.CurrentFloor.GetArenaDimension(14u, (uint)localPlayerAgent.PlayerSlotIndex, ref val))
{
CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoPouncerFix(localPlayerAgent, val.DimensionIndex)), (Action)null);
}
}
}
public static IEnumerator DoPouncerFix(PlayerAgent agent, eDimensionIndex arena)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
eDimensionIndex lastDim = ((Agent)agent).DimensionIndex;
Vector3 lastPos = ((Agent)agent).Position;
Vector3 lastLookDir = agent.FPSCamera.CameraRayDir;
yield return (object)new WaitForSeconds(10f);
bool flag = default(bool);
if (((Agent)agent).DimensionIndex == arena)
{
agent.TryWarpTo(lastDim, lastPos, lastLookDir, false);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Force teleporting ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(agent.Owner.NickName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from pouncer arena dimension");
}
Logger.Warn(val);
}
if (agent.FPSCamera.PouncerScreenFX.covered)
{
agent.FPSCamera.PouncerScreenFX.SetCovered(false);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(45, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Force removing ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(agent.Owner.NickName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'s PouncerScreenFX from screen");
}
Logger.Warn(val);
}
}
}
}