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 EntityStates.ShrineRebirth;
using On.EntityStates.ShrineRebirth;
using On.RoR2;
using RoR2;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CelestialPortalAfterBosses")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CelestialPortalAfterBosses")]
[assembly: AssemblyTitle("CelestialPortalAfterBosses")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CelestialPortalAfterBosses;
[BepInPlugin("com.viliger.CelestialPortalAfterBosses", "CelestialPortalAfterBosses", "1.0.1")]
public class CelestialPortalAfterBossesPlugin : BaseUnityPlugin
{
public const string Author = "viliger";
public const string ModName = "CelestialPortalAfterBosses";
public const string Version = "1.0.1";
public const string GUID = "com.viliger.CelestialPortalAfterBosses";
public static ConfigEntry<bool> SpawnAfterFalseSon;
public static ConfigEntry<bool> SpawnAfterSHeart;
private void Awake()
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
SpawnAfterFalseSon = ((BaseUnityPlugin)this).Config.Bind<bool>("Celestial Portal", "Spawn After False Son", true, "Spawns Celestial Portal after defeating False Son post loop.");
SpawnAfterSHeart = ((BaseUnityPlugin)this).Config.Bind<bool>("Celestial Portal", "Spawn After Solus Heart", true, "Spawns Celestial Portal after defeating Solus Heart post loop.");
if (SpawnAfterFalseSon.Value)
{
RebirthOrPortalChoice.OnEnter += new hook_OnEnter(RebirthOrPortalChoice_OnEnter);
}
if (SpawnAfterSHeart.Value)
{
SolusWebMissionController.SpawnExitPortal += new hook_SpawnExitPortal(SolusWebMissionController_SpawnExitPortal);
}
}
private void SolusWebMissionController_SpawnExitPortal(orig_SpawnExitPortal orig, SolusWebMissionController self)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
OpenMSPortal(new Vector3(-40.161f, -226.2f, 20.511f), new Vector3(0f, 270f, 0f));
}
private void RebirthOrPortalChoice_OnEnter(orig_OnEnter orig, RebirthOrPortalChoice self)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
OpenMSPortal(new Vector3(108.8621f, 147.3f, -64.8503f), Vector3.zero);
}
private void OpenMSPortal(Vector3 position, Vector3 rotation)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || Run.instance.loopClearCount == 0)
{
return;
}
AsyncOperationHandle<InteractableSpawnCard> handle = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)RoR2_Base_PortalMS.iscMSPortal_asset);
if (!handle.IsValid())
{
return;
}
handle.Completed += delegate(AsyncOperationHandle<InteractableSpawnCard> result)
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//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_0034: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
InteractableSpawnCard result2 = result.Result;
if (Object.op_Implicit((Object)(object)DirectorCore.instance) && Object.op_Implicit((Object)(object)DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)result2, new DirectorPlacementRule
{
placementMode = (PlacementMode)6,
position = position,
rotation = Quaternion.Euler(rotation)
}, Run.instance.stageRng))))
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "PORTAL_MS_OPEN"
});
}
Addressables.Release<InteractableSpawnCard>(handle);
};
}
}