Decompiled source of Masquerade Divinity v0.0.55

plugins/Masquerade Divinity/ProjectProphet.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GameConsole;
using HarmonyLib;
using ProjectProphet.Behaviours;
using ProjectProphet.Behaviours.Props;
using ProjectProphet.Patching;
using ProjectProphet.StageAddons;
using TMPro;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ProjectProphet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProjectProphet")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dfa813c9-c407-48f5-b20f-615a3c8fdbe3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ProjectProphet
{
	[Serializable]
	public class ProphetResources : MonoBehaviour
	{
		public Sprite lightningBoltSmall;

		public Sprite lightningBolt;

		public Sprite lightningBoltBig;

		public Sprite fistIcon1;

		public Sprite fistIcon2;

		public Sprite jumpIcon;

		public Sprite logo;

		public Sprite[] ranks;

		public AudioClip shopMusic;

		public AudioClip sfxJump;

		public AudioClip sfxRetroJump;

		public AudioClip sfxLand;

		public AudioClip sfxDodge;

		public AudioClip sfxSharpLand;

		public GameObject sfxStomp;

		public GameObject sfxSlideLoop;

		public GameObject sfxSlideEnd;

		public AudioClip sfxWalljumpFatigue;

		public AudioClip mainMenuMusic;

		public AudioClip testamentMusic;

		public AudioClip[] sfxFootsteps;

		public GameObject dodgeParticle;

		public GameObject fallParticle;

		public GameObject scrapePrefab;

		public GameObject newWeaponCharges;

		public AssetReference[] justice;

		public AssetReference[] splendor;

		public AssetReference[] swordRed;

		public AssetReference[] crossbow;

		public AssetReference[] crossbowGreen;

		public AssetReference[] crossbowRed;

		public AssetReference blueFist;
	}
	[Serializable]
	public class Railsword : MonoBehaviour
	{
		public static Railsword inst;

		public LayerMask ignoreEnemyTrigger;

		public int variation;

		public float chargeAnti;

		public float chargeAntiRate;

		public float chargeAntiLimit;

		public Transform shootPoint;

		public GameObject swingSound;

		public GameObject swingHitSound;

		public GameObject splendorChargeSound;

		public GameObject splendorOuttaJuiceSound;

		public GameObject splendorGotJuiceSound;

		public GameObject splendorBlast;

		public Image splendorChargeBackground;

		public Image splendorChargeBar;

		public SpriteRenderer splendorChargeSprite;

		private InputManager inman;

		public WeaponIdentifier wid;

		private float gotWidDelay;

		private AudioSource aud;

		private CameraController cc;

		private StyleHUD shud;

		private Camera cam;

		private GunControl gc;

		private Animator anim;

		private SkinnedMeshRenderer smr;

		private WeaponCharges wc;

		private WeaponPos wpos;

		private WeaponIcon wicon;

		private bool zooming;

		private bool gotStuff;

		private CameraFrustumTargeter targeter;

		private LayerMask enemyMask;

		private LayerMask environmentMask;

		private TrailRenderer trail;

		private float chargeMag;

		public float maxSwingCooldown = 0.3f;

		public float swingDamage;

		public GameObject swingProjectile;

		public int projectileCount;

		private const string FILL = "_Fill";

		private bool charging;

		private bool splendorCharging;

		private float splendorChargeDelay = 0.71f;

		private int splendorChargeMag;

		private float chargeTime;

		private bool nowcblock;

		private Vector3 chargeFwd;

		private float chargeDashCost = 1.5f;

		private const string pierceStyle = "justice.pierce";

		private EnemyIdentifier lastChargeEid;

		private RaycastHit hit;

		private int swingCt = 0;

		private float spread = 20f;

		public float swingLength = 5f;

		public const string hitter = "slice";

		private string quickdraw = "ultrakill.quickdraw";

		private List<EnemyIdentifier> targetsThisSwing = new List<EnemyIdentifier>();

		private void Awake()
		{
			if (!gotStuff)
			{
				wid = ((Component)this).GetComponent<WeaponIdentifier>();
				wicon = ((Component)this).GetComponent<WeaponIcon>();
				trail = ((Component)this).GetComponentInChildren<TrailRenderer>();
			}
		}

		private void Start()
		{
			if (!gotStuff)
			{
				gotStuff = true;
				GetStuff();
			}
		}

		private void OnEnable()
		{
			NewWeaponCharges.swordMax = maxSwingCooldown;
			inst = this;
			charging = false;
			chargeTime = 0f;
			if (!gotStuff)
			{
				gotStuff = true;
				GetStuff();
			}
			nowcblock = false;
		}

		private void OnDisable()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)wc == (Object)null)
			{
				wc = ((Component)this).GetComponentInParent<WeaponCharges>();
			}
			if ((Object)(object)wpos != (Object)null)
			{
				((Component)this).transform.localPosition = wpos.currentDefault;
			}
			splendorCharging = false;
			charging = false;
			chargeTime = 0f;
			if (Object.op_Implicit((Object)(object)splendorChargeSprite))
			{
				((Renderer)splendorChargeSprite).enabled = false;
			}
			splendorChargeMag = 0;
			if (zooming)
			{
				zooming = false;
				cc.StopZoom();
			}
		}

		private void Update()
		{
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			PlayerInput inputSource = MonoSingleton<InputManager>.Instance.InputSource;
			bool flag = !(NewWeaponCharges.sword0Charge < NewWeaponCharges.swordMax);
			if (NoWeaponCooldown.NoCooldown)
			{
				flag = !nowcblock;
			}
			if (inputSource.Fire1.IsPressed && gc.activated && flag && !splendorCharging && (variation != 1 || !charging))
			{
				targetsThisSwing.Clear();
				if (charging)
				{
					EndCharge();
				}
				if (!Object.op_Implicit((Object)(object)wid) || wid.delay == 0f)
				{
					Swing();
				}
				else
				{
					((MonoBehaviour)this).Invoke("Swing", wid.delay);
				}
				if (NoWeaponCooldown.NoCooldown)
				{
					nowcblock = true;
					((MonoBehaviour)this).Invoke("RefreshNoWc", maxSwingCooldown);
				}
			}
			switch (variation)
			{
			case 0:
				if (charging)
				{
					if (inputSource.Jump.IsPressed || inputSource.Slide.IsPressed || inputSource.Dodge.IsPressed)
					{
						EndCharge();
						chargeTime = 0f;
					}
					else
					{
						ChargeChecks();
					}
				}
				if (inputSource.Fire2.WasPerformedThisFrame && gc.activated && !charging && !inputSource.Jump.IsPressed && !inputSource.Slide.IsPressed && !inputSource.Dodge.IsPressed)
				{
					targetsThisSwing.Clear();
					chargeTime -= Time.deltaTime;
					if (chargeTime <= 0f)
					{
						StartCharge();
					}
				}
				break;
			case 1:
			{
				splendorChargeBar.fillAmount = NewWeaponCharges.sword1SCharge / NewWeaponCharges.sword1SMax;
				Color val = MonoSingleton<ColorBlindSettings>.Instance.variationColors[variation];
				if (NewWeaponCharges.sword1SCharge == NewWeaponCharges.sword1SMax)
				{
					((Graphic)splendorChargeBar).color = val;
				}
				else
				{
					((Graphic)splendorChargeBar).color = Color.Lerp(val, Color.black, 0.25f);
				}
				if (splendorCharging)
				{
					bool flag2 = (splendorChargeMag == 0 && chargeTime > 0.3f) || splendorChargeMag != 0;
					if (inputSource.Fire1.WasPerformedThisFrame && flag2)
					{
						charging = true;
						EndJudgementCut();
					}
					AnimatorStateInfo currentAnimatorStateInfo = anim.GetCurrentAnimatorStateInfo(0);
					if ((inputSource.Fire2.WasPerformedThisFrame || ((((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("JusticeChargeLoop") || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("JusticeCharge")) && ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 0.3f && inputSource.Fire2.IsPressed)) && splendorChargeMag < 2 && flag2)
					{
						if (splendorChargeMag == 1 && NewWeaponCharges.sword1SCharge < NewWeaponCharges.sword1SMax && !NoWeaponCooldown.NoCooldown)
						{
							if (inputSource.Fire2.WasPerformedThisFrame)
							{
								Object.Instantiate<GameObject>(splendorOuttaJuiceSound);
							}
							break;
						}
						chargeTime = 0f;
						splendorChargeMag++;
						NewWeaponCharges.sword0Charge = 0f;
						PumpJudgement();
						anim.Play("JusticeChargeLoop", -1, 0f);
					}
					chargeTime = Mathf.MoveTowards(chargeTime, splendorChargeDelay, Time.deltaTime);
					if (chargeTime == splendorChargeDelay && !charging)
					{
						charging = true;
						EndJudgementCut();
					}
				}
				if (inputSource.Fire2.WasPerformedThisFrame && gc.activated && !charging && NewWeaponCharges.sword1Charge == NewWeaponCharges.swordMax && !splendorCharging)
				{
					StartJudgement();
				}
				break;
			}
			}
		}

		private void RefreshNoWc()
		{
			nowcblock = false;
		}

		private void AddFardDamage(float damage)
		{
			if (MonoSingleton<NewMovement>.Instance.antiHp + damage <= chargeAntiLimit)
			{
				MonoSingleton<NewMovement>.Instance.ForceAddAntiHP(damage, true, true, true);
			}
			else if (MonoSingleton<NewMovement>.Instance.antiHp <= chargeAntiLimit)
			{
				MonoSingleton<NewMovement>.Instance.ForceAntiHP(chargeAntiLimit, true, true, true);
			}
		}

		private void StartCharge()
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			charging = true;
			anim.Play("HeavySwing", -1, 0f);
			Object.Instantiate<GameObject>(swingSound);
			if (!NoWeaponCooldown.NoCooldown)
			{
				if (NewWeaponCharges.sword0Exhaust <= 0f)
				{
					NewWeaponCharges.sword0Exhaust += 1f;
				}
				else
				{
					NewWeaponCharges.sword0Exhaust *= 2f;
				}
			}
			AddFardDamage(chargeAnti);
			lastChargeEid = null;
			chargeTime = 0.8f;
			chargeFwd = ((Component)cc).transform.forward;
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			Vector3 velocity = instance.rb.velocity;
			chargeMag = ((Vector3)(ref velocity)).magnitude * Time.fixedDeltaTime;
			if (chargeMag < 200f)
			{
				chargeMag = 200f;
			}
			Vector3 velocity2 = chargeFwd * chargeMag;
			velocity2.y -= 12f;
			instance.rb.velocity = velocity2;
		}

		private void ChargeChecks()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)wid) || wid.delay == 0f)
			{
				chargeTime -= Time.deltaTime;
				if (chargeTime <= 0f)
				{
					EndCharge();
				}
				NewMovement instance = MonoSingleton<NewMovement>.Instance;
				Vector3 velocity = chargeFwd * (chargeMag / 2f) * Mathf.Clamp(chargeTime, 0.2f, 2f);
				velocity.y -= 12f * Mathf.Clamp(NewWeaponCharges.sword0Exhaust, 0f, 999f);
				instance.rb.velocity = velocity;
				AddFardDamage(chargeAntiRate * Time.deltaTime);
			}
			SwingCheck();
			if (Physics.Raycast(cc.GetDefaultPos(), ((Component)cc).transform.forward, ref hit, 4f, LayerMask.op_Implicit(environmentMask), (QueryTriggerInteraction)2) || Physics.SphereCast(cc.GetDefaultPos(), 1f, ((Component)cc).transform.forward, ref hit, 4f, LayerMask.op_Implicit(environmentMask), (QueryTriggerInteraction)2))
			{
				Glass component = ((Component)((RaycastHit)(ref hit)).transform).gameObject.GetComponent<Glass>();
				if ((Object)(object)component != (Object)null)
				{
					component.Shatter();
				}
			}
		}

		private void SwingCheck()
		{
			//IL_0007: 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)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if (Physics.SphereCast(cc.GetDefaultPos(), 2f, ((Component)cc).transform.forward, ref hit, 4f, LayerMask.op_Implicit(ignoreEnemyTrigger), (QueryTriggerInteraction)2))
			{
				Utils.Log(((Object)((Component)((RaycastHit)(ref hit)).collider).gameObject).name ?? "");
				bool flag = false;
				RaycastHit val = default(RaycastHit);
				if (Physics.SphereCast(cc.GetDefaultPos(), 2f, ((Component)cc).transform.forward, ref val, 4f, LayerMask.op_Implicit(environmentMask)) && (double)Vector3.Distance(((Component)this).transform.position, ((RaycastHit)(ref hit)).point) > (double)Vector3.Distance(((Component)this).transform.position, ((RaycastHit)(ref val)).point))
				{
					flag = true;
				}
				if (!flag)
				{
					SwingSuccess(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).transform, 1, 1f, checkLastEid: true);
				}
			}
		}

		public void EndCharge()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			aud.Stop();
			chargeTime = 0f;
			charging = false;
			anim.CrossFade("Idle", 0.5f);
			MonoSingleton<NewMovement>.Instance.rb.velocity = Vector3.ClampMagnitude(MonoSingleton<NewMovement>.Instance.rb.velocity, 70f);
			if (NoWeaponCooldown.NoCooldown)
			{
				NewWeaponCharges.sword0Exhaust = -1f;
			}
		}

		private void StartJudgement()
		{
			splendorCharging = true;
			anim.Play("JusticeCharge", -1, 0f);
			PumpJudgement();
		}

		private void PumpJudgement()
		{
			//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_0085: Unknown result type (might be due to invalid IL or missing references)
			aud.pitch = 1f + (float)splendorChargeMag * 0.2f;
			aud.Play();
			((Renderer)splendorChargeSprite).enabled = true;
			Color white = Color.white;
			white.a = 0.3f;
			if (splendorChargeMag == 1)
			{
				white.a = 0.5f;
			}
			else if (splendorChargeMag == 2)
			{
				white.a = 1f;
			}
			splendorChargeSprite.color = white;
		}

		private void LightSwingAnim()
		{
			if (MonoSingleton<PrefsManager>.Instance.GetInt("weaponHoldPosition", 0) == 1)
			{
				anim.Play("MiddleSwing", -1, 0f);
			}
			else
			{
				anim.Play("SwingLight1", -1, 0f);
			}
		}

		private void EndJudgementCut()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (splendorChargeMag != 2)
			{
				((MonoBehaviour)this).StartCoroutine(CoJudgementCut());
				return;
			}
			NewWeaponCharges.sword1SCharge = 0f;
			Object.Instantiate<GameObject>(swingSound);
			LightSwingAnim();
			splendorCharging = false;
			NewWeaponCharges.sword0Charge = 0f;
			splendorChargeMag = 0;
			chargeTime = 0f;
			charging = false;
			((Renderer)splendorChargeSprite).enabled = false;
			cc.CameraShake(1f);
			GameObject val = Object.Instantiate<GameObject>(splendorBlast, ((Component)cc).transform.position, Quaternion.identity);
			val.transform.up = ((Component)cc).transform.forward;
			Explosion componentInChildren = val.GetComponentInChildren<Explosion>(true);
			componentInChildren.sourceWeapon = gc.currentWeapon;
			componentInChildren.hitterWeapon = "gabriel.splendorblast";
		}

		private IEnumerator CoJudgementCut()
		{
			splendorCharging = false;
			Vector3 spawnPos = cc.GetDefaultPos();
			spawnPos.y -= 0.6f;
			int projectileCt = 5;
			if (splendorChargeMag == 1)
			{
				projectileCt = 7;
			}
			else if (splendorChargeMag == 2)
			{
				projectileCt = 9;
			}
			float intensity = (float)(splendorChargeMag + 1) * 15f;
			for (int i = 0; i < projectileCt; i++)
			{
				if (!gc.activated)
				{
					break;
				}
				LightSwingAnim();
				spawnPos = cc.GetDefaultPos();
				spawnPos.y -= 0.6f;
				float posRng = (float)splendorChargeMag * 0.1f;
				Vector3 up = ((Component)cc).transform.up;
				Vector3 right = ((Component)cc).transform.right;
				spawnPos += right * Random.Range(0f - posRng, posRng) * 2f;
				spawnPos += up * Random.Range(0f - posRng, posRng);
				Vector3 fwd4 = ((Component)cc).transform.forward;
				fwd4 = Quaternion.AngleAxis(Random.value * 360f, ((Component)cc).transform.forward) * fwd4;
				fwd4 = Quaternion.AngleAxis(intensity * Random.Range(-1f, 1f), up) * fwd4;
				fwd4 = Quaternion.AngleAxis(intensity * Random.Range(-1f, 1f), right) * fwd4;
				SpawnProjectile(spawnPos, fwd4, 1.2f, ((float)splendorChargeMag + 1f) * 30f);
				Object.Instantiate<GameObject>(swingSound);
				cc.CameraShake(0.4f);
				yield return (object)new WaitForSeconds(0.03f);
			}
			NewWeaponCharges.sword0Charge = 0f;
			splendorChargeMag = 0;
			chargeTime = 0f;
			charging = false;
			((Renderer)splendorChargeSprite).enabled = false;
		}

		private void Swing()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			NewWeaponCharges.sword0Charge = 0f;
			SwingCheck();
			LightSwingAnim();
			cc.CameraShake(0.3f);
			Vector3 defaultPos = cc.GetDefaultPos();
			defaultPos.y -= 0.4f;
			SpawnProjectile(defaultPos, ((Component)cc).transform.forward);
			Vector3 up = ((Component)cc).transform.up;
			Vector3 forward = ((Component)cc).transform.forward;
			forward = Quaternion.AngleAxis(0f - spread, up) * forward;
			Vector3 forward2 = ((Component)cc).transform.forward;
			forward2 = Quaternion.AngleAxis(spread, up) * forward2;
			SpawnProjectile(defaultPos, forward);
			SpawnProjectile(defaultPos, forward2);
			Object.Instantiate<GameObject>(swingSound);
		}

		private GameObject SpawnProjectile(Vector3 pos, Vector3 dir, float mod = 1f, float speedMod = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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)
			pos += ((Component)cc).transform.forward * 0.8f;
			GameObject val = Object.Instantiate<GameObject>(swingProjectile, pos, Quaternion.identity);
			val.transform.forward = dir;
			Projectile component = val.GetComponent<Projectile>();
			component.sourceWeapon = ((Component)this).gameObject;
			component.weaponType = "sword" + variation;
			component.damage = swingDamage * mod;
			component.speed += speedMod;
			component.turnSpeed += speedMod * 10f;
			return val;
		}

		public void SwingSuccess(Vector3 point, Transform target, int total, float dmgMult = 1f, bool checkLastEid = false)
		{
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			StakeSpinning stakeSpinning = default(StakeSpinning);
			if (((Component)target).gameObject.tag == "Enemy" || ((Component)target).gameObject.tag == "Head" || ((Component)target).gameObject.tag == "Body" || ((Component)target).gameObject.tag == "Limb" || ((Component)target).gameObject.tag == "EndLimb")
			{
				EnemyIdentifier val = null;
				EnemyIdentifierIdentifier val2 = default(EnemyIdentifierIdentifier);
				if (((Component)target).TryGetComponent<EnemyIdentifierIdentifier>(ref val2))
				{
					val = val2.eid;
				}
				if (!Object.op_Implicit((Object)(object)val) || val.dead)
				{
					return;
				}
				if (checkLastEid)
				{
					if ((Object)(object)lastChargeEid == (Object)(object)val)
					{
						return;
					}
					Object.Instantiate<GameObject>(swingHitSound);
					lastChargeEid = val;
				}
				if (!targetsThisSwing.Contains(val))
				{
					targetsThisSwing.Add(val);
					if (!val.hitterWeapons.Contains("sword" + variation))
					{
						val.hitterWeapons.Add("sword" + variation);
					}
					MonoSingleton<TimeController>.Instance.HitStop(0.05f);
					cc.CameraShake(0.5f);
					shud.AddPoints(1, "justice.pierce", ((Component)this).gameObject, (EnemyIdentifier)null, -1, "", "");
					val.hitter = "slice";
					val.DeliverDamage(((Component)target).gameObject, ((Component)cc).transform.forward * -3000f, point, swingDamage / (float)total, false, 1f, (GameObject)null, false, false);
				}
			}
			else if (((Component)target).gameObject.tag == "Coin")
			{
				Coin component = ((Component)target).GetComponent<Coin>();
				if (Object.op_Implicit((Object)(object)component) && component.doubled)
				{
					Coin component2 = ((Component)target).GetComponent<Coin>();
					if (component2 != null)
					{
						component2.DelayedPunchflection();
					}
				}
			}
			else if (((Component)target).gameObject.layer == 14 && ((Component)target.root).TryGetComponent<StakeSpinning>(ref stakeSpinning))
			{
				stakeSpinning.NewBreak();
			}
		}

		private void GetStuff()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			environmentMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "Environment", "Outdoors", "Item" }));
			ignoreEnemyTrigger = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "Limb", "BigCorpse", "Projectile" }));
			enemyMask = LayerMask.op_Implicit(LayerMask.op_Implicit(enemyMask) | 0x400);
			shud = MonoSingleton<StyleHUD>.Instance;
			targeter = ((Component)Camera.main).GetComponent<CameraFrustumTargeter>();
			inman = MonoSingleton<InputManager>.Instance;
			wid = ((Component)this).GetComponent<WeaponIdentifier>();
			aud = ((Component)this).GetComponent<AudioSource>();
			cc = MonoSingleton<CameraController>.Instance;
			cam = ((Component)cc).GetComponent<Camera>();
			smr = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
			gc = ((Component)this).GetComponentInParent<GunControl>();
			anim = ((Component)this).GetComponentInChildren<Animator>();
			wpos = ((Component)this).GetComponent<WeaponPos>();
			wc = MonoSingleton<WeaponCharges>.Instance;
		}
	}
	public static class MetaDatabase
	{
		public static AssetBundle coreBundle;

		public static GameObject newShopPrefab;

		public static ProphetResources resources;

		public static CustomTerminal terminal;

		private const string StageAddonsNamespace = "ProjectProphet.StageAddons";

		public static Dictionary<int, StageAddon> sceneToBundle;

		public static Dictionary<int, TipOfTheDay> levelNumberToTip;

		public static Dictionary<string, TipOfTheDay> levelNameToTip;

		public static List<KeyValuePair<string, string>> styleKVPs;

		public static List<KeyValuePair<string, float>> freshnessKVPs;

		public static void InitWeps(string bundleDir)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			coreBundle = AssetBundle.LoadFromFile(bundleDir);
			((Object)coreBundle).hideFlags = (HideFlags)32;
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"ProjectProphet.Resources").WaitForCompletion();
			resources = val.GetComponent<ProphetResources>();
			terminal = val.GetComponent<CustomTerminal>();
			newShopPrefab = coreBundle.LoadAsset<GameObject>(Utils.BundleProjectPath + "/NewShop.prefab");
		}

		public static void InitStageAddons()
		{
			sceneToBundle = new Dictionary<int, StageAddon>();
			levelNumberToTip = new Dictionary<int, TipOfTheDay>();
			levelNameToTip = new Dictionary<string, TipOfTheDay>();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Type[] types = executingAssembly.GetTypes();
			foreach (Type type in types)
			{
				if (type.Namespace != "ProjectProphet.StageAddons")
				{
					continue;
				}
				MethodInfo[] methods = type.GetMethods();
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					StageAddon customAttribute = methodInfo.GetCustomAttribute<StageAddon>();
					if (customAttribute != null)
					{
						Utils.Log($"Found method {methodInfo.Name} in class {methodInfo.DeclaringType.Name} with level name of {customAttribute.stage}");
						customAttribute.SetMethodInfo(methodInfo);
						sceneToBundle.Add(customAttribute.stage, customAttribute);
					}
				}
				FieldInfo[] fields = type.GetFields();
				FieldInfo[] array2 = fields;
				foreach (FieldInfo fieldInfo in array2)
				{
					TipOfTheDay customAttribute2 = fieldInfo.GetCustomAttribute<TipOfTheDay>();
					if (customAttribute2 != null)
					{
						customAttribute2.SetMethodInfo(fieldInfo);
						Utils.Log($"Found field {fieldInfo.Name} in class {fieldInfo.DeclaringType.Name} with level name of {customAttribute2.stage}");
						if (string.IsNullOrEmpty(customAttribute2.sceneOverride))
						{
							levelNumberToTip.Add(customAttribute2.stage, customAttribute2);
						}
						else
						{
							levelNameToTip.Add(customAttribute2.sceneOverride, customAttribute2);
						}
					}
				}
			}
		}

		public static void InitStyleKVPs()
		{
			styleKVPs = new List<KeyValuePair<string, string>>();
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.divineslice", "DIVINE SLICE"));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.criticalslice", "CRITICAL SLICE"));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.icespike", "GLITTERFREEZE"));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.inlight", "UNDER THE LIGHT"));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.blur", "<color=#00ffffff>BLUR</color>"));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.afterburn", "<color=#00ffffff>AFTERBURNER</color>"));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.axe", "<color=#00ffffff>CHUNGUS'D</color>"));
			styleKVPs.Add(new KeyValuePair<string, string>("justice.hit", string.Empty));
			styleKVPs.Add(new KeyValuePair<string, string>("justice.pierce", string.Empty));
			styleKVPs.Add(new KeyValuePair<string, string>("magicred.smoke", string.Empty));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.iceleech", string.Empty));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.splenda", string.Empty));
			styleKVPs.Add(new KeyValuePair<string, string>("gabriel.ice", string.Empty));
			freshnessKVPs = new List<KeyValuePair<string, float>>();
			freshnessKVPs.Add(new KeyValuePair<string, float>("justice.hit", 0.35f));
			freshnessKVPs.Add(new KeyValuePair<string, float>("justice.pierce", 0.9f));
			freshnessKVPs.Add(new KeyValuePair<string, float>("gabriel.inlight", 1.4f));
			freshnessKVPs.Add(new KeyValuePair<string, float>("gabriel.splenda", 1.1f));
			freshnessKVPs.Add(new KeyValuePair<string, float>("magicred.smoke", 0.1f));
			freshnessKVPs.Add(new KeyValuePair<string, float>("gabriel.ice", 0.4f));
			freshnessKVPs.Add(new KeyValuePair<string, float>("gabriel.icespike", 0.7f));
			freshnessKVPs.Add(new KeyValuePair<string, float>("gabriel.iceleech", 0.25f));
		}
	}
	[Serializable]
	public class ProphetProgress
	{
		public bool wrathSwitch1;

		public bool wrathSwitch2;

		public bool wrathSwitch3;
	}
	public static class Utils
	{
		public static bool notifLaunched;

		private static string _bundleProjectPath;

		private static string _packedPath;

		public static Dictionary<string, Shader> shaders;

		private static Dictionary<AssetReference, AsyncOperationHandle<GameObject>> LoadedWeapons = new Dictionary<AssetReference, AsyncOperationHandle<GameObject>>();

		public static StyleHUD shud => MonoSingleton<StyleHUD>.Instance;

		public static GunControl gc => MonoSingleton<GunControl>.Instance;

		public static WeaponCharges wc => MonoSingleton<WeaponCharges>.Instance;

		public static TimeController timeController => MonoSingleton<TimeController>.Instance;

		public static string BundleProjectPath
		{
			get
			{
				if (string.IsNullOrEmpty(_bundleProjectPath))
				{
					_bundleProjectPath = Path.Combine("Assets", "Custom", "Maranara", "Code Mods", "Prophet");
				}
				return _bundleProjectPath;
			}
		}

		public static string PackedPath
		{
			get
			{
				if (string.IsNullOrEmpty(_packedPath))
				{
					_packedPath = Path.Combine(ModPath() ?? "", "bundles");
				}
				return _packedPath;
			}
		}

		public static AssetBundle curStageBundle { get; private set; }

		private static string ModPath()
		{
			return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf("\\"));
		}

		public static void Log(string log)
		{
		}

		public static void InitShaders()
		{
			Shader val = Shader.Find("psx/vertexlit/vertexlit");
			if (!((Object)(object)val == (Object)null))
			{
				shaders = new Dictionary<string, Shader>();
				shaders.Add("psx/vertexlit/vertexlit", val);
				shaders.Add("Standard", val);
				shaders.Add("psx/unlit/transparent/nocull-fresnel", Shader.Find("psx/unlit/transparent/nocull-fresnel"));
				shaders.Add("psx/unlit/ambient", Shader.Find("psx/unlit/ambient"));
				shaders.Add("psx/unlit/transparent/unlit-scrolling", Shader.Find("psx/unlit/transparent/unlit-scrolling"));
			}
		}

		public static void FixShaders(this GameObject go)
		{
			Renderer[] componentsInChildren = (Renderer[])(object)go.GetComponentsInChildren<SkinnedMeshRenderer>();
			Renderer[] array = componentsInChildren;
			componentsInChildren = (Renderer[])(object)go.GetComponentsInChildren<MeshRenderer>();
			Renderer[] array2 = componentsInChildren;
			Renderer[] array3 = array;
			foreach (Renderer rend in array3)
			{
				FixRenderer(rend);
			}
			Renderer[] array4 = array2;
			foreach (Renderer rend2 in array4)
			{
				FixRenderer(rend2);
			}
		}

		private static void FixRenderer(Renderer rend)
		{
			Material[] sharedMaterials = rend.sharedMaterials;
			foreach (Material val in sharedMaterials)
			{
				if (!((Object)(object)val == (Object)null) && shaders.ContainsKey(((Object)val.shader).name))
				{
					val.shader = shaders[((Object)val.shader).name];
				}
			}
		}

		public static Vector3 ClampMagnitude(this Vector3 v, float max, float min)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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)
			double num = ((Vector3)(ref v)).sqrMagnitude;
			if (num > (double)max * (double)max)
			{
				return ((Vector3)(ref v)).normalized * max;
			}
			if (num < (double)min * (double)min)
			{
				return ((Vector3)(ref v)).normalized * min;
			}
			return v;
		}

		public static ProphetProgress ReadSaveSlot()
		{
			ProphetProgress prophetProgress = (ProphetProgress)GameProgressSaver.ReadFile(Path.Combine(GameProgressSaver.SavePath, "prophet.bepis"));
			if (prophetProgress == null)
			{
				return new ProphetProgress();
			}
			return prophetProgress;
		}

		public static void WriteSaveSlot(ProphetProgress progress)
		{
			GameProgressSaver.WriteFile(Path.Combine(GameProgressSaver.SavePath, "prophet.bepis"), (object)progress);
		}

		public static void HurtButDontKill(int damage)
		{
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			int num = 0;
			if (instance.hp != 1)
			{
				num = ((instance.hp > damage) ? damage : (instance.hp - 1));
				instance.GetHurt(num, false, 1f, false, false, 0.35f, false);
			}
		}

		public static void PrintResources()
		{
			foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators)
			{
				foreach (string key in resourceLocator.Keys)
				{
					if (key.Contains("Prophet"))
					{
						Log("Loaded Prophet Resource: " + key);
					}
				}
			}
		}

		public static bool CastLevelNameToInt(string name, out int result)
		{
			name = name.Substring(name.Length - 3);
			name = name.Remove(1, 1);
			return int.TryParse(name, out result);
		}

		public static void SetAssRefField(AssetReference asset, Traverse field, int i = -1)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0038: Invalid comparison between Unknown and I4
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = null;
			if (LoadedWeapons.TryGetValue(asset, out var value))
			{
				val = value.Result;
			}
			else
			{
				AsyncOperationHandle<GameObject> value2 = Addressables.LoadAssetAsync<GameObject>((object)asset);
				value2.WaitForCompletion();
				if ((int)value2.Status == 1)
				{
					LoadedWeapons.Add(asset, value2);
					val = value2.Result;
				}
			}
			if ((Object)(object)val != (Object)null && field != null)
			{
				if (i == -1)
				{
					field.SetValue((object)val);
					return;
				}
				GameObject[] array = (GameObject[])field.GetValue();
				array[i] = val;
				field.SetValue((object)array);
			}
		}

		private static IEnumerator CoLoadAsset(AssetReference asset, Traverse set, int i)
		{
			GameObject tar = null;
			if (LoadedWeapons.TryGetValue(asset, out var preHandle))
			{
				yield return preHandle;
				tar = preHandle.Result;
			}
			else
			{
				AsyncOperationHandle<GameObject> opHandle = Addressables.LoadAssetAsync<GameObject>((object)asset);
				yield return opHandle;
				if ((int)opHandle.Status == 1)
				{
					LoadedWeapons.Add(asset, opHandle);
					tar = opHandle.Result;
				}
			}
			if ((Object)(object)tar != (Object)null && set != null)
			{
				if (i == -1)
				{
					set.SetValue((object)tar);
					yield break;
				}
				GameObject[] arr = (GameObject[])set.GetValue();
				arr[i] = tar;
				set.SetValue((object)arr);
			}
		}

		public static GameObject LoadAndInstantiateStage(string levelName)
		{
			string text = Path.Combine(PackedPath ?? "", levelName + ".lvl");
			if ((Object)(object)curStageBundle == (Object)null)
			{
				curStageBundle = AssetBundle.LoadFromFile(text);
			}
			else
			{
				Log(((Object)curStageBundle).name);
				if (((Object)curStageBundle).name != levelName + ".lvl")
				{
					if ((Object)(object)curStageBundle != (Object)null)
					{
						curStageBundle.Unload(true);
					}
					curStageBundle = AssetBundle.LoadFromFile(text);
					((Object)curStageBundle).name = levelName;
					Log("Loading stage bundle...");
				}
				else
				{
					Log("Stage bundle already loaded");
				}
			}
			if (curStageBundle.isStreamedSceneAssetBundle)
			{
				return null;
			}
			GameObject val = curStageBundle.LoadAsset<GameObject>(BundleProjectPath + "/LevelAddons/" + levelName + ".prefab");
			return Object.Instantiate<GameObject>(val);
		}
	}
	internal class GabrielPatches
	{
		private static List<string> PrefsWhitelist = new List<string> { "gunColor", "weapon." };

		private const string JUSTICE_HIT = "justice.hit";

		private const string virtueHitter = "cannonpillar";

		private static bool railcanonInit;

		[HarmonyPatch(typeof(Cannonball), "Collide")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> CustomCannonballMessage(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				if (instruction.opcode == OpCodes.Ldstr && (string)instruction.operand == "ultrakill.cannonballed")
				{
					instruction.operand = "gabriel.icespike";
				}
				yield return instruction;
			}
		}

		[HarmonyPatch(typeof(GunSetter), "CheckWeaponOrder")]
		[HarmonyPatch(typeof(GunSetter), "CheckWeapon")]
		[HarmonyPatch(typeof(GunSetter), "ForceWeapon")]
		[HarmonyPatch(typeof(GunColorGetter), "UpdateColor")]
		[HarmonyPatch(typeof(GunColorSetter), "OnEnable")]
		[HarmonyPatch(typeof(GunColorSetter), "UpdateColor")]
		[HarmonyPatch(typeof(GunColorTypeGetter), "OnEnable")]
		[HarmonyPatch(typeof(GunColorTypeGetter), "SetPreset")]
		[HarmonyPatch(typeof(GunColorTypeGetter), "SetType")]
		[HarmonyPatch(typeof(GunColorController), "UpdateColor")]
		[HarmonyPatch(typeof(GunColorController), "UpdateGunColors")]
		[HarmonyPatch(typeof(GunColorController), "GetGunColor")]
		[HarmonyPatch(typeof(WeaponOrderController), "ChangeOrderNumber")]
		[HarmonyPatch(typeof(WeaponOrderController), "ResetValues")]
		[HarmonyPatch(typeof(VariationInfo), "UpdateMoney")]
		[HarmonyPatch(typeof(VariationInfo), "WeaponBought")]
		[HarmonyPatch(typeof(VariationInfo), "ChangeEquipment")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> ReplacePrefs(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				if (instruction.opcode == OpCodes.Ldstr)
				{
					foreach (string a in PrefsWhitelist)
					{
						if (((string)instruction.operand).Contains(a))
						{
							instruction.operand = "gabe." + (string)instruction.operand;
							break;
						}
					}
				}
				yield return instruction;
			}
		}

		[HarmonyPatch(typeof(GunColorGetter), "UpdateColor")]
		[HarmonyPrefix]
		private static bool IShouldntHaveToFixThisButWhatever(GunColorGetter __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.rend == (Object)null)
			{
				__instance.rend = ((Component)__instance).GetComponent<Renderer>();
			}
			if (__instance.customColors == null)
			{
				__instance.customColors = new MaterialPropertyBlock();
			}
			__instance.hasCustomColors = MonoSingleton<PrefsManager>.Instance.GetBool("gabe.gunColorType." + __instance.weaponNumber + (__instance.altVersion ? ".a" : ""), false) && MonoSingleton<GunColorController>.Instance.hasUnlockedColors[__instance.weaponNumber - 1];
			GunColorPreset colors = __instance.GetColors();
			if (__instance.currentColors != colors)
			{
				if (__instance.GetPreset() != 0 || __instance.hasCustomColors)
				{
					__instance.rend.materials = __instance.coloredMaterials;
					__instance.rend.GetPropertyBlock(__instance.customColors);
					__instance.customColors.SetColor("_CustomColor1", colors.color1);
					__instance.customColors.SetColor("_CustomColor2", colors.color2);
					__instance.customColors.SetColor("_CustomColor3", colors.color3);
					__instance.rend.SetPropertyBlock(__instance.customColors);
				}
				else
				{
					__instance.rend.GetPropertyBlock(__instance.customColors);
					__instance.customColors.Clear();
					__instance.rend.SetPropertyBlock(__instance.customColors);
					__instance.rend.materials = __instance.defaultMaterials;
				}
			}
			__instance.currentColors = colors;
			return false;
		}

		[HarmonyPatch(typeof(GunColorController), "Start")]
		[HarmonyPrefix]
		private static void ColorPresetOverride(GunColorController __instance)
		{
			MetaDatabase.terminal.ApplyColors(__instance);
		}

		[HarmonyPatch(typeof(StyleCalculator), "HitCalculator")]
		[HarmonyPostfix]
		private static void Patch(StyleCalculator __instance, string hitter, string enemyType, string hitLimb, bool dead, EnemyIdentifier eid, GameObject sourceWeapon)
		{
			if (!(hitter == "gabriel.afterburn"))
			{
				if (hitter == "gabriel.axe" && dead)
				{
					AddPoints(50, "gabriel.blur", eid, sourceWeapon);
				}
			}
			else
			{
				AddPoints(150, "gabriel.afterburn", eid, sourceWeapon);
			}
			foreach (string hitterWeapon in eid.hitterWeapons)
			{
				string text = hitterWeapon;
				string text2 = text;
				if (!(text2 == "gabriel.afterburn"))
				{
					if (text2 == "gabriel.splendorblast")
					{
						if (dead)
						{
							AddPoints(50, "gabriel.inlight", eid, sourceWeapon);
						}
						else
						{
							AddPoints(10, "gabriel.splenda", eid, sourceWeapon);
						}
					}
				}
				else if (dead)
				{
					AddPoints(150, "gabriel.afterburn", eid, sourceWeapon);
				}
				if (hitterWeapon.Contains("sword"))
				{
					AddPoints(5, "justice.hit", eid, sourceWeapon);
					if (dead)
					{
						AddPoints(8, "justice.hit", eid, sourceWeapon);
					}
				}
				if (hitterWeapon.Contains("crossbow"))
				{
					AddPoints(8, string.Empty, eid, sourceWeapon);
					if (dead)
					{
						AddPoints(9, string.Empty, eid, sourceWeapon);
					}
				}
			}
		}

		[HarmonyPatch(typeof(OptionsMenuToManager), "Start")]
		[HarmonyPostfix]
		private static void ProphetMainMenu(OptionsMenuToManager __instance)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)__instance).transform.Find("Main Menu (1)");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
			GameObject val2 = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
			val2.GetComponent<Image>().sprite = MetaDatabase.resources.logo;
			Transform transform = val2.transform;
			transform.localScale *= 1.6f;
			Vector3 localPosition = val2.transform.localPosition;
			localPosition.y += 30f;
			val2.transform.localPosition = localPosition;
			gameObject.SetActive(false);
			TextMeshProUGUI component = ((Component)val2.transform.GetChild(0)).GetComponent<TextMeshProUGUI>();
			((TMP_Text)component).transform.parent = ((TMP_Text)component).transform.parent.parent;
			RectTransform component2 = ((Component)component).GetComponent<RectTransform>();
			component2.pivot = new Vector2(0.5f, 0f);
			((Graphic)component).color = Color.yellow;
			((TMP_Text)component).text = "-- PRELUDE DEMO --\n0.0.5";
			((TMP_Text)component).transform.localScale = Vector3.one * 0.5f;
			localPosition = val2.transform.localPosition;
			localPosition.y = -466.2013f;
			((TMP_Text)component).transform.localPosition = localPosition;
			AudioSource component3 = GameObject.Find("Music").GetComponent<AudioSource>();
			component3.clip = MetaDatabase.resources.mainMenuMusic;
			component3.Play();
			GameObject gameObject2 = ((Component)((Component)__instance).transform.Find("Chapter Select")).gameObject;
			MenuActSelect[] componentsInChildren = gameObject2.GetComponentsInChildren<MenuActSelect>(true);
			MenuActSelect[] array = componentsInChildren;
			foreach (MenuActSelect val3 in array)
			{
				bool flag = false;
				switch (((Object)((Component)val3).gameObject).name)
				{
				case "Act I":
					flag = true;
					break;
				case "Act II":
					flag = true;
					break;
				case "Act III":
					flag = true;
					break;
				case "Prime":
					flag = true;
					break;
				}
				if (flag)
				{
					Utils.Log("On Enable Call for " + ((Object)((Component)val3).gameObject).name);
					val3.forceOff = true;
					val3.OnEnable();
				}
			}
		}

		[HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")]
		[HarmonyPrefix]
		private static bool SubmitCyberGrindScore(LeaderboardController __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")]
		[HarmonyPrefix]
		private static bool SubmitLevelScore(LeaderboardController __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(Projectile), "Update")]
		[HarmonyPrefix]
		private static bool ProjectileUpdate(Projectile __instance)
		{
			if (((object)__instance).GetType() == typeof(SwordBeam))
			{
				((SwordBeam)(object)__instance).NewUpdate();
			}
			return true;
		}

		[HarmonyPatch(typeof(Projectile), "Collided")]
		[HarmonyPrefix]
		private static bool ProjectileCollided(Projectile __instance, Collider other)
		{
			if (((object)__instance).GetType() == typeof(SwordBeam))
			{
				((SwordBeam)(object)__instance).NewCollide(other);
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Harpoon), "Punched")]
		[HarmonyPrefix]
		private static bool CannonballLaunch(Harpoon __instance)
		{
			if (((object)__instance).GetType() == typeof(StakeShard))
			{
				((StakeShard)(object)__instance).NewPunched();
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Nail), "FixedUpdate")]
		[HarmonyPrefix]
		private static bool CannonballLaunch(Nail __instance)
		{
			if (((object)__instance).GetType() == typeof(Stake))
			{
				((Stake)(object)__instance).OnFixedUpdate();
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Cannonball), "Launch")]
		[HarmonyPrefix]
		private static bool CannonballLaunch(Cannonball __instance)
		{
			if (((object)__instance).GetType() == typeof(StakeSpinning))
			{
				((StakeSpinning)(object)__instance).NewLaunch();
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Cannonball), "Break")]
		[HarmonyPrefix]
		private static bool CannonballBreak(Cannonball __instance)
		{
			if (((object)__instance).GetType() == typeof(StakeSpinning))
			{
				((StakeSpinning)(object)__instance).NewBreak();
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
		[HarmonyPostfix]
		private static void Patch(EnemyIdentifier __instance, GameObject target, Vector3 force, Vector3 hitPoint, float multiplier, bool tryForExplode, float critMultiplier = 0f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((int)__instance.enemyType == 42)
			{
				MaliciousDrone component = ((Component)__instance).GetComponent<MaliciousDrone>();
				if (!((Object)(object)component == (Object)null))
				{
					component.GetHurt(force, multiplier);
				}
			}
		}

		[HarmonyPatch(typeof(ShopZone), "Start")]
		[HarmonyPrefix]
		private static void Patch(ShopZone __instance)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)__instance).transform.Find("Cube");
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).gameObject.SetActive(false);
			}
			GameObject val2 = Object.Instantiate<GameObject>(MetaDatabase.newShopPrefab);
			val2.transform.parent = ((Component)__instance).transform;
			val2.transform.localPosition = Vector3.zero;
			val2.transform.localRotation = Quaternion.identity;
			Canvas componentInChildren = ((Component)__instance).GetComponentInChildren<Canvas>(true);
			if ((Object)(object)componentInChildren != (Object)null)
			{
				RectTransform component = ((Component)componentInChildren).GetComponent<RectTransform>();
				Vector3 localPosition = ((Transform)component).localPosition;
				localPosition.z = 1f;
				((Transform)component).localPosition = localPosition;
				MetaDatabase.terminal.Apply(__instance);
			}
			AudioSource componentInChildren2 = ((Component)__instance).GetComponentInChildren<AudioSource>();
			if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)componentInChildren2.clip != (Object)null && ((Object)componentInChildren2.clip).name == "shopmusic")
			{
				componentInChildren2.clip = MetaDatabase.resources.shopMusic;
				componentInChildren2.Play();
			}
		}

		[HarmonyPatch(typeof(VirtueInsignia), "OnTriggerEnter")]
		[HarmonyPrefix]
		private static void Patch(VirtueInsignia __instance, Collider other)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Invalid comparison between Unknown and I4
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)__instance).gameObject.tag != "Player" || (((Component)other).gameObject.layer != 10 && ((Component)other).gameObject.layer != 11))
			{
				return;
			}
			EnemyIdentifierIdentifier componentInParent = ((Component)other).GetComponentInParent<EnemyIdentifierIdentifier>();
			if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.eid != (Object)null)
			{
				Collider component = ((Component)componentInParent.eid).GetComponent<Collider>();
				if ((Object)(object)component != (Object)null && !componentInParent.eid.dead && (int)componentInParent.eid.enemyType != 9)
				{
					componentInParent.eid.hitter = "cannonpillar";
					componentInParent.eid.DeliverDamage(((Component)other).gameObject, Vector3.up * 9000f, ((Component)other).transform.position, 1f / 3f, false, 0f, (GameObject)null, false, false);
				}
			}
		}

		[HarmonyPatch(typeof(NewMovement), "Start")]
		[HarmonyPostfix]
		private static void MovementSoundPatch(NewMovement __instance)
		{
			int @int = MonoSingleton<PrefsManager>.Instance.GetInt("selectedSaveSlot", 0);
			if (@int == 10)
			{
				GameProgressMoneyAndGear generalProgress = GameProgressSaver.GetGeneralProgress();
				generalProgress.revalt = 0;
				generalProgress.rev1 = 0;
				generalProgress.rev3 = 0;
				generalProgress.sho2 = 0;
				generalProgress.nai0 = 0;
				generalProgress.nai1 = 0;
				generalProgress.nai2 = 0;
				generalProgress.nai3 = 0;
				generalProgress.naialt = 0;
				generalProgress.beam0 = 0;
				generalProgress.beam1 = 0;
				generalProgress.beam2 = 0;
				generalProgress.beam3 = 0;
				generalProgress.rai0 = 0;
				generalProgress.rai1 = 0;
				generalProgress.rai2 = 0;
				generalProgress.rai3 = 0;
				generalProgress.rock0 = 0;
				generalProgress.rock1 = 0;
				generalProgress.rock2 = 0;
				generalProgress.rock3 = 0;
				if (generalProgress.arm1 == 1)
				{
					Debug.Log((object)"Smokin that axe pack brah");
				}
				generalProgress.arm1 = 0;
				generalProgress.arm2 = 0;
				generalProgress.arm3 = 0;
				GameProgressSaver.WriteFile(GameProgressSaver.generalProgressPath, (object)generalProgress);
			}
			__instance.jumpSound = MetaDatabase.resources.sfxJump;
			__instance.landingSound = MetaDatabase.resources.sfxLand;
			__instance.slideScrapePrefab = MetaDatabase.resources.sfxSlideLoop;
			__instance.slideStopSound = MetaDatabase.resources.sfxSlideEnd;
			__instance.finalWallJump = MetaDatabase.resources.sfxWalljumpFatigue;
			__instance.dodgeParticle = MetaDatabase.resources.dodgeParticle;
			__instance.fallParticle = MetaDatabase.resources.fallParticle;
			__instance.scrapePrefab = MetaDatabase.resources.scrapePrefab;
			Object.Instantiate<GameObject>(MetaDatabase.resources.newWeaponCharges);
		}

		[HarmonyPatch(typeof(StyleHUD), "Start")]
		[HarmonyPrefix]
		private static void RankChanges(StyleHUD __instance)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Sprite[] ranks = MetaDatabase.resources.ranks;
			for (int i = 0; i < ranks.Length; i++)
			{
				__instance.ranks[i].sprite = ranks[i];
			}
			__instance.rankImage.sprite = ranks[0];
			__instance.defaultPos = new Vector3(-35f, -75f, 0f);
		}

		[HarmonyPatch(typeof(PlayerAnimations), "Start")]
		[HarmonyPostfix]
		private static void FootstepSoundPatch(PlayerAnimations __instance)
		{
			__instance.footsteps = MetaDatabase.resources.sfxFootsteps;
		}

		[HarmonyPatch(typeof(RailcannonMeter), "Start")]
		[HarmonyPrefix]
		private static void Patch(RailcannonMeter __instance)
		{
			__instance.meters[0].sprite = MetaDatabase.resources.lightningBolt;
			__instance.meters[1].sprite = MetaDatabase.resources.lightningBoltSmall;
			__instance.meterBackground.sprite = MetaDatabase.resources.lightningBolt;
			__instance.colorlessMeter.sprite = MetaDatabase.resources.lightningBoltSmall;
		}

		private static void AddPoints(int points, string pointName, EnemyIdentifier eid = null, GameObject sourceWeapon = null)
		{
			MonoSingleton<StyleHUD>.Instance.AddPoints(points, pointName, sourceWeapon, eid, -1, "", "");
		}

		[HarmonyPatch(typeof(GunSetter), "Start")]
		[HarmonyPrefix]
		private static void GunSetterStart(GunSetter __instance)
		{
			if (!railcanonInit)
			{
				railcanonInit = true;
			}
			__instance.revolverPierce = MetaDatabase.resources.justice;
			__instance.revolverRicochet = MetaDatabase.resources.splendor;
			__instance.revolverTwirl = (AssetReference[])(object)new AssetReference[0];
			__instance.shotgunGrenade = MetaDatabase.resources.crossbow;
			__instance.shotgunPump = MetaDatabase.resources.crossbowGreen;
			__instance.shotgunRed = (AssetReference[])(object)new AssetReference[0];
			__instance.nailMagnet = (AssetReference[])(object)new AssetReference[0];
			__instance.nailOverheat = (AssetReference[])(object)new AssetReference[0];
			__instance.nailRed = (AssetReference[])(object)new AssetReference[0];
			__instance.railCannon = (AssetReference[])(object)new AssetReference[0];
			__instance.railHarpoon = (AssetReference[])(object)new AssetReference[0];
			__instance.railMalicious = (AssetReference[])(object)new AssetReference[0];
			__instance.rocketBlue = (AssetReference[])(object)new AssetReference[0];
			__instance.rocketGreen = (AssetReference[])(object)new AssetReference[0];
			__instance.rocketRed = (AssetReference[])(object)new AssetReference[0];
		}

		[HarmonyPatch(typeof(WeaponCharges), "MaxCharges")]
		[HarmonyPrefix]
		private static void MaxCharge()
		{
			NewWeaponCharges.MaxCharge();
		}

		[HarmonyPatch(typeof(StyleHUD), "Start")]
		[HarmonyPrefix]
		private static void ShudStart(StyleHUD __instance)
		{
			foreach (KeyValuePair<string, string> styleKVP in MetaDatabase.styleKVPs)
			{
				__instance.RegisterStyleItem(styleKVP.Key, styleKVP.Value);
			}
			foreach (KeyValuePair<string, float> freshnessKVP in MetaDatabase.freshnessKVPs)
			{
				__instance.freshnessDecayMultiplierDict.Add(freshnessKVP.Key, freshnessKVP.Value);
			}
		}

		[HarmonyPatch(typeof(WeaponCharges), "Charge")]
		[HarmonyPrefix]
		private static bool Charge(WeaponCharges __instance, float amount)
		{
			NewWeaponCharges.Charge(amount);
			if (__instance.rev0charge < 100f)
			{
				if (__instance.rev0alt)
				{
					__instance.rev0charge = Mathf.MoveTowards(__instance.rev0charge, 100f, 20f * amount);
				}
				else
				{
					__instance.rev0charge = Mathf.MoveTowards(__instance.rev0charge, 100f, 40f * amount);
				}
			}
			if (__instance.rev1charge < 400f)
			{
				__instance.rev1charge = Mathf.MoveTowards(__instance.rev1charge, 400f, 25f * amount);
			}
			if (__instance.naiHeatsinks < 2f)
			{
				__instance.naiHeatsinks = Mathf.MoveTowards(__instance.naiHeatsinks, 2f, amount * 0.075f);
			}
			if (__instance.naiSawHeatsinks < 1f)
			{
				__instance.naiSawHeatsinks = Mathf.MoveTowards(__instance.naiSawHeatsinks, 1f, amount * 0.075f);
			}
			if (__instance.naiheatUp > 0f)
			{
				__instance.naiheatUp = Mathf.MoveTowards(__instance.naiheatUp, 0f, amount * 0.3f);
			}
			if (__instance.raicharge < 5f && __instance.raicharge >= 4f && Object.op_Implicit((Object)(object)__instance.railCannonFullChargeSound))
			{
				__instance.raicharge = 5f;
			}
			if (__instance.rocketcharge > 0f)
			{
				__instance.rocketcharge = Mathf.MoveTowards(__instance.rocketcharge, 0f, amount);
			}
			if (__instance.rocketCannonballCharge < 1f)
			{
				__instance.rocketCannonballCharge = Mathf.MoveTowards(__instance.rocketCannonballCharge, 1f, amount * 0.125f);
			}
			for (int i = 0; i < __instance.revaltpickupcharges.Length; i++)
			{
				if (__instance.revaltpickupcharges[i] > 0f)
				{
					__instance.revaltpickupcharges[i] = Mathf.MoveTowards(__instance.revaltpickupcharges[i], 0f, amount);
				}
			}
			if (!__instance.naiAmmoDontCharge)
			{
				__instance.naiAmmo = Mathf.MoveTowards(__instance.naiAmmo, 100f, amount * 3.5f);
				__instance.naiSaws = Mathf.MoveTowards(__instance.naiSaws, 10f, amount * 0.5f);
			}
			if (__instance.magnets.Count > 0)
			{
				for (int num = __instance.magnets.Count - 1; num >= 0; num--)
				{
					if ((Object)(object)__instance.magnets[num] == (Object)null)
					{
						__instance.magnets.RemoveAt(num);
					}
				}
				if (__instance.magnets.Count < 3 && __instance.naiMagnetCharge < (float)(3 - __instance.magnets.Count))
				{
					__instance.naiMagnetCharge = Mathf.MoveTowards(__instance.naiMagnetCharge, (float)(3 - __instance.magnets.Count), amount * 3f);
				}
			}
			else if (__instance.naiMagnetCharge < 3f)
			{
				__instance.naiMagnetCharge = Mathf.MoveTowards(__instance.naiMagnetCharge, 3f, amount * 3f);
			}
			__instance.rocketFreezeTime = Mathf.MoveTowards(__instance.rocketFreezeTime, (float)((!__instance.rocketFrozen) ? 5 : 0), __instance.rocketFrozen ? Time.deltaTime : (amount / 2f));
			if (__instance.rocketFrozen && Object.op_Implicit((Object)(object)__instance.rocketLauncher) && Object.op_Implicit((Object)(object)__instance.rocketLauncher.currentTimerTickSound))
			{
				__instance.rocketLauncher.currentTimerTickSound.pitch = Mathf.Lerp(0.75f, 1f, __instance.rocketFreezeTime / 5f);
			}
			if (__instance.rocketFrozen && __instance.rocketFreezeTime <= 0f)
			{
				__instance.rocketLauncher.UnfreezeRockets();
			}
			return false;
		}

		public static void RaicanonSubtract(float amt)
		{
			if (MonoSingleton<WeaponCharges>.Instance.raicharge >= 5f)
			{
				MonoSingleton<WeaponCharges>.Instance.raicharge = 4f;
				WeaponCharges instance = MonoSingleton<WeaponCharges>.Instance;
				instance.raicharge -= amt;
			}
			else
			{
				WeaponCharges instance2 = MonoSingleton<WeaponCharges>.Instance;
				instance2.raicharge -= amt;
			}
		}

		[HarmonyPatch(typeof(FistControl), "Start")]
		[HarmonyPrefix]
		private static void FistOverride(FistControl __instance)
		{
			__instance.blueArm = MetaDatabase.resources.blueFist;
			__instance.fistIcon.sprite = MetaDatabase.resources.fistIcon1;
		}

		[HarmonyPatch(typeof(FistControl), "ArmChange")]
		[HarmonyPostfix]
		private static void FistChange(FistControl __instance, int orderNum)
		{
			if (orderNum == 0)
			{
				__instance.fistIcon.sprite = MetaDatabase.resources.fistIcon1;
			}
			else
			{
				__instance.fistIcon.sprite = MetaDatabase.resources.fistIcon2;
			}
		}
	}
	[BepInPlugin("maranara_project_prophet", "Masquerade Divinity", "0.0.5")]
	public class ProjectProphet : BaseUnityPlugin
	{
		public const string VERSION_NUMBER = "0.0.5";

		public static bool gabeOn;

		public static Harmony harmony;

		private static ProjectProphet inst;

		public static ConfigEntry<bool> DidPopup;

		private void OnEnable()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			((Object)((Component)ThreadingHelper.Instance).gameObject).hideFlags = (HideFlags)61;
			inst = this;
			DidPopup = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SawPopup", false, (ConfigDescription)null);
			Utils.InitShaders();
			harmony = new Harmony("maranara_project_prophet");
			((MonoBehaviour)this).StartCoroutine(LoadContent());
			MetaDatabase.InitStageAddons();
			MetaDatabase.InitStyleKVPs();
			Harmony val = new Harmony("maranara_project_prophet-save");
			val.PatchAll(typeof(UniversalPatches));
		}

		public static void SwitchGabe(bool enableGabriel)
		{
			//IL_0036: 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)
			if (enableGabriel == gabeOn)
			{
				return;
			}
			gabeOn = enableGabriel;
			if (enableGabriel)
			{
				Utils.notifLaunched = false;
				harmony.PatchAll(typeof(GabrielPatches));
				Scene activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).buildIndex != 1 && (Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null)
				{
					MonoSingleton<OptionsManager>.Instance.QuitMission();
				}
			}
			else
			{
				harmony.UnpatchSelf();
				MonoSingleton<OptionsManager>.Instance.QuitMission();
				Damned.Disable();
			}
		}

		private IEnumerator LoadContent()
		{
			AsyncOperationHandle<IResourceLocator> res = Addressables.LoadContentCatalogAsync(Path.Combine(Utils.PackedPath ?? "", "projectprophet.json"), true, (string)null);
			while (!res.IsDone)
			{
				yield return null;
			}
			string bundleDir = Path.Combine(Utils.PackedPath ?? "", "prophet.bd");
			MetaDatabase.InitWeps(bundleDir);
		}

		public static void ToggleOffPopup()
		{
			inst.PopupOff();
		}

		private void PopupOff()
		{
			DidPopup.Value = true;
			((BaseUnityPlugin)this).Config.Save();
		}
	}
}
namespace ProjectProphet.StageAddons
{
	public class GConstruct
	{
		public static void ILaunchedGarrysModAndInstalledAGabrielAvatarAndThisIsTheMostEuphoricExperienceIveHadInMyLife()
		{
			ShopZone[] array = Resources.FindObjectsOfTypeAll<ShopZone>();
			ShopZone[] array2 = array;
			foreach (ShopZone val in array2)
			{
				if (((Object)((Component)val).gameObject).name == "Sandbox Shop" || ((Object)((Component)val).gameObject).name == "Garry Shop")
				{
					((ScreenZone)val).music.clip = MetaDatabase.resources.testamentMusic;
					((ScreenZone)val).music.Play();
				}
			}
		}
	}
	public static class GEA
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__1_0;

			public static UnityAction <>9__4_0;

			internal void <DoorLoader>b__1_0()
			{
				LoadEarlyAccess();
			}

			internal void <FinalizeEarlyAccess>b__4_0()
			{
				SceneHelper.LoadScene("Main Menu", false);
			}
		}

		public static void EAAssurance()
		{
			DoorLoader();
			LoadEarlyAccess();
		}

		public static void DoorLoader()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			try
			{
				UnityEvent onFullyOpened = ((Component)GameObject.Find("FirstRoom").transform.Find("Room").Find("FinalDoor")).GetComponent<FinalDoor>().doors[0].onFullyOpened;
				object obj = <>c.<>9__1_0;
				if (obj == null)
				{
					UnityAction val = delegate
					{
						LoadEarlyAccess();
					};
					<>c.<>9__1_0 = val;
					obj = (object)val;
				}
				onFullyOpened.AddListener((UnityAction)obj);
			}
			catch
			{
			}
		}

		public static void LoadEarlyAccess()
		{
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(WaitAndLoad());
		}

		private static IEnumerator WaitAndLoad()
		{
			while (!string.IsNullOrEmpty(SceneHelper.PendingScene))
			{
				yield return (object)new WaitForEndOfFrame();
			}
			try
			{
				SceneHelper.LoadScene("ProjectProphet.Scenes.End", false);
			}
			catch
			{
				SceneManager.LoadScene("Main Menu");
			}
		}

		public static void FinalizeEarlyAccess()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			ButtonClickedEvent onClick = GameObject.Find("Quit Mission").GetComponent<Button>().onClick;
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					SceneHelper.LoadScene("Main Menu", false);
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}
	}
	public static class G02
	{
		[StageAddon(2, true)]
		public static void WhoUpSwordsingTheyMachineRn()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Utils.LoadAndInstantiateStage("02");
			GameObject gameObject = ((Component)Resources.FindObjectsOfTypeAll<WeaponPickUp>()[0]).gameObject;
			foreach (Transform item in gameObject.transform)
			{
				Transform val2 = item;
				Object.Destroy((Object)(object)((Component)val2).gameObject);
			}
			Object.Destroy((Object)(object)gameObject.GetComponent<Animator>());
			Transform val3 = val.transform.Find("CrossbowPickup");
			val3.SetParent(gameObject.transform);
			val3.localPosition = Vector3.zero;
			val3.localRotation = Quaternion.identity;
			val3.localScale = new Vector3(6.6666665f, 6.6666665f, 5f);
			Traverse field = Traverse.Create((object)gameObject.GetComponent<WeaponPickUp>()).Field("weapon");
			Utils.SetAssRefField(MetaDatabase.resources.crossbow[0], field);
		}
	}
	public static class G0S
	{
		private const string BalladI = "<color=blue>As I sink deeper below\r\n\r\nKnowing there is no water to swallow,\r\n\r\nI feel each and all parts of me\r\n\r\nCalling your name</color>";

		public static void SomethingWicked()
		{
			Debug.Log((object)"0S...");
			ShopZone[] array = Resources.FindObjectsOfTypeAll<ShopZone>();
			ShopZone[] array2 = array;
			foreach (ShopZone val in array2)
			{
				if (((Object)((Component)val).gameObject).name == "Testament Shop")
				{
					AudioSource component = ((Component)((Component)val).transform.GetChild(0)).GetComponent<AudioSource>();
					component.clip = MetaDatabase.resources.testamentMusic;
					component.Play();
					Transform child = ((Component)val).transform.Find("Canvas").Find("Border").GetChild(0)
						.GetChild(0);
					TextMeshProUGUI component2 = ((Component)child.GetChild(0)).GetComponent<TextMeshProUGUI>();
					((TMP_Text)component2).text = "BALLAD I";
					TextMeshProUGUI component3 = ((Component)child.GetChild(1)).GetComponent<TextMeshProUGUI>();
					((TMP_Text)component3).text = "<color=blue>As I sink deeper below\r\n\r\nKnowing there is no water to swallow,\r\n\r\nI feel each and all parts of me\r\n\r\nCalling your name</color>";
				}
			}
			Object.Destroy((Object)(object)MonoSingleton<GunControl>.Instance.slot1[0]);
			MonoSingleton<GunControl>.Instance.slot1.Clear();
		}
	}
	public static class GTutorial
	{
		private const string IntroText = " STATUS UPDATE: \r\n\r\n MACHINE ID:            NOT FOUND         ½\r\n LOCATION:              UNKNOWN            ½\r\n CURRENT OBJECTIVE:     RECOVER         ½½½\r\n\r\n*THE BLOOD DRIPS_½½\r\n*FROM THIS METAL FRAME_½½\r\n*and½the½sound½is½½divine_½½&";

		private const string IntroFadeText = " <color=blue>THE BLOOD DRIPS\r\n FROM THIS METAL FRAME\r\n and the sound is  divine</color>";

		public static void CalibrateTutorial()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)V62.heresyEndCanvas != (Object)null)
			{
				V62.heresyEndCanvas.SetActive(false);
				Object.DestroyImmediate((Object)(object)V62.heresyEndCanvas);
			}
			IntroText[] array = Resources.FindObjectsOfTypeAll<IntroText>();
			IntroText[] array2 = array;
			foreach (IntroText val in array2)
			{
				Debug.Log((object)((Object)((Component)val).gameObject).name);
				if (((Object)((Component)val).gameObject).name == "Page 2")
				{
					Scene scene = ((Component)val).gameObject.scene;
					if (((Scene)(ref scene)).name == "DontDestroyOnLoad")
					{
						Object.Destroy((Object)(object)((Component)((Component)val).gameObject.transform.root).gameObject);
						continue;
					}
					val.fullString = " STATUS UPDATE: \r\n\r\n MACHINE ID:            NOT FOUND         ½\r\n LOCATION:              UNKNOWN            ½\r\n CURRENT OBJECTIVE:     RECOVER         ½½½\r\n\r\n*THE BLOOD DRIPS_½½\r\n*FROM THIS METAL FRAME_½½\r\n*and½the½sound½is½½divine_½½&";
					((TMP_Text)((Component)val).gameObject.GetComponent<TextMeshProUGUI>()).text = " STATUS UPDATE: \r\n\r\n MACHINE ID:            NOT FOUND         ½\r\n LOCATION:              UNKNOWN            ½\r\n CURRENT OBJECTIVE:     RECOVER         ½½½\r\n\r\n*THE BLOOD DRIPS_½½\r\n*FROM THIS METAL FRAME_½½\r\n*and½the½sound½is½½divine_½½&";
					((Component)((Component)val).transform.root.Find("Intro").Find("Audio Source")).GetComponent<AudioSource>().clip = MetaDatabase.resources.mainMenuMusic;
					((TMP_Text)((Component)((Component)val).transform.parent.Find("Page 2 NoFade")).GetComponent<TextMeshProUGUI>()).text = " <color=blue>THE BLOOD DRIPS\r\n FROM THIS METAL FRAME\r\n and the sound is  divine</color>";
				}
			}
		}
	}
	public static class G03
	{
		[StageAddon(3, true)]
		public static void WokeUltrakillBeLikeSwordstheychine()
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Utils.LoadAndInstantiateStage("03");
			GoreZone[] array = Resources.FindObjectsOfTypeAll<GoreZone>();
			Transform val2 = null;
			Transform val3 = null;
			GoreZone[] array2 = array;
			foreach (GoreZone val4 in array2)
			{
				if (((Object)((Component)val4).gameObject).name == "Most of the Stuff")
				{
					val2 = ((Component)val4).transform;
				}
				else if (((Object)((Component)val4).gameObject).name == "Boss Arena Contents")
				{
					val3 = ((Component)val4).transform;
				}
			}
			Object.Destroy((Object)(object)((Component)val2.Find("NeoBreakable")).gameObject);
			Object.Destroy((Object)(object)((Component)val2.parent.Find("7 Nonstuff").Find("Leading Hallway").Find("Afterbreak")).gameObject);
			GameObject gameObject = ((Component)Resources.FindObjectsOfTypeAll<WeaponPickUp>()[0]).gameObject;
			foreach (Transform item in gameObject.transform)
			{
				Transform val5 = item;
				Object.Destroy((Object)(object)((Component)val5).gameObject);
			}
			Object.Destroy((Object)(object)gameObject.GetComponent<Animator>());
			Transform val6 = val.transform.Find("CrossbowPickup");
			val6.SetParent(gameObject.transform);
			val6.localPosition = Vector3.zero;
			val6.localRotation = Quaternion.identity;
			val6.localScale = new Vector3(6.6666665f, 6.6666665f, 5f);
			Traverse field = Traverse.Create((object)gameObject.GetComponent<WeaponPickUp>()).Field("weapon");
			Utils.SetAssRefField(MetaDatabase.resources.crossbow[0], field);
			HudMessage[] array3 = Resources.FindObjectsOfTypeAll<HudMessage>();
			HudMessage[] array4 = array3;
			foreach (HudMessage val7 in array4)
			{
				if (((Object)((Component)val7).gameObject).name == "Cube (3)")
				{
					val7.message = "<color=#00ffff>CROSSBOW</color>: Secondary fire's smokestream also ignites projectiles";
				}
				else if (((Object)((Component)((Component)val7).transform.parent).gameObject).name == "Spot Light")
				{
					val7.message = "<color=#00ffff>CROSSBOW</color>: Press '<color=orange>";
					val7.message2 = "</color>' to launch an ignited stake that fires a flaming stream of smoke.";
				}
			}
			Transform val8 = val3.Find("NeoBreakable");
			Object.Destroy((Object)(object)((Component)val8.Find("NeoBreakable (1)")).gameObject);
			Object.Destroy((Object)(object)((Component)val8.Find("Plane")).gameObject);
			Object.Destroy((Object)(object)((Component)val8.Find("Quad (1)")).gameObject);
			Object.Destroy((Object)(object)((Component)val8).GetComponent<Breakable>());
			Object.Destroy((Object)(object)((Component)val8).GetComponent<BoxCollider>());
			foreach (Transform item2 in val8.Find("GameObject"))
			{
				Transform val9 = item2;
				if (!(((Object)((Component)val9).gameObject).name == "Cube"))
				{
					Object.Destroy((Object)(object)((Component)val9).gameObject);
				}
			}
			Transform val10 = val.transform.Find("LegaBreaker");
			val10.parent = val8;
			((Component)val10).transform.localPosition = Vector3.zero;
			((Component)val10).transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
		}
	}
	public static class GMuseum
	{
		public static void RollCredits()
		{
			GameObject val = Utils.LoadAndInstantiateStage("m");
		}
	}
	public static class G05
	{
		[StageAddon(5, true)]
		public static void Cerberus()
		{
		}
	}
	public static class G01
	{
		[StageAddon(1, true)]
		public static void IntoTheFire()
		{
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			if ((Object)(object)V62.heresyEndCanvas != (Object)null)
			{
				Object.Destroy((Object)(object)V62.heresyEndCanvas);
			}
			ObjectActivator[] components = GameObject.Find("Credits 1").GetComponents<ObjectActivator>();
			ObjectActivator[] components2 = GameObject.Find("Credits 2").GetComponents<ObjectActivator>();
			components[0].events.toActivateObjects = components2[0].events.toActivateObjects;
			components[1].events.toDisActivateObjects = components2[1].events.toDisActivateObjects;
			GameObject gameObject = components2[0].events.toActivateObjects[0].gameObject;
			GameObject val = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
			((TMP_Text)val.GetComponentInChildren<TextMeshProUGUI>()).text = "A <color=orange>SPECIAL EDITION</color> BY ETHAN \"<color=orange>MARANARA</color>\" MARA";
			components2[0].events.toActivateObjects = (GameObject[])(object)new GameObject[1] { val };
			components2[1].events.toDisActivateObjects = components2[0].events.toActivateObjects;
			GameObject gameObject2 = ((Component)Utils.LoadAndInstantiateStage("01").transform.GetChild(0)).gameObject;
			Transform transform = GameObject.Find("RevolverPickUp").transform;
			((Component)transform).GetComponent<BoxCollider>().size = new Vector3(2f, 2f, 5.5f);
			((Component)transform.GetChild(0)).gameObject.SetActive(false);
			gameObject2.transform.SetParent(transform, true);
			GameObject gameObject3 = ((Component)Object.FindObjectOfType<OptionsMenuToManager>()).gameObject;
			foreach (Transform item in gameObject3.transform)
			{
				Transform val2 = item;
				Utils.Log(((Object)((Component)val2).gameObject).name);
			}
			Transform child = gameObject3.transform.GetChild(3);
			child = child.GetChild(2);
			child = child.GetChild(0);
			((Component)child).GetComponent<Image>().sprite = MetaDatabase.resources.logo;
		}
	}
	public static class PreludeTips
	{
		[TipOfTheDay("Endless")]
		public static string Cybergrind = "If blown too far off the arena, <color=#00FFFF>JUSTICE's</color> secondary fire is a good way to get back.";

		[TipOfTheDay(2)]
		public static string PreludeFirst = "While the SWORD's primary swing fires projectiles, it also serves as a <color=orange>melee attack</color> that <color=orange>deals extra damage</color> to close enemies.";

		[TipOfTheDay(3)]
		public static string PreludeSecond = "You can cancel JUSTICE's secondary fire <color=orange>with Jump</color>, <color=orange>Slide</color> or your <color=orange>primary fire</color>.\n\nWhen cancelled, you <color=orange>pertain the momentum granted</color> by the secondary fire.";

		[TipOfTheDay(4)]
		public static string PreludeThird = "MAGIC'S RED'S secondary fire, after piercing the environment, can be <color=orange>punched</color> to cause a <color=orange>large explosion</color>.";

		[TipOfTheDay(5)]
		public static string PreludeCerberus = "GLITTERFREEZE's secondary stake can be <color=orange>parried</color> while or after leeching off of an enemy.\n\nUse this to <color=orange>chain together multiple attacks</color> with one stake.";

		[TipOfTheDay(11)]
		public static string EarlyAccess = "<color=red>Y O U ' R E   N O T\nS U P P O S E D   T O   B E   H E R E .</color>";
	}
	public static class V53
	{
		[StageAddon(53, false)]
		public static void ShipSecret()
		{
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			GameObject val = Utils.LoadAndInstantiateStage("53");
			GameObject gabeHologram = null;
			GameObject upsideDownHologram = null;
			GameObject upsideDownGlass = null;
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			ObjectActivator component = ((Component)val.transform.Find("UnrotatedSecret").Find("SecretRoom").Find("ElectricityBox")
				.Find("Breakable")).gameObject.GetComponent<Breakable>().activateOnBreak[1].GetComponent<ObjectActivator>();
			((Component)component).gameObject.transform.parent = null;
			GameObject[] array2 = array;
			foreach (GameObject val2 in array2)
			{
				if (((Object)val2).name == "Unrotated")
				{
					Transform val3 = val2.transform.Find("5 - Hologram Room");
					gabeHologram = ((Component)val3.Find("5 Nonstuff").Find("Decorations").Find("Hologram")).gameObject;
					val.transform.parent = val3.Find("5 Stuff");
					val.SetActive(true);
					Transform val4 = val3.Find("5 Nonstuff").Find("Walls");
					((Component)val4.GetChild(2)).gameObject.SetActive(false);
					((Component)val4.GetChild(8)).gameObject.SetActive(false);
				}
				else if (((Object)val2).name == "Rotated")
				{
					Transform val5 = val2.transform.Find("5 - Hologram Room");
					upsideDownGlass = ((Component)val5.Find("5 Stuff").Find("Glasscase")).gameObject;
					upsideDownHologram = ((Component)val5.Find("5 Nonstuff").Find("Decorations").Find("Hologram Master")).gameObject;
				}
			}
			MonoSingleton<CameraController>.Instance.cam.useOcclusionCulling = false;
			component.events.onActivate.AddListener((UnityAction)delegate
			{
				FinalizeShip(gabeHologram, upsideDownHologram, upsideDownGlass);
			});
		}

		public static void FinalizeShip(GameObject hologram1, GameObject hologram2, GameObject glass)
		{
			hologram1.SetActive(false);
			hologram2.SetActive(false);
			((Component)hologram2.transform.GetChild(0)).gameObject.SetActive(false);
			((Component)hologram2.transform.GetChild(1)).gameObject.SetActive(false);
			glass.SetActive(false);
			ProphetProgress prophetProgress = Utils.ReadSaveSlot();
			prophetProgress.wrathSwitch3 = true;
			Utils.WriteSaveSlot(prophetProgress);
		}
	}
	public static class V52
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__0_0;

			internal void <OceanSecret>b__0_0()
			{
				ProphetProgress prophetProgress = Utils.ReadSaveSlot();
				prophetProgress.wrathSwitch2 = true;
				Utils.WriteSaveSlot(prophetProgress);
			}
		}

		[StageAddon(52, false)]
		public static void OceanSecret()
		{
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			GameObject val = Utils.LoadAndInstantiateStage("52");
			((Component)val.transform.Find("LighthouseIndoors")).transform.parent = GameObject.Find("GlobalLights (3)").transform.Find("Cabin Interiors");
			Transform transform = ((Component)GameObject.Find("OutdoorsObjects").transform.Find("Lighthouse")).transform;
			((Component)transform.Find("Tower").Find("Cylinder (1)")).gameObject.SetActive(false);
			((Component)transform.Find("Island")).gameObject.SetActive(false);
			GameObject gameObject = ((Component)transform.Find("House")).gameObject;
			((Renderer)gameObject.GetComponent<MeshRenderer>()).enabled = false;
			((Collider)gameObject.GetComponent<BoxCollider>()).enabled = false;
			((Component)gameObject.transform.Find("LargeDoorSmallest Variant (1)")).gameObject.SetActive(false);
			((Component)gameObject.transform.GetChild(0)).gameObject.SetActive(false);
			MonoSingleton<CameraController>.Instance.cam.useOcclusionCulling = false;
			UnityEvent onActivate = ((Component)val.transform.Find("InsideHouse").Find("Shop").Find("Canvas")
				.Find("Main Menu")
				.Find("obac")).gameObject.GetComponent<ObjectActivator>().events.onActivate;
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				UnityAction val2 = delegate
				{
					ProphetProgress prophetProgress = Utils.ReadSaveSlot();
					prophetProgress.wrathSwitch2 = true;
					Utils.WriteSaveSlot(prophetProgress);
				};
				<>c.<>9__0_0 = val2;
				obj = (object)val2;
			}
			onActivate.AddListener((UnityAction)obj);
		}
	}
	public static class V51
	{
		private static DisableEnemySpawns floodSpawnDisabler;

		[StageAddon(51, false)]
		public static void FloodSecret()
		{
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			GameObject val = Utils.LoadAndInstantiateStage("51");
			List<Light> lights = new List<Light>();
			List<MeshRenderer> emissiveObjects = new List<MeshRenderer>();
			GameObject gameObject = ((Component)val.transform.Find("EmergencyPower")).gameObject;
			gameObject.SetActive(false);
			lights.AddRange(val.GetComponentsInChildren<Light>());
			Transform val2 = null;
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			GameObject[] array2 = array;
			foreach (GameObject val3 in array2)
			{
				if (((Object)val3).name == "3 - Sentry Entry")
				{
					Transform val4 = val3.transform.Find("3 Nonstuff");
					val2 = val3.transform.Find("3 Stuff");
					((Component)val4.Find("Lights").GetChild(0)).gameObject.SetActive(false);
					((Component)val4.Find("Walls").GetChild(21)).gameObject.SetActive(false);
					((Component)val4.Find("Walls").Find("Cube (6)")).gameObject.SetActive(false);
					lights.AddRange(val3.GetComponentsInChildren<Light>(true));
					emissiveObjects.AddRange(val3.GetComponentsInChildren<MeshRenderer>(true));
				}
				if (((Object)val3).name == "4 - Water Processing Chamber")
				{
					lights.AddRange(val3.GetComponentsInChildren<Light>(true));
					emissiveObjects.AddRange(val3.GetComponentsInChildren<MeshRenderer>(true));
				}
			}
			ObjectActivator componentInChildren = val.GetComponentInChildren<ObjectActivator>(true);
			componentInChildren.events.onActivate.AddListener((UnityAction)delegate
			{
				FinalizeFlood(lights.ToArray(), emissiveObjects.ToArray());
			});
			MonoSingleton<CameraController>.Instance.cam.useOcclusionCulling = false;
		}

		private static void FinalizeFlood(Light[] lights, MeshRenderer[] grids)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			Utils.Log("Reading Progress...");
			ProphetProgress prophetProgress = Utils.ReadSaveSlot();
			Utils.Log($"Is Progress Null? {prophetProgress == null}");
			prophetProgress.wrathSwitch1 = true;
			Utils.Log($"Setting Progress {prophetProgress == null}");
			Utils.WriteSaveSlot(prophetProgress);
			Utils.Log($"Progress Over {prophetProgress == null}");
			DisableEnemySpawns val = new DisableEnemySpawns();
			val.Enable();
			floodSpawnDisabler = val;
			SceneManager.sceneUnloaded += DisableFloodCheat;
			try
			{
				Transform val2 = GameObject.Find("3 - Sentry Entry").transform.Find("3 Stuff(Clone)");
				if ((Object)(object)((Component)val2.Find("Trigger")).gameObject.GetComponent<ActivateArena>() != (Object)null)
				{
					((Component)val2.Find("Trigger")).gameObject.SetActive(false);
				}
				else
				{
					GameObject gameObject = ((Component)val2.Find("Enemies")).gameObject;
					if (Object.op_Implicit((Object)(object)gameObject))
					{
						ActivateNextWave component = gameObject.GetComponent<ActivateNextWave>();
						if (Object.op_Implicit((Object)(object)component))
						{
							component.EndWaves();
						}
						gameObject.SetActive(false);
					}
				}
			}
			catch
			{
			}
			Transform val3 = GameObject.Find("Tunnel Final (1)").transform.Find("Tunnel A");
			try
			{
				((Component)val3.Find("Tunnel Light")).gameObject.SetActive(false);
				((Component)val3.Find("Door Light")).gameObject.SetActive(false);
			}
			catch
			{
			}
			try
			{
				GameObject gameObject2 = ((Component)val3.Find("CircularDoor (A)")).gameObject;
				((Component)gameObject2.transform.Find("NoPass")).gameObject.SetActive(false);
				((Component)gameObject2.transform.Find("Opener")).gameObject.SetActive(false);
				gameObject2.GetComponent<Door>().LockClose();
				gameObject2.GetComponent<Door>().Lock();
				((Renderer)((Component)gameObject2.transform.Find("CircularDoorObject")).gameObject.GetComponent<MeshRenderer>()).materials[0].SetFloat("_EmissiveIntensity", 0f);
			}
			catch
			{
			}
			try
			{
				GameObject val4 = GameObject.Find("CircularDoor");
				((Renderer)((Component)val4.transform.Find("CircularDoorObject")).gameObject.GetComponent<MeshRenderer>()).materials[0].SetFloat("_EmissiveIntensity", 0f);
			}
			catch
			{
			}
			foreach (Light val5 in lights)
			{
				if ((Object)(object)val5 != (Object)null)
				{
					val5.intensity = 0f;
				}
			}
			foreach (MeshRenderer val6 in grids)
			{
				if ((Object)(object)val6 == (Object)null)
				{
					continue;
				}
				Material[] materials = ((Renderer)val6).materials;
				foreach (Material val7 in materials)
				{
					if (((Object)val7).name.Contains("LaserGrid"))
					{
						((Component)val6).gameObject.SetActive(false);
					}
					val7.SetFloat("_EmissiveIntensity", 0f);
				}
			}
			RenderSettings.fog = false;
		}

		private static void DisableFloodCheat(Scene arg0)
		{
			Utils.Log("Disable cehets :)");
			floodSpawnDisabler.Disable();
			SceneManager.sceneUnloaded -= DisableFloodCheat;
		}
	}
	public static class V62
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__1_0;

			internal void <Initialize>b__1_0()
			{
				FinalizeScene();
			}
		}

		private static DisableEnemySpawns enemyDisabler;

		private static GameObject heresyNailPrefab;

		public static GameObject heresyEndCanvas;

		private static AssetBundle heresyEmptyScene;

		[StageAddon(62, false)]
		public static void Initialize()
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			Debug.Log((object)"Blarg");
			if ((Object)(object)heresyEmptyScene != (Object)null)
			{
				return;
			}
			GameObject val = Utils.LoadAndInstantiateStage("62");
			ObjectActivator component = ((Component)val.transform.Find("UnlockRoom").Find("Stabber")).GetComponent<ObjectActivator>();
			heresyEndCanvas = ((Component)val.transform.Find("Canvas")).gameObject;
			heresyNailPrefab = ((Component)val.transform.Find("UnlockRoom").Find("Attack").Find("ProphetEnterSequence")
				.Find("Nail")).gameObject;
			heresyNailPrefab.GetComponent<AudioSource>().playOnAwake = true;
			heresyNailPrefab.gameObject.SetActive(false);
			component.events.onActivate = new UnityEvent();
			component.events.onActivate.AddListener(new UnityAction(LockPlayer));
			ObjectActivator component2 = ((Component)heresyEndCanvas.transform.Find("Intro").Find("LoadSlotOBA")).GetComponent<ObjectActivator>();
			component2.events.onActivate = new UnityEvent();
			component2.events.onActivate.AddListener(new UnityAction(EnterGabriel));
			ObjectActivator componentInChildren = ((Component)val.transform.Find("Electric Gate").Find("ActivateKey")).GetComponentInChildren<ObjectActivator>(true);
			componentInChildren.events.onActivate.AddListener(new UnityAction(StartCheats));
			UnityEvent onFullyOpened = ((Component)GameObject.Find("FirstRoom").transform.Find("Room").Find("FinalDoor")).GetComponent<FinalDoor>().doors[0].onFullyOpened;
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				UnityAction val2 = delegate
				{
					FinalizeScene();
				};
				<>c.<>9__1_0 = val2;
				obj = (object)val2;
			}
			onFullyOpened.AddListener((UnityAction)obj);
		}

		private static void EndCheats(Scene arg0)
		{
			enemyDisabler.Disable();
			SceneManager.sceneUnloaded -= EndCheats;
		}

		private static void StartCheats()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			DisableEnemySpawns val = new DisableEnemySpawns();
			val.Enable();
			enemyDisabler = val;
			SceneManager.sceneUnloaded += EndCheats;
		}

		public static void FinalizeScene()
		{
			Transform transform = GameObject.Find("1 - Entryway").transform;
			Transform val = transform.Find("Platforming");
			Transform val2 = val.Find("Walls");
			((Component)val2.Find("Cube (8)")).gameObject.SetActive(false);
		}

		public static void LockPlayer()
		{
			MonoSingleton<OptionsMenuToManager>.Instance.opm.inIntro = true;
			MonoSingleton<NewMovement>.Instance.StopSlide();
			MonoSingleton<NewMovement>.Instance.StopMovement();
			MonoSingleton<NewMovement>.Instance.LockMovementAxes();
			MonoSingleton<NewMovement>.Instance.modNoJump = true;
			MonoSingleton<NewMovement>.Instance.modNoDashSlide = true;
			MonoSingleton<NewMovement>.Instance.rb.constraints = (RigidbodyConstraints)126;
			heresyEndCanvas.transform.parent = null;
			Object.DontDestroyOnLoad((Object)(object)heresyEndCanvas);
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(HeresySequence());
		}

		private static IEnumerator HeresySequence()
		{
			Vector3 euler = Vector3.zero;
			euler.y = ((Component)MonoSingleton<CameraController>.Instance).transform.eulerAngles.y;
			Quaternion cameraRot = Quaternion.Euler(euler);
			Vector3 cameraPos = ((Component)MonoSingleton<CameraController>.Instance).transform.position;
			Vector3 startPos = new Vector3(0f, -6.95f, 12.03f);
			Vector3 endPos12 = new Vector3(0f, -4.34f, 7.5f);
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			try
			{
				MonoSingleton<GunSetter>.Instance.forcedLoadout = new ForcedLoadout();
				MonoSingleton<GunSetter>.Instance.ResetWeapons(false);
			}
			catch
			{
			}
			yield return (object)new WaitForSeconds(5f);
			startPos.x = -3.1f;
			startPos.z = -1.9f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			yield return (object)new WaitForSeconds(0.1f);
			startPos.x = 4.65f;
			startPos.y = -4.85f;
			startPos.z = -1.51f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			yield return (object)new WaitForSeconds(0.05f);
			startPos.x = -2.3f;
			startPos.y = 4.64f;
			startPos.z = 6.44f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			startPos.x = 2.56f;
			startPos.y = 4.64f;
			startPos.z = 8.03f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			startPos.x = 0.37f;
			startPos.y = 4.64f;
			startPos.z = 0.93f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			yield return (object)new WaitForSeconds(0.3f);
			startPos.x = -6.45f;
			startPos.y = -3.97f;
			startPos.z = 5.73f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			startPos.y = -0.93f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			startPos.y = 1.92f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			yield return (object)new WaitForSeconds(0.1f);
			startPos.x = 6.99f;
			startPos.y = -4.77f;
			startPos.z = 5.73f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			startPos.y = -1.73f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			startPos.y = 1.12f;
			endPos12 = startPos;
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(NailPierce(cameraPos, cameraRot, startPos, endPos12, 0.07f));
			((MonoBehaviour)ThreadingHelper.Instance).StartCoroutine(FadeOutAndIn());
			yield return (object)new WaitForSeconds(5f);
			((Component)MonoSingleton<CameraController>.Instance).gameObject.SetActive(false);
			heresyEmptyScene = AssetBundle.LoadFromFile(Path.Combine(Utils.PackedPath, "empty.lvl"));
			SceneManager.LoadScene(heresyEmptyScene.GetAllScenePaths()[0]);
			heresyEndCanvas.gameObject.SetActive(true);
		}

		private static IEnumerator FadeOutAndIn()
		{
			float i = AudioListener.volume;
			float max = 5f;
			float t = max;
			while (t > 0f)
			{
				AudioListener.volume = t / max * i;
				t -= Time.deltaTime;
				yield return (object)new WaitForEndOfFrame();
			}
			while (t < max)
			{
				AudioListener.volume = t / max * i;
				t += Time.deltaTime;
				yield return (object)new WaitForEndOfFrame();
			}
			AudioListener.volume = i;
		}

		private static IEnumerator NailPierce(Vector3 cameraPos, Quaternion cameraRot, Vector3 startPos, Vector3 endPos, float speed)
		{
			//IL_00