Decompiled source of The Wall v1.0.4

BepInEx/plugins/The_Wall.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
using Peak.Island;
using Photon.Pun;
using Photon.Realtime;
using Unity.Mathematics;
using UnityEngine;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("The_Wall")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("The_Wall")]
[assembly: AssemblyTitle("TheWall")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace TheWall
{
	[HarmonyPatch(typeof(LavaRising), "Update")]
	internal static class LavaRisingPatch
	{
		internal static bool Prefix(LavaRising __instance)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Invalid comparison between Unknown and I4
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isGloom || (int)__instance.risingFieldType == 0)
			{
				if (RunSettings.GetValue((SETTINGTYPE)2850, false) == 0)
				{
					((Behaviour)__instance).enabled = false;
					return false;
				}
				if ((int)__instance.risingFieldType == 0 && RunSettings.GetValue((SETTINGTYPE)2800, false) == 0)
				{
					((Behaviour)__instance).enabled = false;
					return false;
				}
				if (PhotonNetwork.IsMasterClient)
				{
					bool flag = false;
					__instance.syncTime += Time.deltaTime;
					if (!__instance.started && __instance.secondsWaitedToStart <= 0f && Ascents.fogEnabled && TheWallSetup.WEAREATTHEWALLWOOOOO)
					{
						__instance.StartWaiting();
					}
					if (!__instance.started && __instance.secondsWaitedToStart > 0f)
					{
						__instance.secondsWaitedToStart += Time.deltaTime;
						if (__instance.secondsWaitedToStart > __instance.initialWaitTime && Ascents.fogEnabled)
						{
							flag = true;
							__instance.started = true;
						}
					}
					if (__instance.syncTime > 15f)
					{
						__instance.syncTime = 0f;
						flag = true;
					}
					if (flag)
					{
						Debug.Log((object)"Syncing Lava Rising to others...");
						((MonoBehaviourPun)__instance).photonView.RPC("RPC_SyncLava", (RpcTarget)1, new object[4] { __instance.started, __instance.ended, __instance.timeTraveled, __instance.secondsWaitedToStart });
					}
				}
				if (__instance.started && !__instance.ended)
				{
					if (!__instance.shownLavaRisingMessage)
					{
						if (__instance.isGloom)
						{
							GUIManager.instance.TheGloomRises();
							GamefeelHandler.instance.AddPerlinShake(5f, 3f, 15f);
						}
						else if ((int)__instance.risingFieldType == 0)
						{
							GUIManager.instance.TheLavaRises();
							GamefeelHandler.instance.AddPerlinShake(5f, 3f, 15f);
						}
						else
						{
							RisingFieldType risingFieldType = __instance.risingFieldType;
						}
						__instance.shownLavaRisingMessage = true;
						Debug.Log((object)"Lava rising started.");
					}
					if (__instance.isGloom && __instance.gloomAmount < 1f)
					{
						__instance.gloomAmount += Time.deltaTime;
						Shader.SetGlobalFloat("HeightFogAmount", __instance.gloomAmount);
					}
					__instance.timeTraveled += Time.deltaTime;
					float num = Mathf.Lerp(__instance.startHeight, __instance.topTransform.position.y, __instance.timeTraveled / __instance.travelTime);
					__instance.lava.MovePosition(new Vector3(((Component)__instance.lava).transform.position.x, num, ((Component)__instance.lava).transform.position.z));
					if (__instance.timeTraveled > __instance.travelTime)
					{
						__instance.EndRising();
					}
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Flare), "Update")]
	internal class FlareFix
	{
		internal static bool Prefix(Flare __instance)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			bool value = ((ItemComponent)__instance).GetData<BoolItemData>((DataEntryKey)3).Value;
			((ItemComponent)__instance).item.UIData.canPocket = !value;
			((ItemComponent)__instance).item.UIData.canBackpack = !value;
			if (value && !__instance.trackable.hasTracker)
			{
				__instance.EnableFlareVisuals();
			}
			if (value && Object.op_Implicit((Object)(object)((ItemComponent)__instance).item.holderCharacter) && ((ItemComponent)__instance).item.holderCharacter.Center.y > EndingFogWallHandler.Instance.FloatingPoint.y - 50f && !Singleton<PeakHandler>.Instance.summonedHelicopter && !Ascents.shouldRequireNadir)
			{
				((Component)__instance).GetComponent<PhotonView>().RPC("TriggerHelicopter", (RpcTarget)3, Array.Empty<object>());
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(GloomVoiceConfuser), "TryCollectPerches")]
	internal class GetPerchFix
	{
		internal static bool Prefix(GloomVoiceConfuser __instance, Transform root)
		{
			if (TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				__instance.allPerches = TheWallSetup.Caldera.GetComponentsInChildren<RavenPerch>();
			}
			else
			{
				__instance.allPerches = ((Component)root).GetComponentsInChildren<RavenPerch>();
			}
			return __instance.allPerches.Length != 0;
		}
	}
	internal class EndingFogWallHandler : MonoBehaviour
	{
		public static EndingFogWallHandler Instance;

		public GameObject WallDown;

		public GameObject WallUp;

		public Vector2 FloatingPoint;

		public Vector3 CurrentCenter;

		public float PulledFor = 0f;

		public void Awake()
		{
			Instance = this;
		}

		public void FixedUpdate()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Character.localCharacter == (Object)null || (Object)(object)WallUp == (Object)null || (Object)(object)WallDown == (Object)null)
			{
				return;
			}
			CurrentCenter = Character.localCharacter.Center;
			if (CurrentCenter.y > FloatingPoint.x && CurrentCenter.y < FloatingPoint.y && PulledFor < 30f)
			{
				PulledFor += Time.fixedDeltaTime;
				Character.localCharacter.AddForce(new Vector3(0f, 150f, 0f), 1f, 1f);
				if (Character.localCharacter.data.isClimbingAnything)
				{
					Character.localCharacter.refs.climbing.StopClimbing();
				}
			}
			else if (CurrentCenter.y >= FloatingPoint.y && !Character.localCharacter.data.dead)
			{
				((Collider)WallUp.GetComponent<BoxCollider>()).enabled = true;
				TheWallSetup.Caldera.SetActive(true);
				((Behaviour)this).enabled = false;
			}
			else if (PulledFor >= 30f && !Character.localCharacter.data.dead)
			{
				TheWallSetup.Caldera.SetActive(false);
				PulledFor = 0f;
			}
		}

		public IEnumerator GrowMyLave(Transform lavesTransform)
		{
			float progress = 0f;
			while (lavesTransform.localScale.x + lavesTransform.localScale.z < 2000f)
			{
				progress += 2E-06f;
				yield return (object)new WaitForSeconds(0.02f);
				lavesTransform.localScale = Vector3.Lerp(lavesTransform.localScale, new Vector3(1000f, lavesTransform.localScale.y, 1000f), progress);
			}
		}

		internal static void GenerateSavedForLater()
		{
			TheWallSetup.savedForLater = TheWallSetup.savedForLater.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			foreach (PropSpawner item in TheWallSetup.savedForLater)
			{
				if ((Object)(object)item == (Object)null || ((Object)item).name.StartsWith("Bridge"))
				{
					continue;
				}
				float num = 2f;
				int propType = 2;
				foreach (string item2 in TheWallSetup.isHazard)
				{
					if (((Object)item).name.StartsWith(item2))
					{
						num = 3f;
						propType = 3;
					}
				}
				TheWallSetup.CreateParamsTemplate((int)((float)item.nrOfSpawns * num), 0, 335, 1100, 400, 8, 1751, 2321, 0, -1, 1, propType);
				if (((Object)item).name.StartsWith("Vine"))
				{
					JungleVine component = item.props[0].GetComponent<JungleVine>();
					component.maxDist *= 5f;
					component.maxDown *= 3f;
					component.maxHeightDifference *= 3f;
				}
				Plugin.Log.LogInfo((object)((Object)item).name);
				IEnumerator enumerator3 = TheWallSetup.SpawnNew(executeDeferredImmediately: true, item);
				while (enumerator3.MoveNext())
				{
				}
				if (((Object)item).name.StartsWith("Vine"))
				{
					JungleVine component2 = item.props[0].GetComponent<JungleVine>();
					component2.maxDist /= 5f;
					component2.maxDown /= 3f;
					component2.maxHeightDifference /= 3f;
				}
			}
		}

		public void RunExtraThread()
		{
			LoadBalancingPeer peer = PhotonNetwork.NetworkingClient.LoadBalancingPeer;
			Thread thread = new Thread((ThreadStart)delegate
			{
				while (!TheWallSetup.finishedGeneratingWall)
				{
					((PhotonPeer)peer).SendOutgoingCommands();
					Thread.Sleep(450);
				}
			});
			thread.Start();
		}

		public IEnumerator RenderDistanceHandler()
		{
			while (true)
			{
				float[] culldistances = new float[MainCamera.instance.cam.layerCullDistances.Length];
				for (int i = 0; i < MainCamera.instance.cam.layerCullDistances.Length; i++)
				{
					culldistances[i] = Plugin.RenderHeightDistance.Value;
				}
				MainCamera.instance.cam.layerCullDistances = culldistances;
				yield return (object)new WaitForSeconds(10f);
			}
		}

		internal IEnumerator WallEnterance()
		{
			while (LavaRising.ALL_LAVA.Count <= 0)
			{
				yield return (object)new WaitForSeconds(1f);
			}
			if (TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				yield break;
			}
			TheWallSetup.Caldera.SetActive(true);
			TheWallSetup.WallIWantToRemove.SetActive(false);
			GUIManager.instance.SetHeroTitle("THE WALL", (AudioClip)null, false);
			TheWallSetup.WEAREATTHEWALLWOOOOO = true;
			LavaRising.ALL_LAVA[0].shownLavaRisingMessage = false;
			LavaRising.ALL_LAVA[0].started = false;
			LavaRising.ALL_LAVA[0].startHeight = LavaRising.ALL_LAVA[0].topTransform.position.y - 200f;
			((Component)LavaRising.ALL_LAVA[0].lava).transform.position = new Vector3(((Component)LavaRising.ALL_LAVA[0].lava).transform.position.x, LavaRising.ALL_LAVA[0].topTransform.position.y - 200f, ((Component)LavaRising.ALL_LAVA[0].lava).transform.position.z);
			LavaRising.ALL_LAVA[0].topTransform.position = new Vector3(LavaRising.ALL_LAVA[0].topTransform.position.x, 2240f, LavaRising.ALL_LAVA[0].topTransform.position.z);
			LavaRising.ALL_LAVA[0].timeTraveled = 0f;
			LavaRising.ALL_LAVA[0].secondsWaitedToStart = 0f;
			LavaRising.ALL_LAVA[0].ended = false;
			LavaRising.ALL_LAVA[0].travelTime = 3000f;
			LavaRising.ALL_LAVA[0].initialWaitTime = 120f;
			WindChillZone[] ChillZones = Object.FindObjectsByType<WindChillZone>((FindObjectsSortMode)0);
			WindChillZone[] array = ChillZones;
			foreach (WindChillZone w in array)
			{
				if (((Object)w).name == "SnowStorm")
				{
					((Component)w).transform.position = new Vector3(TheWallSetup.TheRiver.position.x, TheWallSetup.TheRiver.position.y, TheWallSetup.TheRiver.position.z - 90f);
					((Component)w).transform.parent = TheWallSetup.Caldera.transform;
					w.statusApplicationPerSecond *= 0.333333f;
				}
				else
				{
					((Component)w).transform.position = new Vector3(TheWallSetup.TheRiver.position.x, TheWallSetup.TheRiver.position.y, TheWallSetup.TheRiver.position.z - 200f);
					((Component)w).transform.parent = TheWallSetup.Caldera.transform;
				}
				w.windZoneBounds = new Bounds(((Component)w).transform.position, new Vector3(1000f, 10000f, 100f));
				((Component)w).gameObject.SetActive(true);
			}
			if (PhotonNetwork.IsMasterClient && Plugin.SpawnNatureItems.Value)
			{
				Spawner[] spawnos = TheWallSetup.Caldera.GetComponentsInChildren<Spawner>();
				Spawner[] array2 = spawnos;
				foreach (Spawner s in array2)
				{
					if (!s.isHeightBasedSpawnPool)
					{
						s.TrySpawnItems();
					}
				}
			}
			((MonoBehaviour)Instance).StartCoroutine(Instance.RenderDistanceHandler());
			PlayerTrackParticles[] array3 = Object.FindObjectsByType<PlayerTrackParticles>((FindObjectsSortMode)0);
			foreach (PlayerTrackParticles p in array3)
			{
				Object.Destroy((Object)(object)p);
			}
		}

		public void LoadWallRoutine(MapHandler __instance)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0760: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_0827: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_083e: Unknown result type (might be due to invalid IL or missing references)
			//IL_089f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9f: Unknown result type (might be due to invalid IL or missing references)
			RunExtraThread();
			PhotonNetwork.IsMessageQueueRunning = false;
			PhotonNetwork.KeepAliveInBackground = 200000f;
			int num = Random.Range(int.MinValue, int.MaxValue);
			TheWallSetup.finishedGeneratingWall = false;
			WaitForSeconds val = new WaitForSeconds(1f);
			Random.InitState(((Component)__instance).GetComponent<LevelGeneration>().seed);
			((Random)(ref TheWallSetup.Randomizer)).InitState((uint)((Component)__instance).GetComponent<LevelGeneration>().seed);
			TheWallSetup.savedForLater = new List<PropSpawner>();
			TheWallSetup.WEAREATTHEWALLWOOOOO = false;
			PropSpawner[] componentsInChildren = ((Component)((Component)__instance).transform.GetChild(6)).GetComponentsInChildren<PropSpawner>();
			foreach (PropSpawner val2 in componentsInChildren)
			{
				TheWallSetup.savedForLater.Add(val2);
				if (((Object)val2).name.StartsWith("Look"))
				{
					val2.nrOfSpawns *= 2;
				}
				else
				{
					val2.nrOfSpawns *= 8;
				}
			}
			PropSpawner[] array = Object.FindObjectsByType<PropSpawner>((FindObjectsSortMode)1);
			PropSpawner[] array2 = array;
			foreach (PropSpawner val3 in array2)
			{
				if (Object.op_Implicit((Object)(object)((Component)val3).GetComponentInChildren<RespawnChest>()) && (Object)(object)val3 != (Object)null)
				{
					TheWallSetup.savedForLater.Add(val3);
				}
			}
			TheWallSetup.VolcanicBiome = ((Component)((Component)__instance).transform.GetChild(4)).gameObject;
			GameObject gameObject = ((Component)TheWallSetup.VolcanicBiome.transform.GetChild(0).GetChild(1)).gameObject;
			PunExtensions.GetPhotonView(gameObject).ViewID = 0;
			GameObject val4 = Object.Instantiate<GameObject>(gameObject);
			PunExtensions.GetPhotonView(gameObject).ViewID = PhotonNetwork.AllocateViewID(false);
			if (__instance.BiomeIsPresent((BiomeType)8))
			{
				PhotonView[] componentsInChildren2 = ((Component)TheWallSetup.VolcanicBiome.transform.GetChild(0).GetChild(2)).GetComponentsInChildren<PhotonView>();
				for (int k = 0; k < componentsInChildren2.Length; k++)
				{
					componentsInChildren2[k].ViewID = 0;
				}
				TheWallSetup.Caldera = Object.Instantiate<GameObject>(((Component)TheWallSetup.VolcanicBiome.transform.GetChild(0).GetChild(2)).gameObject);
				for (int l = 0; l < componentsInChildren2.Length; l++)
				{
					componentsInChildren2[l].ViewID = PhotonNetwork.AllocateViewID(false);
				}
				TheWallSetup.TheRiver = ((Component)TheWallSetup.Caldera.GetComponentInChildren<WaterZone>()).transform.parent;
				Object.Destroy((Object)(object)((Component)TheWallSetup.Caldera.transform.GetChild(13)).gameObject);
			}
			else
			{
				TheWallSetup.Caldera = Object.Instantiate<GameObject>(((Component)TheWallSetup.VolcanicBiome.transform.GetChild(1).GetChild(0)).gameObject);
				TheWallSetup.TheRiver = ((Component)TheWallSetup.Caldera.GetComponentInChildren<SyncedAnimation>()).transform;
				GameObject val5 = Object.Instantiate<GameObject>(((Component)TheWallSetup.TheRiver).gameObject);
				val5.transform.parent = TheWallSetup.VolcanicBiome.transform.GetChild(1).GetChild(0);
				val5.transform.rotation = Quaternion.identity;
				TheWallSetup.Caldera.transform.GetChild(4).localScale = new Vector3(100f, 10f, 300f);
			}
			TheWallSetup.Caldera.SetActive(true);
			TheWallSetup.Beach = ((Component)((Component)__instance).transform.GetChild(1).GetChild(0).GetChild(0)).gameObject;
			TheWallSetup.TropOrRoot = ((Component)((Component)__instance).transform.GetChild(2).GetChild(0)).gameObject;
			TheWallSetup.MesaOrAlp = ((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).gameObject;
			TheWallSetup.Caldera.transform.position = new Vector3(0f, 500f, 3700f);
			if (Singleton<MapHandler>.Instance.BiomeIsPresent((BiomeType)8))
			{
				TheWallSetup.Caldera.transform.position = new Vector3(0f, 500f, 3700f) + new Vector3(0f, 1000f, -200f);
			}
			TheWallSetup.useTheCustom = true;
			if (Singleton<MapHandler>.Instance.BiomeIsPresent((BiomeType)8))
			{
				TheWallSetup.WaterTransform = ((Component)TheWallSetup.Caldera.GetComponentInChildren<WaterZone>()).transform.parent;
				TheWallSetup.WaterTransform.localScale = new Vector3(TheWallSetup.WaterTransform.localScale.x + 500f, TheWallSetup.WaterTransform.localScale.y, TheWallSetup.WaterTransform.localScale.z + 500f);
				TheWallSetup.GenerateTheWallPartGloom();
			}
			else
			{
				TheWallSetup.GenerateTheWallPartCaldera();
			}
			if (Singleton<MapHandler>.Instance.BiomeIsPresent((BiomeType)8))
			{
				for (int m = 0; m < TheWallSetup.Caldera.transform.childCount; m++)
				{
					TheWallSetup.Caldera.transform.GetChild(m).position = TheWallSetup.Caldera.transform.GetChild(m).position + new Vector3(0f, 350f, 0f);
				}
			}
			TheWallSetup.GenerateTheWallPartBitch();
			if (((Object)TheWallSetup.TropOrRoot).name == "Tropics")
			{
				TheWallSetup.GenerateTropicPart();
			}
			else
			{
				TheWallSetup.GenerateRootPart();
				Stopwatch stopwatch = Stopwatch.StartNew();
			}
			if (((Object)TheWallSetup.MesaOrAlp).name == "Alpine")
			{
				TheWallSetup.GenerateAlpinePart();
			}
			else
			{
				TheWallSetup.GenerateMesaPart();
			}
			TheWallSetup.Caldera.transform.Rotate(270f, 0f, 0f);
			SpecialDayZone[] array3 = Object.FindObjectsByType<SpecialDayZone>((FindObjectsSortMode)1);
			GameObject gameObject2 = ((Component)array3[0]).gameObject;
			SpecialDayZone[] array4 = array3;
			foreach (SpecialDayZone val6 in array4)
			{
				if (((Object)val6).name.EndsWith("Peak"))
				{
					gameObject2 = ((Component)val6).gameObject;
				}
			}
			TheWallSetup.Caldera.transform.position = gameObject2.transform.position + new Vector3(12f, -104f, 908f);
			Plugin.Log.LogInfo((object)((Component)TheWallSetup.TheRiver).transform.position);
			PhotonView val7 = TheWallSetup.Caldera.AddComponent<PhotonView>();
			val7.ViewID = PhotonNetwork.AllocateViewID(false);
			TheWallSetup.Caldera.AddComponent<TriggerRelay>().view = val7;
			GenerateSavedForLater();
			TheWallSetup.WallIWantToRemove = Object.Instantiate<GameObject>(__instance.segments[0].wallNext);
			if (Singleton<MapHandler>.Instance.BiomeIsPresent((BiomeType)8))
			{
				TheWallSetup.WallIWantToRemove.transform.position = new Vector3(6.9856f, 1188.303f, 2243.107f);
			}
			else
			{
				TheWallSetup.WallIWantToRemove.transform.position = new Vector3(6.9856f, 1188.303f, 2133.107f);
			}
			TheWallSetup.WallIWantToRemove.transform.localScale = new Vector3(500f, 80f, 1000f);
			TheWallSetup.WallIWantToRemove.transform.parent = ((Component)__instance).transform;
			TheWallSetup.WallIWantToRemove.SetActive(true);
			GameObject val8 = Object.Instantiate<GameObject>(__instance.segments[0].wallNext);
			val8.transform.parent = ((Component)__instance).transform;
			val8.transform.position = new Vector3(-49.3086f, 2250.431f, 2260.379f);
			val8.transform.localScale = new Vector3(500f, 80f, 1000f);
			val8.transform.rotation = Quaternion.LookRotation(new Vector3(-1f, 0f, 0f));
			((Collider)val8.GetComponent<BoxCollider>()).enabled = false;
			val8.SetActive(true);
			GameObject val9 = Object.Instantiate<GameObject>(__instance.segments[0].wallNext);
			val9.transform.parent = ((Component)__instance).transform;
			val9.transform.position = new Vector3(-49.3086f, 2250.431f, 2260.379f);
			val9.transform.localScale = new Vector3(500f, 100f, 1000f);
			val9.transform.rotation = Quaternion.LookRotation(Vector3.forward);
			val9.transform.Rotate(0f, 0f, 180f);
			((Collider)val9.GetComponent<BoxCollider>()).enabled = false;
			val9.SetActive(true);
			((Behaviour)this).enabled = true;
			WallDown = val8;
			WallUp = val9;
			FloatingPoint = new Vector2(2151f, 2263f);
			List<PhotonView> list = TheWallSetup.Caldera.GetComponentsInChildren<PhotonView>(true).ToList();
			list.Sort((PhotonView a, PhotonView b) => ((Object)a).GetInstanceID().CompareTo(((Object)b).GetInstanceID()));
			TheWallSetup.ids = new int[list.Count];
			if (PhotonNetwork.IsMasterClient)
			{
				for (int num2 = 0; num2 < list.Count; num2++)
				{
					if (list[num2].ViewID <= 0)
					{
						list[num2].ViewID = PhotonNetwork.AllocateViewID(true);
						TheWallSetup.ids[num2] = list[num2].ViewID;
					}
				}
			}
			TheWallSetup.Caldera.SetActive(false);
			if (__instance.BiomeIsPresent((BiomeType)3))
			{
				((Behaviour)TheWallSetup.Caldera.GetComponentInChildren<SyncedAnimation>().anim).enabled = false;
			}
			Plugin.Log.LogInfo((object)((Component)__instance).GetComponent<LevelGeneration>().seed);
			Random.InitState(num);
			TheWallSetup.useTheCustom = false;
			val4.transform.Rotate(270f, 0f, 0f);
			val4.transform.position = TheWallSetup.WaterTransform.position;
			StatusFieldGloom component = val4.GetComponent<StatusFieldGloom>();
			((Bounds)(ref ((StatusFieldBounds)component).bounds)).center = val4.transform.position;
			((Bounds)(ref ((StatusFieldBounds)component).bounds)).size = new Vector3(1000f, 2000f, 350f);
			((StatusFieldBase)component).statusAmountPerSecond = ((StatusFieldBase)component).statusAmountPerSecond * 0.45f;
			val4.transform.GetChild(0).localScale = new Vector3(1000f, 1000f, 1000f);
			val4.transform.GetChild(0).position = new Vector3(26.9779f, 1414.85f, TheWallSetup.Caldera.transform.position.z - 658f);
			PunExtensions.GetPhotonView(val4).ViewID = PhotonNetwork.AllocateViewID(false);
			PhotonNetwork.IsMessageQueueRunning = true;
		}
	}
	[BepInPlugin("thewall", "The_Wall", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ConfigEntry<bool> StartAtWall;

		internal static ConfigEntry<float> RenderHeightDistance;

		internal static ConfigEntry<bool> SpawnNatureItems;

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			StartAtWall = ((BaseUnityPlugin)this).Config.Bind<bool>("The Wall", "Start at wall", false, "If true you will start at the wall");
			RenderHeightDistance = ((BaseUnityPlugin)this).Config.Bind<float>("The Wall", "Render Distance", 400f, new ConfigDescription("How far away up or down something can be rendered", (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 1000f), Array.Empty<object>()));
			SpawnNatureItems = ((BaseUnityPlugin)this).Config.Bind<bool>("The Wall", "Spawn Nature Items (Can be laggy)", false, (ConfigDescription)null);
			Log.LogInfo((object)"Plugin the wall is loaded!");
			Harmony val = new Harmony("thewall");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(SpawnGameObject), "Go")]
	internal static class TheBigOne
	{
		internal static bool Prefix(SpawnGameObject __instance)
		{
			return true;
		}
	}
	[HarmonyPatch(typeof(ScoutStatue), "Awake")]
	internal static class SetPosForScoutStatue
	{
		internal static void Prefix(ScoutStatue __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			((Component)__instance).transform.position = new Vector3(6.0139f, 1185.244f, 2179.153f);
			((Component)__instance).transform.Rotate(0f, -180f, 0f);
			StatueHandler statueHandler = ((Component)__instance).gameObject.AddComponent<StatueHandler>();
			statueHandler.statue = __instance;
			statueHandler.StartingPos = ((Component)__instance).transform.position;
			statueHandler.PosToGo = new Vector3(-49.3086f, 2255.431f, 2260.379f);
			List<string> list = new List<string> { "FortifiedMilk", "ChainShooter", "Energy Drink" };
			if (!PhotonNetwork.IsMasterClient)
			{
				return;
			}
			for (int i = 0; i < PhotonNetwork.PlayerList.Length; i++)
			{
				RaycastHit val = HelperFunctions.LineCheck(((Component)__instance).transform.position + Vector3.up * 3f, ((Component)__instance).transform.position + Vector3.up * 3f + new Vector3(Random.Range(-1f, 1f), -1f, Random.Range(-1f, 1f)) * 10f, (LayerType)1, 0f, (QueryTriggerInteraction)1);
				if ((Object)(object)((RaycastHit)(ref val)).transform != (Object)null)
				{
					GameObject val2 = PhotonNetwork.Instantiate("0_Items/" + list[Random.Range(0, list.Count)], ((RaycastHit)(ref val)).point, Quaternion.identity, (byte)0, (object[])null);
					Item component = val2.GetComponent<Item>();
					((Component)component).GetComponent<PhotonView>().RPC("SetKinematicRPC", (RpcTarget)3, new object[3]
					{
						true,
						((Component)component).transform.position,
						((Component)component).transform.rotation
					});
				}
			}
			for (int j = 0; j < PhotonNetwork.PlayerList.Length; j++)
			{
				RaycastHit val3 = HelperFunctions.LineCheck(((Component)__instance).transform.position + Vector3.up * 3f, ((Component)__instance).transform.position + Vector3.up * 3f + new Vector3(Random.Range(-1f, 1f), -1f, Random.Range(-1f, 1f)) * 10f, (LayerType)1, 0f, (QueryTriggerInteraction)1);
				if ((Object)(object)((RaycastHit)(ref val3)).transform != (Object)null)
				{
					GameObject val4 = PhotonNetwork.Instantiate("0_Items/Airplane Food", ((RaycastHit)(ref val3)).point, Quaternion.identity, (byte)0, (object[])null);
					Item component2 = val4.GetComponent<Item>();
					((Component)component2).GetComponent<PhotonView>().RPC("SetKinematicRPC", (RpcTarget)3, new object[3]
					{
						true,
						((Component)component2).transform.position,
						((Component)component2).transform.rotation
					});
				}
			}
		}
	}
	[HarmonyPatch(typeof(Item), "Interact")]
	internal static class PreventStangeGemPickup
	{
		internal static bool Prefix(Item __instance)
		{
			//IL_0059: 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)
			if (PingPonger.Host.inAirport)
			{
				return true;
			}
			if ((Object)(object)TheWallSetup.BingBongsAudio == (Object)null)
			{
				Action_AskBingBong component = ((Component)__instance).GetComponent<Action_AskBingBong>();
				if ((Object)(object)component != (Object)null)
				{
					TheWallSetup.BingBongsAudio = Object.Instantiate<AudioClip>(component.source.clip);
				}
			}
			if (((Component)__instance).transform.position == ((Component)((Component)StatueHandler.Instance).transform.GetChild(1)).transform.position && !TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				if (!StatueHandler.Instance.StartedFlyingAwayee)
				{
					StatueHandler.Instance.statue.photonView.RPC("FlyAwayeeNetworked", (RpcTarget)0, Array.Empty<object>());
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(ScoutStatue), "Interact_CastFinished")]
	internal static class PreventNadirEntry
	{
		internal static bool Prefix(ScoutStatue __instance)
		{
			StatueHandler component = ((Component)__instance).GetComponent<StatueHandler>();
			if (component.CanBecomeHonorable)
			{
				return true;
			}
			if (!component.StartedFlyingAwayee)
			{
				component.statue.photonView.RPC("FlyAwayeeNetworked", (RpcTarget)0, Array.Empty<object>());
			}
			return false;
		}
	}
	internal class StatueHandler : MonoBehaviour
	{
		public static StatueHandler Instance;

		public bool CanBecomeHonorable = false;

		public Vector3 PosToGo;

		public Vector3 StartingPos;

		public float Ticker;

		public bool StartedFlyingAwayee = false;

		public ScoutStatue statue;

		public void Awake()
		{
			Instance = this;
		}

		[PunRPC]
		public void FlyAwayeeNetworked()
		{
			((MonoBehaviour)this).StartCoroutine((IEnumerator)IWantToFlyAwayee());
		}

		public IEnumerator<WaitForFixedUpdate> IWantToFlyAwayee()
		{
			Action_StrangeGem[] keepThis = Object.FindObjectsByType<Action_StrangeGem>((FindObjectsInactive)0, (FindObjectsSortMode)1);
			GameObject gem = null;
			Action_StrangeGem[] array = keepThis;
			foreach (Action_StrangeGem g in array)
			{
				if (((ItemActionBase)g).item.rig.isKinematic && (Object)(object)((ItemActionBase)g).item.holderCharacter == (Object)null)
				{
					gem = ((Component)g).gameObject;
				}
			}
			if (PhotonNetwork.IsMasterClient)
			{
				foreach (Character c in Character.AllCharacters)
				{
					if (c.data.dead)
					{
						c.view.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3]
						{
							((Component)this).transform.position + Vector3.forward * 3f,
							false,
							4
						});
					}
					else
					{
						c.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2]
						{
							((Component)this).transform.position + Vector3.forward * 3f,
							false
						});
					}
				}
			}
			((MonoBehaviour)this).StartCoroutine((IEnumerator)WaitForReveal());
			while (((Component)this).transform.position != PosToGo)
			{
				Ticker += Time.fixedDeltaTime * 0.01f;
				((Component)this).transform.position = Vector3.Lerp(StartingPos, PosToGo, Ticker);
				if (PhotonNetwork.IsMasterClient)
				{
					gem.transform.position = ((Component)this).transform.GetChild(1).position;
				}
				if (Ticker > 1f)
				{
					break;
				}
				yield return null;
			}
			CanBecomeHonorable = true;
		}

		public IEnumerator<WaitForSeconds> WaitForReveal()
		{
			yield return new WaitForSeconds(5f);
			((MonoBehaviour)EndingFogWallHandler.Instance).StartCoroutine(EndingFogWallHandler.Instance.WallEnterance());
		}
	}
	[HarmonyPatch(typeof(Tornado), "RPCA_InitTornado")]
	internal static class TornadoInitiationPatch
	{
		internal static bool Prefix(Tornado __instance, int targetViewID)
		{
			if (!TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				return true;
			}
			__instance.view = ((Component)__instance).GetComponent<PhotonView>();
			__instance.targetParent = TheWallSetup.Caldera.transform;
			return false;
		}
	}
	[HarmonyPatch(typeof(Tornado), "RPCA_SelectTargetPos")]
	internal static class TornadoTargetingPatch
	{
		internal static bool Prefix(Tornado __instance)
		{
			if (!TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				return true;
			}
			__instance.target = TheWallSetup.Caldera.transform.GetChild(((Random)(ref TheWallSetup.Randomizer)).NextInt(0, TheWallSetup.Caldera.transform.childCount));
			return false;
		}
	}
	[HarmonyPatch(typeof(Tornado), "Movement")]
	internal static class TornadoMovePatch
	{
		internal static bool Prefix(Tornado __instance)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_006a: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_008b: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00ba: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			if (!TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				return true;
			}
			if ((Object)(object)__instance.target == (Object)null)
			{
				return !TheWallSetup.WEAREATTHEWALLWOOOOO;
			}
			Vector3 vel = __instance.vel;
			Vector3 val = __instance.target.position - __instance.tornadoPos;
			__instance.vel = FRILerp.Lerp(vel, ((Vector3)(ref val)).normalized * 15f, 0.15f, true);
			__instance.tornadoPos += __instance.vel * Time.deltaTime;
			RaycastHit groundPosRaycast = HelperFunctions.GetGroundPosRaycast(__instance.tornadoPos + Vector3.up * 200f, (LayerType)2, 0f);
			if (Object.op_Implicit((Object)(object)((RaycastHit)(ref groundPosRaycast)).transform) && Vector3.Distance(__instance.tornadoPos, ((RaycastHit)(ref groundPosRaycast)).point) < 10f)
			{
				__instance.tornadoPos = new Vector3(__instance.tornadoPos.x, ((RaycastHit)(ref groundPosRaycast)).point.y, __instance.tornadoPos.z);
			}
			((Component)__instance).transform.position = __instance.tornadoPos;
			return !TheWallSetup.WEAREATTHEWALLWOOOOO;
		}
	}
	[HarmonyPatch(typeof(TornadoSpawner), "GetSpawnPos")]
	internal static class SpawnPosPatch
	{
		internal static bool Prefix(TornadoSpawner __instance, ref Vector3 __result)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				return true;
			}
			__result = TheWallSetup.Caldera.transform.GetChild(((Random)(ref TheWallSetup.Randomizer)).NextInt(0, TheWallSetup.Caldera.transform.childCount)).position;
			return false;
		}
	}
	[HarmonyPatch(typeof(EruptionSpawner), "Update")]
	internal static class imErupting
	{
		internal static bool Prefix(EruptionSpawner __instance)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsMasterClient || !TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				return true;
			}
			__instance.counter -= Time.deltaTime;
			if (__instance.counter < 0f)
			{
				__instance.counter = ((Random)(ref TheWallSetup.Randomizer)).NextFloat(-5f, 15f);
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(TheWallSetup.TheRiver.position.x, TheWallSetup.TheRiver.position.y, TheWallSetup.TheRiver.position.z - 50f);
				val.x += ((Random)(ref TheWallSetup.Randomizer)).NextFloat(-155f, 155f);
				val.z += ((Random)(ref TheWallSetup.Randomizer)).NextFloat(-50f, 50f);
				val.y += ((Random)(ref TheWallSetup.Randomizer)).NextFloat(-500f, 500f);
				__instance.photonView.RPC("RPCA_SpawnEruption", (RpcTarget)0, new object[1] { val });
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(Character), "Awake")]
	internal static class PingPongAdd
	{
		internal static void Postfix(Character __instance)
		{
			if (((MonoBehaviourPun)__instance).photonView.Owner == PhotonNetwork.MasterClient)
			{
				PingPonger pingPonger = ((Component)__instance).gameObject.AddComponent<PingPonger>();
				PingPonger.Host = __instance;
				PingPonger.HostView = __instance.view;
			}
		}
	}
	internal class PingPonger : MonoBehaviour
	{
		public static Character Host;

		public static PingPonger Instance;

		public static PhotonView HostView;

		public void Awake()
		{
			TheWallSetup.finishedGeneratingWall = true;
			Plugin.Log.LogInfo((object)"Waiting for tp");
			((MonoBehaviour)this).StartCoroutine(AwakeRoutine());
		}

		public IEnumerator AwakeRoutine()
		{
			yield return (object)new WaitForSeconds(5f);
			while ((Object)(object)Character.localCharacter == (Object)null)
			{
				yield return (object)new WaitForSeconds(1f);
			}
			Instance = this;
			Host.view.RPC("BringMeUpThereBruh", (RpcTarget)2, new object[1] { Character.localCharacter.view.ViewID });
			if (Host.view.Owner != Character.localCharacter.view.Owner)
			{
				HostView.RPC("AreWeAtTheWall", (RpcTarget)2, new object[1] { Character.localCharacter.view.ViewID });
			}
		}

		[PunRPC]
		public void BringMeUpThereBruh(int ViewID)
		{
			Character val = default(Character);
			Character.GetCharacterWithPhotonID(ViewID, ref val);
			if (Plugin.StartAtWall.Value)
			{
				Host.view.RPC("Ok", val.view.Owner, Array.Empty<object>());
			}
			if (val.view.Owner != PhotonNetwork.MasterClient && !val.inAirport)
			{
				Host.view.RPC("ApplyNewViews", val.view.Owner, new object[1] { TheWallSetup.ids });
			}
		}

		[PunRPC]
		public void ApplyNewViews(int[] viewIDs)
		{
			try
			{
				List<PhotonView> list = TheWallSetup.Caldera.GetComponentsInChildren<PhotonView>(true).ToList();
				list.Sort((PhotonView a, PhotonView b) => ((Object)a).GetInstanceID().CompareTo(((Object)b).GetInstanceID()));
				for (int num = 0; num < list.Count; num++)
				{
					if (list[num].ViewID <= 0)
					{
						list[num].ViewID = viewIDs[num];
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogException(ex);
			}
		}

		[PunRPC]
		public void Ok()
		{
			Plugin.Log.LogInfo((object)"Sure thing ill send you up there!");
			((MonoBehaviour)this).StartCoroutine(SendMeInAMoment());
		}

		public IEnumerator SendMeInAMoment()
		{
			yield return (object)new WaitForSeconds(10f);
			if (!Host.inAirport)
			{
				Singleton<MapHandler>.Instance.segments[4].segmentParent.SetActive(true);
				yield return (object)new WaitForSeconds(3f);
				Vector3 posToCamp = HelperFunctions.GetGroundPos(new Vector3(8.4878f, 1200.3f, 2107.211f), (LayerType)1, 0f) + Vector3.up * 3f;
				Character.localCharacter.view.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { posToCamp, false, 4 });
				((Component)Singleton<OrbFogHandler>.Instance).gameObject.SetActive(false);
			}
		}

		[PunRPC]
		public void AreWeAtTheWall(int FromView)
		{
			if (!TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				return;
			}
			PhotonView val = null;
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (allCharacter.view.ViewID == FromView)
				{
					val = allCharacter.view;
				}
			}
			if (!((Object)(object)val == (Object)null))
			{
				HostView.RPC("UhYe", val.Owner, Array.Empty<object>());
			}
		}

		[PunRPC]
		public void UhYe()
		{
			((MonoBehaviour)EndingFogWallHandler.Instance).StartCoroutine(EndingFogWallHandler.Instance.WallEnterance());
			((MonoBehaviour)StatueHandler.Instance).StartCoroutine((IEnumerator)StatueHandler.Instance.IWantToFlyAwayee());
		}
	}
	[HarmonyPatch(typeof(Lava), "DoEffects")]
	internal static class HitWork
	{
		private static float cycleClock = 0f;

		private static float minHeight = 2520f;

		private static float maxHeight = 2350f;

		private static float speed = 0.2f;

		internal static bool Prefix(Lava __instance)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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_0160: 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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isKiln && (!TheWallSetup.WEAREATTHEWALLWOOOOO || !Singleton<MapHandler>.Instance.BiomeIsPresent((BiomeType)3)))
			{
				return true;
			}
			if (__instance.isKiln)
			{
				((Bounds)(ref __instance.bounds)).size = new Vector3(1000f, ((Bounds)(ref __instance.bounds)).size.y, 1000f);
				return true;
			}
			float num = 1f;
			if (cycleClock > 1.75f && cycleClock < 1.85f)
			{
				num = 0.5f;
			}
			cycleClock += Time.fixedDeltaTime * num * speed * 0.04f;
			float num2 = (maxHeight - minHeight) / 2f;
			float num3 = maxHeight - num2;
			float num4 = num3 - num2 * (float)Math.Cos(cycleClock * cycleClock);
			((Component)__instance).transform.position = new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y, num4);
			if ((double)Math.Abs(cycleClock) > Math.Abs(Math.PI * 2.0 / (double)cycleClock))
			{
				cycleClock = 0f;
			}
			Character localCharacter = Character.localCharacter;
			if (localCharacter.Center.z < ((Component)__instance).transform.position.z)
			{
				return false;
			}
			localCharacter.AddForce(new Vector3(0f, 0f, -1f) * 150f, 0.5f, 1f);
			localCharacter.data.sinceGrounded = 0f;
			localCharacter.refs.movement.ApplyExtraDrag(0.8f, true);
			if (__instance.hitPlayers.Contains(localCharacter))
			{
				return false;
			}
			if (localCharacter.data.dead)
			{
				return false;
			}
			if (localCharacter.refs.afflictions.statusSum > 1.9f)
			{
				return false;
			}
			__instance.HitPlayer(localCharacter);
			((MonoBehaviour)__instance).StartCoroutine(__instance.IHoldPlayer(localCharacter));
			return false;
		}
	}
	[HarmonyPatch(typeof(Lava), "TryCookItems")]
	internal static class NoCook
	{
		internal static bool Prefix(Lava __instance)
		{
			if (!__instance.isKiln || TheWallSetup.WEAREATTHEWALLWOOOOO)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Lava), "Heat")]
	internal static class HeatCorrect
	{
		internal static bool Prefix(Lava __instance)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isKiln || !TheWallSetup.WEAREATTHEWALLWOOOOO || !Singleton<MapHandler>.Instance.BiomeIsPresent((BiomeType)3))
			{
				return true;
			}
			Character localCharacter = Character.localCharacter;
			__instance.counter += Time.deltaTime;
			float num = ((Component)__instance).transform.position.z - localCharacter.Center.z;
			float num2 = 1f - Mathf.Clamp01(num / 20f);
			if (num2 < 0.01f)
			{
				return false;
			}
			if (__instance.counter < __instance.heatRate)
			{
				return false;
			}
			__instance.counter = 0f;
			localCharacter.refs.afflictions.AddStatus((STATUSTYPE)8, num2 * __instance.heat * 1.5f, false, true, true, false);
			return false;
		}
	}
	[HarmonyPatch(typeof(MapHandler), "Awake")]
	internal static class TheWallSetup
	{
		public static Random Randomizer;

		public static GameObject Caldera;

		public static Vector3 StartingGenerationPosition;

		public static GameObject Beach;

		public static GameObject TropOrRoot;

		public static GameObject MesaOrAlp;

		public static bool WEAREATTHEWALLWOOOOO = false;

		public static PropSpawner[] TropOrRootAfter;

		public static PropSpawner[] MesaOrAlpAfter;

		public static PropSpawner[] BeachPropsB4;

		public static GameObject WallIWantToRemove;

		public static Dictionary<string, int> Params = new Dictionary<string, int>();

		public static bool useTheCustom = true;

		public static Transform TheRiver;

		public static GameObject VolcanicBiome;

		public static bool finishedGeneratingWall = false;

		public static Transform WaterTransform;

		public static AudioClip BingBongsAudio;

		public static List<string> CalderaBlacklist = new List<string> { "Middle" };

		public static List<string> CalderaSaveForLater = new List<string> { "Luggage", "Eggs", "Vines", "Respawn" };

		public static List<string> AlpineSaveForLater = new List<string> { "Cold", "Geyser", "Shitty", "Flash", "Tree", "Pine", "Shrub", "Capybara", "snow", "Luggage" };

		public static List<string> UseCollForThese = new List<string> { "Beach", "Middle", "Big", "Big", "small", "Bridges", "Plat", "Tall", "Pillars" };

		public static List<string> BeachPropsSaveForLater = new List<string>
		{
			"Palms", "Oasis", "Luggage", "Urchins", "Bushes", "BeachGrass", "Driftwood", "SeaShells", "Jellies", "Bassalt",
			"Mushrooms", "Bush"
		};

		public static List<string> SpecialCases = new List<string>
		{
			"BigTree", "redwoods", "Big Red", "redwoods", "Mush Trees", "Stump", "Drift", "Bass", "Oasis", "Palms",
			"Bridges", "base", "Oasis", "Mirage", "Tumbler", "Cacti", "Lilypad"
		};

		public static List<string> MesaBlacklist = new List<string> { "Foot", "Big", "Antlion", "Timple", "Start", "Pillar", "Nap", "Scorpions", "CanyonScor" };

		public static List<string> RootsSaveForLater = new List<string> { "Shelf", "Mush Trees", "Funk", "Explo", "Vine", "base", "Bridge", "Connecting Vi", "Bounce", "Ferns" };

		public static List<string> TropicsSaveForLater = new List<string>
		{
			"BigTree", "Monsteras", "Ivy", "Weed", "Bushes", "Mushrooms", "ExploShrooms", "PoisonShrooms", "Thorns", "ClusterBerries",
			"LuggageSpawner", "Trees", "Behive", "Vines", "Palms"
		};

		internal static List<string> MesaSaveForLater = new List<string> { "Cactus", "Luggage", "Dynamite", "Shitty", "Shroom", "Oasis", "Mirage", "Dead", "Aloe", "Tumblers" };

		public static List<string> RootsBlacklist = new List<string> { "Spider", "Beetle", "SporeShrooms", "Zombie" };

		public static List<string> TropicsBlacklist = new List<string> { "Foundation", "Pillars" };

		public static List<string> GloomBlacklist = new List<string> { "Cattails", "Reeds", "MangroveHuge", "Walls", "BG" };

		public static List<string> isHazard = new List<string>
		{
			"Tumblers", "CanyonScor", "Scorpion", "Dynamite", "Cactus", "Waterfall", "Thorns", "PoisonShrooms", "Ivy", "Monstera",
			"Zombie", "Spore", "Explo", "Jellies", "Urchins", "Flash", "Geyser", "Cold"
		};

		public static List<PropSpawner> savedForLater = new List<PropSpawner>();

		public static int[] ids;

		internal static void Postfix(MapHandler __instance)
		{
			WEAREATTHEWALLWOOOOO = false;
			EndingFogWallHandler endingFogWallHandler = ((Component)__instance).gameObject.AddComponent<EndingFogWallHandler>();
			endingFogWallHandler.LoadWallRoutine(__instance);
		}

		internal static void PrintPropList(List<PropSpawner> propList, bool trueBefore)
		{
			if (trueBefore)
			{
				string text = "Heres the list b4 ";
				foreach (PropSpawner prop in propList)
				{
					text = text + ((Object)prop).name + " ";
				}
				Plugin.Log.LogInfo((object)text);
				return;
			}
			string text2 = "Heres the list After ";
			foreach (PropSpawner prop2 in propList)
			{
				text2 = text2 + ((Object)prop2).name + " ";
			}
			Plugin.Log.LogInfo((object)text2);
		}

		internal static void GenerateAlpinePart()
		{
			List<PropSpawner> list = ((Component)MesaOrAlp.transform.GetChild(0)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				bool flag = false;
				foreach (string item2 in MesaBlacklist)
				{
					if (((Object)item).name.StartsWith(item2))
					{
						flag = true;
						break;
					}
				}
				foreach (string item3 in AlpineSaveForLater)
				{
					if (((Object)item).name.StartsWith(item3))
					{
						if (((Object)item).name.StartsWith("Luggage"))
						{
							item.nrOfSpawns *= 5;
						}
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					CreateParamsTemplate((int)((double)item.nrOfSpawns * 0.95), 100, 335, 125, 1200, (int)StartingGenerationPosition.x, (int)StartingGenerationPosition.y - 125 + 530, (int)StartingGenerationPosition.z, 0, -1, 0);
					IEnumerator enumerator4 = SpawnNew(executeDeferredImmediately: true, item);
					while (enumerator4.MoveNext())
					{
					}
				}
			}
			list = ((Component)MesaOrAlp.transform.GetChild(0)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item4 in list)
			{
				if ((Object)(object)item4 == (Object)null)
				{
					continue;
				}
				bool flag2 = true;
				foreach (string item5 in AlpineSaveForLater)
				{
					if (((Object)item4).name.StartsWith(item5))
					{
						if (((Object)item4).name.EndsWith("Mirrage"))
						{
							item4.nrOfSpawns *= 2;
						}
						flag2 = false;
						break;
					}
				}
				if (!flag2)
				{
					savedForLater.Add(item4);
				}
			}
		}

		internal static void GenerateMesaPart()
		{
			List<PropSpawner> list = ((Component)MesaOrAlp.transform.GetChild(0)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				bool flag = false;
				foreach (string item2 in MesaBlacklist)
				{
					if (((Object)item).name.StartsWith(item2))
					{
						flag = true;
						break;
					}
				}
				foreach (string item3 in MesaSaveForLater)
				{
					if (((Object)item).name.StartsWith(item3))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					CreateParamsTemplate((int)((double)item.nrOfSpawns * 1.75), 100, 335, 125, 1500, (int)StartingGenerationPosition.x, (int)StartingGenerationPosition.y - 125 + 530, (int)StartingGenerationPosition.z + 200, 0, -1, 0);
					IEnumerator enumerator4 = SpawnNew(executeDeferredImmediately: true, item);
					while (enumerator4.MoveNext())
					{
					}
				}
			}
			list = ((Component)MesaOrAlp.transform.GetChild(0)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item4 in list)
			{
				if ((Object)(object)item4 == (Object)null)
				{
					continue;
				}
				bool flag2 = true;
				foreach (string item5 in MesaSaveForLater)
				{
					if (((Object)item4).name.StartsWith(item5))
					{
						flag2 = false;
						break;
					}
				}
				if (!flag2)
				{
					savedForLater.Add(item4);
				}
			}
		}

		internal static void GenerateRootPart()
		{
			List<PropSpawner> list = ((Component)TropOrRoot.transform.GetChild(1)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				bool flag = false;
				foreach (string item2 in RootsBlacklist)
				{
					if (((Object)item).name.StartsWith(item2))
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					continue;
				}
				foreach (string item3 in RootsSaveForLater)
				{
					if (((Object)item).name.StartsWith(item3))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					CreateParamsTemplate(((int)((double)item.nrOfSpawns * 0.75) < 1) ? 1 : ((int)((double)item.nrOfSpawns * 0.9)), 100, 335, 125, 1500, (int)StartingGenerationPosition.x, (int)StartingGenerationPosition.y - 25 + 530, (int)StartingGenerationPosition.z + 200, 0, -1, 0);
					IEnumerator enumerator4 = SpawnNew(executeDeferredImmediately: true, item);
					while (enumerator4.MoveNext())
					{
					}
				}
			}
			list = ((Component)TropOrRoot.transform.GetChild(1)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item4 in list)
			{
				bool flag2 = true;
				foreach (string item5 in RootsSaveForLater)
				{
					if (((Object)item4).name.StartsWith(item5))
					{
						flag2 = false;
						break;
					}
				}
				if (!flag2)
				{
					savedForLater.Add(item4);
				}
			}
		}

		internal static void GenerateTropicPart()
		{
			List<PropSpawner> list = ((Component)TropOrRoot.transform.GetChild(0)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				foreach (PropSpawnerConstraint constraint in item.constraints)
				{
					if (((object)constraint).GetType() == typeof(PSC_Height) || ((object)constraint).GetType() == typeof(PSC_RequiredMaterial))
					{
						item.constraints.Remove(constraint);
						break;
					}
				}
				bool flag = false;
				foreach (string item2 in TropicsBlacklist)
				{
					if (((Object)item).name.StartsWith(item2))
					{
						flag = true;
						break;
					}
				}
				foreach (string item3 in TropicsSaveForLater)
				{
					if (((Object)item).name.StartsWith(item3))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					CreateParamsTemplate(((int)((float)item.nrOfSpawns * 0.9f) < 1) ? 1 : ((int)((float)item.nrOfSpawns * 0.9f)), 100, 335, 125, 1200, (int)StartingGenerationPosition.x, (int)StartingGenerationPosition.y - 25 + 530, (int)StartingGenerationPosition.z, 0, -1, 0);
					IEnumerator enumerator5 = SpawnNew(executeDeferredImmediately: true, item);
					while (enumerator5.MoveNext())
					{
					}
				}
			}
			list = ((Component)TropOrRoot.transform.GetChild(0)).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item4 in list)
			{
				bool flag2 = true;
				foreach (string item5 in TropicsSaveForLater)
				{
					if (((Object)item4).name.StartsWith(item5))
					{
						flag2 = false;
						break;
					}
				}
				if (!flag2)
				{
					savedForLater.Add(item4);
				}
			}
		}

		internal static void CreateParamsTemplate(int nos, int floatChance, int areax, int areay, int areaz, int posx, int posy, int posz, int rayx, int rayy, int rayz, int propType = 1)
		{
			Params.Clear();
			Params.Add("nos", nos);
			Params.Add("floatch", floatChance);
			Params.Add("areax", areax);
			Params.Add("areay", areay);
			Params.Add("areaz", areaz);
			Params.Add("posx", posx);
			Params.Add("posy", posy);
			Params.Add("posz", posz);
			Params.Add("rayx", rayx);
			Params.Add("rayy", rayy);
			Params.Add("rayz", rayz);
			Params.Add("type", propType);
		}

		internal static void GenerateTheWallPartBitch()
		{
			List<PropSpawner> list = ((Component)Beach.transform).GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item in list)
			{
				foreach (string item2 in BeachPropsSaveForLater)
				{
					if (((Object)item).name.StartsWith(item2))
					{
						savedForLater.Add(item);
					}
				}
				CreateParamsTemplate((int)((double)item.nrOfSpawns * 0.25), 100, 335, 125, 1200, (int)StartingGenerationPosition.x, (int)StartingGenerationPosition.y + 75 + 530, (int)StartingGenerationPosition.z, 0, -1, 0);
				IEnumerator enumerator3 = SpawnNew(executeDeferredImmediately: true, item);
				while (enumerator3.MoveNext())
				{
				}
			}
		}

		internal static void GenerateTheWallPartCaldera()
		{
			//IL_007c: 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_0168: 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_018d: Unknown result type (might be due to invalid IL or missing references)
			List<PropSpawner> list = Caldera.GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				StartingGenerationPosition = ((Component)item).transform.position;
				bool flag = false;
				foreach (string item2 in CalderaBlacklist)
				{
					if (((Object)item).name == item2)
					{
						((LevelGenStep)item).Clear();
						flag = true;
						break;
					}
				}
				foreach (string item3 in CalderaSaveForLater)
				{
					if (((Object)item).name.StartsWith(item3))
					{
						savedForLater.Add(item);
						flag = true;
						break;
					}
				}
				((LevelGenStep)item).Clear();
				if (!flag)
				{
					CreateParamsTemplate((int)((float)item.nrOfSpawns * 3f), 20, 335, 100, 1200, (int)((Component)item).transform.position.x, (int)((Component)item).transform.position.y + 75, (int)((Component)item).transform.position.z, 0, -1, 0);
					IEnumerator enumerator4 = SpawnNew(executeDeferredImmediately: true, item);
					while (enumerator4.MoveNext())
					{
					}
				}
			}
		}

		internal static void GenerateTheWallPartGloom()
		{
			//IL_007c: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			List<PropSpawner> list = Caldera.GetComponentsInChildren<PropSpawner>(true).ToList();
			PrintPropList(list, trueBefore: true);
			list = list.OrderBy((PropSpawner go) => ((Object)go).name).ToList();
			PrintPropList(list, trueBefore: false);
			foreach (PropSpawner item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				StartingGenerationPosition = ((Component)item).transform.position;
				bool flag = false;
				if (((Object)item).name.StartsWith("Mangrove"))
				{
					item.nrOfSpawns = (int)((float)item.nrOfSpawns * 0.22222f);
				}
				foreach (string item2 in GloomBlacklist)
				{
					if (((Object)item).name.StartsWith(item2))
					{
						((LevelGenStep)item).Clear();
						flag = true;
						break;
					}
				}
				if (flag)
				{
					continue;
				}
				if (((Object)((Component)item).transform.parent).name == "Props")
				{
					if (((Object)item).name.StartsWith("Ghost Fire"))
					{
						item.nrOfSpawns *= 12;
					}
					savedForLater.Add(item);
				}
				else
				{
					((LevelGenStep)item).Clear();
					CreateParamsTemplate((int)((float)item.nrOfSpawns * 3f), 20, 335, 100, 1200, (int)((Component)item).transform.position.x, (int)((Component)item).transform.position.y + 75, (int)((Component)item).transform.position.z, 0, -1, 0);
					IEnumerator enumerator3 = SpawnNew(executeDeferredImmediately: true, item);
					while (enumerator3.MoveNext())
					{
					}
				}
			}
		}

		internal static Vector3 GetPosFromDic()
		{
			//IL_003d: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			Params.TryGetValue("posx", out var value);
			Params.TryGetValue("posy", out var value2);
			Params.TryGetValue("posz", out var value3);
			return new Vector3((float)value, (float)value2, (float)value3);
		}

		internal static Vector3 GetAreaFromDic()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			Params.TryGetValue("areax", out var value);
			Params.TryGetValue("areay", out var value2);
			Params.TryGetValue("areaz", out var value3);
			return new Vector3((float)value * 0.5f, (float)value2 * 0.5f, (float)value3 * 0.5f);
		}

		internal static Vector3 GetRayFromDic()
		{
			//IL_003d: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			Params.TryGetValue("rayx", out var value);
			Params.TryGetValue("rayy", out var value2);
			Params.TryGetValue("rayz", out var value3);
			return new Vector3((float)value, (float)value2, (float)value3);
		}

		internal static void BecomeBig(GameObject game, float min, float max, bool canGargantuan)
		{
		}

		internal static IEnumerator SpawnNew(bool executeDeferredImmediately, PropSpawner __instance)
		{
			foreach (PropSpawnerConstraint c in __instance.constraints)
			{
				if (((object)c).GetType() == typeof(PSC_Height) || ((object)c).GetType() == typeof(PSC_RequiredMaterial))
				{
					__instance.constraints.Remove(c);
					break;
				}
			}
			Physics.SyncTransforms();
			Params.TryGetValue("nos", out var realSpawnCount);
			int maxAttempts = Mathf.Min(Mathf.Max(5000, 100 * realSpawnCount), 50000);
			int successfulSpawns = 0;
			int numTotalAttempts = 0;
			int numFailedSpawns = 0;
			while (successfulSpawns + numFailedSpawns < realSpawnCount && numTotalAttempts < maxAttempts)
			{
				int numConsecutiveAttempts = 0;
				while (numConsecutiveAttempts < 1500)
				{
					numTotalAttempts++;
					numConsecutiveAttempts++;
					if (TrySpawn(successfulSpawns, __instance))
					{
						successfulSpawns++;
						if (__instance.syncTransforms)
						{
							Physics.SyncTransforms();
						}
						break;
					}
				}
				if (numConsecutiveAttempts == 1500)
				{
					numFailedSpawns++;
				}
			}
			if (numTotalAttempts == maxAttempts)
			{
				Plugin.Log.LogInfo((object)$"{((Object)((Component)__instance).gameObject).name} failed to spawn all {realSpawnCount} props after {maxAttempts} tries!!");
			}
			else if (numFailedSpawns > 0)
			{
				Plugin.Log.LogInfo((object)$"{((Object)((Component)__instance).gameObject).name} failed to spawn {numFailedSpawns} props due to failing too many times in a row.");
			}
			__instance.currentSpawns = ((Component)__instance).transform.childCount;
			foreach (object item in __instance.SpawnDecor())
			{
				_ = item;
				yield return null;
			}
			foreach (PostSpawnBehavior postSpawnBehavior in __instance.postSpawnBehaviors)
			{
				if (!postSpawnBehavior.mute && !executeDeferredImmediately && (int)postSpawnBehavior.DeferredTiming == 2)
				{
					__instance._deferredSteps.Add(postSpawnBehavior.ConstructDeferred((IMayHaveDeferredStep)(object)__instance));
				}
			}
			Params.TryGetValue("floatch", out var chance);
			if ((float)chance > 0f)
			{
				foreach (GameObject g in __instance.SpawnedProps)
				{
					g.transform.Rotate(((Random)(ref Randomizer)).NextFloat(0f, 360f), ((Random)(ref Randomizer)).NextFloat(0f, 360f), ((Random)(ref Randomizer)).NextFloat(0f, 360f));
				}
			}
			Params.TryGetValue("type", out var type);
			switch (type)
			{
			case 3:
				foreach (GameObject g3 in __instance.SpawnedProps)
				{
					if (((Object)__instance).name.StartsWith("Cold"))
					{
						BecomeBig(g3, 0.15f, 1f, canGargantuan: false);
					}
					else
					{
						BecomeBig(g3, 0.15f, 2f, canGargantuan: true);
					}
				}
				yield break;
			case 2:
				foreach (GameObject g2 in __instance.SpawnedProps)
				{
					BecomeBig(g2, 0.5f, 2f, canGargantuan: false);
				}
				yield break;
			}
			foreach (GameObject g4 in __instance.SpawnedProps)
			{
				BecomeBig(g4, 0.75f, 1.5f, canGargantuan: false);
			}
		}

		internal static bool TrySpawn(int currentSpawnCount, PropSpawner __instance)
		{
			SpawnData point = GetPoint(__instance);
			if (point == null)
			{
				return false;
			}
			if (__instance.constraints != null)
			{
				bool flag = false;
				foreach (string specialCase in SpecialCases)
				{
					if (((Object)__instance).name.StartsWith(specialCase))
					{
						flag = true;
					}
				}
				try
				{
					if (!PropSpawner.AllConstraintsPass((IEnumerable<PropSpawnerConstraint>)__instance.constraints, point) && !flag)
					{
						return false;
					}
				}
				catch
				{
				}
			}
			point.spawnCount = currentSpawnCount;
			GameObject val = __instance.Spawn(point);
			if ((Object)(object)val != (Object)null)
			{
				__instance.AllSpawnData[val] = point;
				val.transform.parent = Caldera.transform;
			}
			return (Object)(object)val != (Object)null;
		}

		internal static SpawnData GetPoint(PropSpawner __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			//IL_00bf: 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_00d6: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//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_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Expected O, but got Unknown
			Vector3 val = GetPosFromDic();
			Vector3 val2 = Vector2.op_Implicit(new Vector2(Random.value, Random.value));
			Vector3 areaFromDic = GetAreaFromDic();
			Params.TryGetValue("type", out var value);
			float num = ((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.y, areaFromDic.y);
			float num2 = ((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.y, areaFromDic.y);
			float num3 = ((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.z, areaFromDic.z);
			float num4 = ((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.z, areaFromDic.z);
			switch (value)
			{
			case 1:
				val += new Vector3(((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.x, areaFromDic.x), ((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.y, areaFromDic.y), Mathf.Min(num3, num4));
				break;
			case 2:
				val += new Vector3(((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.x, areaFromDic.x), Mathf.Min(num, num2), Mathf.Max(num3, num4));
				break;
			case 3:
				val += new Vector3(((Random)(ref Randomizer)).NextFloat(0f - areaFromDic.x, areaFromDic.x), Mathf.Max(num, num2), Mathf.Min(num3, num4));
				break;
			}
			Params.TryGetValue("floatch", out var value2);
			if (((Random)(ref Randomizer)).NextFloat(1f, 101f) > (float)(100 - value2))
			{
				__instance.constraints.Clear();
				return new SpawnData
				{
					pos = val,
					normal = -((Component)__instance).transform.forward,
					rayDir = ((Component)__instance).transform.forward,
					hit = default(RaycastHit),
					spawnerTransform = ((Component)__instance).transform,
					placement = Vector2.op_Implicit(val2)
				};
			}
			Vector3 val3 = val;
			Vector3 val4 = val;
			Vector3 rayFromDic = GetRayFromDic();
			RaycastHit hit = HelperFunctions.LineCheck(val3, val4 + ((Vector3)(ref rayFromDic)).normalized * 1000f, (LayerType)1, 0f, (QueryTriggerInteraction)1);
			if (Object.op_Implicit((Object)(object)((RaycastHit)(ref hit)).transform))
			{
				if ((((Object)((RaycastHit)(ref hit)).transform).name == "Coll" || ((Object)((RaycastHit)(ref hit)).transform.parent).name == ((Object)WaterTransform).name) && !UseCollForThese.Contains(((Object)__instance).name))
				{
					return null;
				}
				return new SpawnData
				{
					pos = ((RaycastHit)(ref hit)).point,
					normal = ((RaycastHit)(ref hit)).normal,
					rayDir = ((Component)__instance).transform.forward,
					hit = hit,
					spawnerTransform = ((Component)__instance).transform,
					placement = Vector2.op_Implicit(val2)
				};
			}
			return null;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}