using System;
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.Logging;
using Gravity;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PortalUtil.Patches;
using ULTRAKILL.Portal;
using ULTRAKILL.Portal.Geometry;
using UnityEngine;
using UnityEngine.SceneManagement;
[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("PortalUtil")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PortalUtil")]
[assembly: AssemblyTitle("PortalUtil")]
[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.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 PortalUtil
{
[BepInPlugin("PortalUtil", "PortalUtil", "1.0.0")]
public class PortalUtil : BaseUnityPlugin
{
public static GameObject PortalTransform = new GameObject();
public static Portal portal = new Portal();
public static GameObject entry = new GameObject();
public static GameObject exit = new GameObject();
public static PlaneShape planeshape = default(PlaneShape);
public static List<Portal> portalList = new List<Portal>();
public static GravityVolume entergrav = new GravityVolume();
public static GravityVolume exitgrav = new GravityVolume();
public static PortalUtil Instance { get; private set; } = null;
internal static ManualLogSource Logger { get; private set; } = null;
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Patch();
Logger.LogInfo((object)"PortalUtil v1.0.0 has loaded!");
SceneManager.sceneLoaded += delegate
{
string currentScene = SceneHelper.CurrentScene;
if (currentScene != "Main Menu" && currentScene != "Intro" && currentScene != "Bootstrap")
{
portalList.Clear();
portalList.Capacity = 0;
PortalMaker.CreatePortal();
}
};
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("PortalUtil");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "PortalUtil";
public const string PLUGIN_NAME = "PortalUtil";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace PortalUtil.Patches
{
public class PortalMaker
{
public static void CreatePortal()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
PortalUtil.PortalTransform = new GameObject();
PortalUtil.entry = new GameObject();
PortalUtil.exit = new GameObject();
PortalUtil.entry.transform.parent = PortalUtil.PortalTransform.transform;
PortalUtil.exit.transform.parent = PortalUtil.PortalTransform.transform;
Portal val = PortalUtil.PortalTransform.gameObject.AddComponent<Portal>();
val.entry = PortalUtil.entry.transform;
val.exit = PortalUtil.exit.transform;
PortalUtil.portal.minimumEntrySideSpeed = 20f;
PortalUtil.portal.minimumExitSideSpeed = 20f;
PortalUtil.portalList.Add(val);
}
}
[HarmonyPatch(typeof(Portal))]
public class PortalAutofill
{
[HarmonyPatch("UpdateTransformData")]
[HarmonyPrefix]
private static void Autofill(Portal __instance, ref PlaneShape ___planeShape)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if ((PortalUtil.portalList.Capacity > 0) & PortalUtil.portalList.Contains(__instance))
{
___planeShape.height = 10f;
___planeShape.width = 10f;
__instance.shape = (IPortalShape)(object)___planeShape;
}
}
}
[HarmonyPatch(typeof(Beamgun))]
public class BeamGun
{
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static bool BeamGunOverride(Beamgun __instance)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame)
{
LayerMask val = LayerMaskDefaults.Get((LMD)1);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val2, float.PositiveInfinity, LayerMask.op_Implicit(val), (QueryTriggerInteraction)1))
{
PortalUtil.entry.transform.position = ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 3f;
((Component)PortalUtil.entry.transform).transform.forward = -((RaycastHit)(ref val2)).normal;
}
}
if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire2.WasPerformedThisFrame)
{
LayerMask val3 = LayerMaskDefaults.Get((LMD)1);
RaycastHit val4 = default(RaycastHit);
if (!Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val4, 5f, LayerMask.op_Implicit(val3), (QueryTriggerInteraction)1))
{
PortalUtil.exit.transform.position = ((Component)__instance).transform.position + ((Component)__instance).transform.forward * 5f;
((Component)PortalUtil.exit.transform).transform.forward = ((Component)__instance).transform.forward;
}
}
return false;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}