using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
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: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UmbralPhase4Gate")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+520bdb6a3b54c0d5369dc0992186c0c60bc744ae")]
[assembly: AssemblyProduct("UmbralPhase4Gate")]
[assembly: AssemblyTitle("UmbralPhase4Gate")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace UmbralPhase4Gate
{
[BepInPlugin("acanthi.UmbralPhase4Gate", "UmbralPhase4Gate", "1.0.0")]
public class UmbralPhase4Gate : BaseUnityPlugin
{
public const string PluginGUID = "acanthi.UmbralPhase4Gate";
public const string PluginAuthor = "acanthi";
public const string PluginName = "UmbralPhase4Gate";
public const string PluginVersion = "1.0.0";
public static bool skipStage4;
private void Awake()
{
SceneDirector.onPostPopulateSceneServer += SceneDirector_onPostPopulateSceneServer;
CreateLang();
skipStage4 = true;
}
private void CreateLang()
{
LanguageAPI.Add("UMBRAL_PHASE_4_GATE_CONTEXT", "Open the Umbral Gate... (Enables Phase 4.)");
}
private void SceneDirector_onPostPopulateSceneServer(SceneDirector director)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
skipStage4 = true;
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "moon2")
{
CharacterMaster.OnBodyStart += new hook_OnBodyStart(CharacterMaster_OnBodyStart);
PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
SpawnPhase4Gate();
}
else
{
CharacterMaster.OnBodyStart -= new hook_OnBodyStart(CharacterMaster_OnBodyStart);
PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
}
}
private void CharacterMaster_OnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, body);
if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && ((Object)body).name == "BrotherHurtBody(Clone)" && PhaseCounter.instance.phase == 4 && skipStage4)
{
body.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
}
}
private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
{
if (((Object)self).name == "Phase4Shrine")
{
skipStage4 = false;
}
orig.Invoke(self, activator);
}
private void SpawnPhase4Gate()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/YoungTeleporter.prefab").WaitForCompletion(), new Vector3(1062.23f, -283.1f, 1166.086f), Quaternion.Euler(0f, 80f, 0f));
GameObject val2 = Object.Instantiate<GameObject>(((Component)Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/bazaar/Bazaar_Light.prefab").WaitForCompletion().transform.Find("FireLODLevel")).gameObject, new Vector3(1062.23f, -283.1f, 1166.086f), Quaternion.Euler(0f, 80f, 0f));
val.GetComponent<PurchaseInteraction>().NetworkcontextToken = "UMBRAL_PHASE_4_GATE_CONTEXT";
((Object)val).name = "Phase4Shrine";
val2.transform.parent = val.transform;
val2.transform.localPosition = new Vector3(0f, 0f, 0f);
((Renderer)((Component)val2.transform.GetChild(0)).gameObject.GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", Color.magenta);
NetworkServer.Spawn(val);
}
}
}