Decompiled source of Powerfully Slow Moon v1.4.2

PowerfullySlowMoon.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.LunarTeleporter;
using EntityStates.Missions.BrotherEncounter;
using HG;
using InLobbyConfig;
using InLobbyConfig.Fields;
using Microsoft.CodeAnalysis;
using On.EntityStates.BrotherMonster;
using On.EntityStates.LunarTeleporter;
using On.EntityStates.Missions.BrotherEncounter;
using On.RoR2;
using On.RoR2.Achievements;
using RoR2;
using RoR2.Achievements;
using RoR2.AsyncManagement;
using RoR2.CharacterSpeech;
using RoR2.Networking;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PowerfullySlowMoon")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2168c81e68a0768579e725909bbd593834a653b8")]
[assembly: AssemblyProduct("PowerfullySlowMoon")]
[assembly: AssemblyTitle("PowerfullySlowMoon")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PowerfullySlow
{
	[BepInPlugin("xyz.yekoc.PowerfullySlow", "Powerfully Slow Moon", "1.4.2")]
	[BepInIncompatibility("com.xoxfaby.UnlockAll")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class PowerfullySlowPlugin : BaseUnityPlugin
	{
		public static ConfigEntry<bool> frogger;

		internal bool hookSet = false;

		internal static bool froggy = false;

		internal static GameObject frogPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/moon/FrogInteractable.prefab").WaitForCompletion();

		public static ConfigEntry<int> repeatChance { get; set; }

		private void Awake()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			repeatChance = ((BaseUnityPlugin)this).Config.Bind<int>("Configuration", "Repeat Chance", 100, "Percent Chance of runs past first completion repeating old moon. Type:Int,Default:0,Max:100");
			frogger = ((BaseUnityPlugin)this).Config.Bind<bool>("Configuration", "Frog, My Dudes", true, "Whether a glass frog is spawned in the boss area after fights on repeat runs of old moon. Does nothing on new moon or on the first, non-repeat, old moon run. Type:Bool,Default:True");
			repeatChance.Value = Math.Min(Math.Max(repeatChance.Value, 0), 100);
			if (Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.InLobbyConfig"))
			{
				HandleLobbyConfigCompat();
			}
			Stage.onStageStartGlobal += Stage_onStageStartGlobal;
			Run.onRunStartGlobal += Run_onRunStartGlobal;
			BaseEndingAchievement.OnInstall += new hook_OnInstall(BaseEndingAchievement_OnInstall);
			BaseEndingAchievement.OnUninstall += new hook_OnUninstall(BaseEndingAchievement_OnUninstall);
			PreEncounter.OnExit += new hook_OnExit(PreEncounterOnExit);
			EncounterFinished.OnEnter += new hook_OnEnter(AttemptEncounterFinishedOnEnter);
			Phase1.PreEncounterBegin += new hook_PreEncounterBegin(Phase1_EnableKarmaSkybox);
			BrotherEncounterPhaseBaseState.UpdateSkyboxColor += new hook_UpdateSkyboxColor(UpdateSkyboxReplacement);
			BossDeath.OnEnter += new hook_OnEnter(BossDeath_DisableKarmaSkybox);
			Phase2.PreEncounterBegin += new hook_PreEncounterBegin(Phase2_BrotherThroneSpawn);
			EscapeSequenceController.OnEnable += new hook_OnEnable(RemoveMegaDrones);
			EnterSkyLeap.AttemptFireSkyLeapBombsAuthority += new hook_AttemptFireSkyLeapBombsAuthority(EnterSkyLeap_AttemptFireSkyLeapBombsAuthority);
		}

		private void EnterSkyLeap_AttemptFireSkyLeapBombsAuthority(orig_AttemptFireSkyLeapBombsAuthority orig, EnterSkyLeap self)
		{
			//IL_003a: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b8: 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)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			if (!IsMoon1())
			{
				orig.Invoke(self);
			}
			else
			{
				if (KarmaManager.instance.GetEffectiveKarma() < EnterSkyLeap.requiredKarmaForSkyLeapBombs)
				{
					return;
				}
				FireProjectileInfo val = new FireProjectileInfo
				{
					procChainMask = default(ProcChainMask),
					projectilePrefab = EntityStateGameObject.op_Implicit(EnterSkyLeap.skyLeapBombPrefab),
					damage = ((EntityState)self).characterBody.damage,
					damageTypeOverride = new DamageTypeCombo
					{
						damageType = (DamageType)4194304
					},
					crit = ((EntityState)self).characterBody.RollCrit(),
					owner = ((Component)((EntityState)self).characterBody).gameObject,
					rotation = Quaternion.identity,
					useFuseOverride = true
				};
				int num = BrotherKarmaUtils.ArenaCardinalPositions.Length;
				for (int i = 0; i < num; i++)
				{
					string safe = ArrayUtils.GetSafe<string>(BrotherKarmaUtils.ArenaCardinalPositions, i);
					Transform val2 = ((EntityState)self).GetModelChildLocator().FindChild(safe);
					if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)SceneInfo.instance))
					{
						continue;
					}
					ChildLocator component = ((Component)SceneInfo.instance).GetComponent<ChildLocator>();
					Transform val3 = null;
					if (Object.op_Implicit((Object)(object)component))
					{
						val3 = component.FindChild("ArenaCenter");
					}
					if (Object.op_Implicit((Object)(object)val3))
					{
						Vector3 val4 = ((Component)val3).transform.position;
						switch (safe)
						{
						case "Arena+Z":
							val4 += new Vector3(0f, 0f, 95f);
							break;
						case "Arena-Z":
							val4 -= new Vector3(0f, 0f, 95f);
							break;
						case "Arena+X":
							val4 += new Vector3(95f, 0f, 0f);
							break;
						case "Arena-X":
							val4 -= new Vector3(95f, 0f, 0f);
							break;
						}
						FireProjectileInfo val5 = val;
						val5.position = val4 + EnterSkyLeap.skyLeapBombHeightOffset * Vector3.up;
						((FireProjectileInfo)(ref val5)).fuseOverride = self.duration + HoldSkyLeap.duration + EnterSkyLeap.extraFusePerSkyLeapBomb * (float)(i + 1);
						ProjectileManager.instance.FireProjectile(val5);
					}
				}
			}
		}

		private void RemoveMegaDrones(orig_OnEnable orig, EscapeSequenceController self)
		{
			orig.Invoke(self);
			if (!IsMoon1())
			{
				return;
			}
			Transform val = ((Component)self).transform.Find("EscapeSequenceObjects");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			for (int i = 0; i < val.childCount; i++)
			{
				Transform child = val.GetChild(i);
				if (Object.op_Implicit((Object)(object)child) && ((Object)((Component)child).gameObject).name == "SpawnMegaDroneMaster")
				{
					GenericSceneSpawnPoint component = ((Component)child).gameObject.GetComponent<GenericSceneSpawnPoint>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Object.Destroy((Object)(object)component);
					}
				}
			}
		}

		public bool IsMoon1()
		{
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			return Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && sceneDefForCurrentScene.baseSceneName == "moon";
		}

		private void Phase2_BrotherThroneSpawn(orig_PreEncounterBegin orig, Phase2 self)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_009c: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			Transform val = ((BrotherEncounterBaseState)self).childLocator.FindChild("ThroneSpawnPoint");
			if (Object.op_Implicit((Object)(object)val))
			{
				orig.Invoke(self);
			}
			else
			{
				if (!IsMoon1() || !NetworkServer.active)
				{
					return;
				}
				Transform val2 = ((BrotherEncounterBaseState)self).childLocator.FindChild("CenterOfArena");
				if (!Object.op_Implicit((Object)(object)val2))
				{
					return;
				}
				Vector3 position = ((Component)val2).transform.position + 25f * Vector3.up;
				DirectorSpawnRequest val3 = new DirectorSpawnRequest((SpawnCard)(object)Phase2.brotherThroneSpawnCard, new DirectorPlacementRule
				{
					placementMode = (PlacementMode)0,
					position = position
				}, Run.instance.spawnRng);
				val3.teamIndexOverride = (TeamIndex)2;
				val3.ignoreTeamMemberLimit = true;
				self.brotherThroneInstance = DirectorCore.instance.TrySpawnObject(val3);
				CharacterMaster component = self.brotherThroneInstance.GetComponent<CharacterMaster>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (EntityStateGameObject.op_Implicit(((BrotherEncounterPhaseBaseState)self).speechControllerPrefab))
					{
						Object.Instantiate<GameObject>(((BrotherEncounterPhaseBaseState)self).speechControllerPrefab.gameObject, ((Component)component).transform).GetComponent<CharacterSpeechController>().characterMaster = component;
					}
					component.inventory.GiveItemPermanent(Items.Karma, 1);
					component.onBodyStart += delegate(CharacterBody body)
					{
						body.AddBuff(Buffs.BrotherThroneShield);
					};
				}
			}
		}

		private SkyboxReplacementHolder GetSkyboxReplacement(EntityState self, ChildLocator childLocator)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			SkyboxReplacementHolder skyboxReplacementHolder = self.gameObject.GetComponent<SkyboxReplacementHolder>();
			if (!Object.op_Implicit((Object)(object)skyboxReplacementHolder))
			{
				skyboxReplacementHolder = self.gameObject.AddComponent<SkyboxReplacementHolder>();
			}
			if (!Object.op_Implicit((Object)(object)skyboxReplacementHolder.skyboxInstance))
			{
				Transform val = childLocator.FindChild("CenterOfArena");
				if (Object.op_Implicit((Object)(object)val))
				{
					GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"3bbc3e3861eca16429c4bd1eaf0954f5").WaitForCompletion();
					GameObject val3 = Object.Instantiate<GameObject>(val2);
					val3.transform.SetParent(val, false);
					val3.transform.localPosition = new Vector3(0f, 33.9f, 0f);
					val3.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
					val3.transform.localScale = new Vector3(109.4335f, 109.4335f, 126.4203f);
					skyboxReplacementHolder.skyboxInstance = val3;
					val3.SetActive(false);
				}
			}
			return skyboxReplacementHolder;
		}

		private void Phase1_EnableKarmaSkybox(orig_PreEncounterBegin orig, Phase1 self)
		{
			//IL_00e5: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			bool flag = false;
			ChildLocator component = ((EntityState)self).GetComponent<ChildLocator>();
			if (IsMoon1() && Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)component.FindChild("SkyboxReplacement")))
			{
				flag = true;
			}
			if (!flag)
			{
				orig.Invoke(self);
				return;
			}
			try
			{
				orig.Invoke(self);
			}
			catch (NullReferenceException)
			{
				Debug.Log((object)"PowerfullySlowMoon: Phase1_EnableKarmaSkybox caught vanilla exception, running our code now!");
				SkyboxReplacementHolder skyboxReplacement = GetSkyboxReplacement((EntityState)(object)self, component);
				if (Object.op_Implicit((Object)(object)skyboxReplacement) && Object.op_Implicit((Object)(object)skyboxReplacement.skyboxInstance) && KarmaManager.instance.GetEffectiveKarma() >= BrotherEncounterPhaseBaseState.requiredKarmaForSkyboxChange)
				{
					skyboxReplacement.skyboxInstance.SetActive(true);
				}
				Transform val = component.FindChild("CenterOrbEffect");
				if (Object.op_Implicit((Object)(object)val))
				{
					EffectManager.SpawnEffect(EntityStateGameObject.op_Implicit(Phase1.centerOrbDestroyEffect), new EffectData
					{
						origin = val.position
					}, false);
				}
			}
		}

		private void UpdateSkyboxReplacement(orig_UpdateSkyboxColor orig, BrotherEncounterPhaseBaseState self)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BrotherEncounterBaseState)self).childLocator.FindChild("SkyboxReplacement");
			if (IsMoon1() && !Object.op_Implicit((Object)(object)val))
			{
				SkyboxReplacementHolder skyboxReplacement = GetSkyboxReplacement((EntityState)(object)self, ((BrotherEncounterBaseState)self).childLocator);
				if (Object.op_Implicit((Object)(object)skyboxReplacement) && Object.op_Implicit((Object)(object)skyboxReplacement.skyboxInstance) && skyboxReplacement.skyboxInstance.activeInHierarchy)
				{
					LerpTowardsColor component = skyboxReplacement.skyboxInstance.GetComponent<LerpTowardsColor>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.ResetAndTransitionToNewColor(self.skyboxColor);
					}
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void BossDeath_DisableKarmaSkybox(orig_OnEnter orig, BossDeath self)
		{
			bool flag = false;
			ChildLocator component = ((EntityState)self).GetComponent<ChildLocator>();
			if (IsMoon1() && Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)component.FindChild("SkyboxReplacement")))
			{
				flag = true;
			}
			if (!flag)
			{
				orig.Invoke(self);
				return;
			}
			try
			{
				orig.Invoke(self);
			}
			catch (NullReferenceException)
			{
				Debug.Log((object)"PowerfullySlowMoon: BossDeath_DisableKarmaSkybox caught vanilla exception, running our code now!");
				SkyboxReplacementHolder skyboxReplacement = GetSkyboxReplacement((EntityState)(object)self, component);
				if (Object.op_Implicit((Object)(object)skyboxReplacement) && Object.op_Implicit((Object)(object)skyboxReplacement.skyboxInstance))
				{
					skyboxReplacement.skyboxInstance.SetActive(false);
				}
			}
		}

		private void Run_onRunStartGlobal(Run run)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			SceneCatalog.GetSceneDefFromSceneName("moon").sceneType = (SceneType)1;
			if (!hookSet && NetworkServer.active && Util.CheckRoll((float)repeatChance.Value, 0f, (CharacterMaster)null))
			{
				Active.OnEnter += new hook_OnEnter(EmpowerMoon);
				froggy = frogger.Value;
				Run.onRunDestroyGlobal += Cleanup;
			}
			void Cleanup(Run val)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				Active.OnEnter -= new hook_OnEnter(EmpowerMoon);
				Run.onRunDestroyGlobal -= Cleanup;
			}
		}

		private void Stage_onStageStartGlobal(Stage obj)
		{
			//IL_002e: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			if (IsMoon1())
			{
				GameObject val = GameObject.Find("ShrineRestack");
				if (Object.op_Implicit((Object)(object)val))
				{
					val.transform.position = new Vector3(val.transform.position.x, 211.8f, val.transform.position.z);
				}
			}
		}

		private void BaseEndingAchievement_OnInstall(orig_OnInstall orig, BaseEndingAchievement self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			orig.Invoke(self);
			if (((object)self).GetType() == typeof(CompleteMainEndingAchievement))
			{
				Active.OnEnter += new hook_OnEnter(EmpowerMoon);
				hookSet = true;
			}
		}

		private void BaseEndingAchievement_OnUninstall(orig_OnUninstall orig, BaseEndingAchievement self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			orig.Invoke(self);
			if (((object)self).GetType() == typeof(CompleteMainEndingAchievement))
			{
				Active.OnEnter -= new hook_OnEnter(EmpowerMoon);
				hookSet = false;
			}
		}

		private void PreEncounterOnExit(orig_OnExit orig, PreEncounter self)
		{
			if (IsMoon1())
			{
				((Component)self.childLocator.FindChild("PreEncounter")).gameObject.SetActive(false);
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void AttemptEncounterFinishedOnEnter(orig_OnEnter orig, EncounterFinished self)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_0147: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			try
			{
				orig.Invoke(self);
			}
			catch (Exception)
			{
				Debug.Log((object)"PowerfullySlowMoon: AttemptEncounterFinishedOnEnter caught vanilla exception, running our code now!");
				if (!IsMoon1())
				{
					return;
				}
				((BrotherEncounterBaseState)self).childLocator = ((EntityState)self).GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)((BrotherEncounterBaseState)self).childLocator))
				{
					Transform val = ((BrotherEncounterBaseState)self).childLocator.FindChild("ArenaWalls");
					Transform val2 = ((BrotherEncounterBaseState)self).childLocator.FindChild("ArenaNodes");
					if (Object.op_Implicit((Object)(object)val))
					{
						((Component)val).gameObject.SetActive(false);
					}
					if (Object.op_Implicit((Object)(object)val2))
					{
						((Component)val2).gameObject.SetActive(false);
					}
				}
				if (froggy)
				{
					Transform val3 = ((BrotherEncounterBaseState)self).childLocator.FindChild("CenterOrbEffect");
					Vector3 val4 = default(Vector3);
					((Vector3)(ref val4))..ctor(0f, 0f, 5f);
					GameObject val5 = Object.Instantiate<GameObject>(frogPrefab, val3.position + val4, Quaternion.identity);
					PickupIndex pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)3);
					Highlight[] componentsInChildren = val5.GetComponentsInChildren<Highlight>();
					foreach (Highlight val6 in componentsInChildren)
					{
						val6.pickupIndex = pickupIndex;
						val6.highlightColor = (HighlightColor)2;
						val6.isOn = true;
					}
					val5.AddComponent<Light>().color = ((PickupIndex)(ref pickupIndex)).GetPickupColor();
					if (NetworkServer.active)
					{
						NetworkServer.Spawn(val5);
					}
					EffectManager.SpawnEffect(AssetReferences.fragileDamageBonusBreakEffectPrefab, new EffectData
					{
						origin = val3.position + val4
					}, false);
				}
			}
		}

		internal void EmpowerMoon(orig_OnEnter orig, Active self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				((LunarTeleporterBaseState)self).teleporterInteraction.sceneExitController.destinationScene = SceneCatalog.GetSceneDefFromSceneName("moon");
			}
		}

		internal void HandleLobbyConfigCompat()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ModConfigEntry val = new ModConfigEntry();
			val.DisplayName = "Powerfully Slow";
			val.SectionFields.Add("Old Moon", new List<IConfigField>
			{
				ConfigFieldUtilities.CreateFromBepInExConfigEntry<int>(repeatChance),
				ConfigFieldUtilities.CreateFromBepInExConfigEntry<bool>(frogger)
			});
			ModConfigCatalog.Add(val);
		}
	}
	public class SkyboxReplacementHolder : MonoBehaviour
	{
		public GameObject skyboxInstance;
	}
}