Decompiled source of SelectableInteriors v1.2.0

NoteBoxz.SelectableInteriors.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 BepInEx.Logging;
using HarmonyLib;
using LLLselect.Patches;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using NoteBoxz.SelectableInteriors.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;

[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("NoteBoxz.SelectableInteriors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-dev")]
[assembly: AssemblyProduct("LLLselect")]
[assembly: AssemblyTitle("NoteBoxz.SelectableInteriors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LLLselect
{
	[BepInPlugin("NoteBoxz.SelectableInteriors", "LLLselect", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LLLselect : BaseUnityPlugin
	{
		internal static ConfigFile Config = null;

		public const string PLUGIN_VERSION = "1.0.0";

		public static TerminalKeyword InteriorViewKeyword = null;

		public static TerminalNode InteriorViewNode = null;

		public static List<TerminalKeyword> InteriorChangeKeywords = null;

		public static List<TerminalNode> InteriorChangeNodes = null;

		public static int LVidForceing = -1;

		public static bool FullRandom = false;

		public static List<int> ValidIDs = new List<int>();

		public static ConfigEntry<int> DefaultInteriorID = null;

		public static ConfigEntry<bool> DefaultFullRandom = null;

		public static LLLselect Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		internal static Harmony? Harmony { get; set; }

		public static bool IsDependencyLoaded(string pluginGUID)
		{
			return Chainloader.PluginInfos.ContainsKey(pluginGUID);
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Config = ((BaseUnityPlugin)this).Config;
			Instance = this;
			NetcodePatcher();
			Patch();
			RegisterNodes();
			Logger.LogInfo((object)"NoteBoxz.SelectableInteriors v1.2.0 has loaded!");
		}

		public void RegisterNodes()
		{
			InteriorViewNode = CreateBaseTerminalNode("Interior View", "cur level flows:", "SetLV -1");
			InteriorViewKeyword = CreateTerminalKeyword("Interior ViewKW", "listinside", InteriorViewNode);
		}

		public static void AddNoneChangeNode()
		{
			TerminalNode resultNode = CreateBaseTerminalNode("forceNone", "No Interior will be forced!", "SetLV -1");
			TerminalKeyword keyword = CreateTerminalKeyword("forcenonekw", "setinside none", resultNode);
			AddKeywordToTerminal(keyword);
		}

		public static void AddChangeNode(int ID, string name)
		{
			TerminalNode resultNode = CreateBaseTerminalNode($"force{ID}", $"Forcing Interior {name} ({ID}) to be loaded!", $"SetLV {ID}");
			TerminalKeyword keyword = CreateTerminalKeyword($"force{ID}kw", $"setinside {ID}", resultNode);
			AddKeywordToTerminal(keyword);
		}

		public static void AddFullRandomNode()
		{
			TerminalNode resultNode = CreateBaseTerminalNode("forceFullRandom", "Fully Random Interiors will be chosen", "SetLV FullRandom");
			TerminalKeyword keyword = CreateTerminalKeyword("forcefullrandomkw", "setinside fullrandom", resultNode);
			AddKeywordToTerminal(keyword);
		}

		private static TerminalNode CreateBaseTerminalNode(string name, string displayText, string terminalEvent = null)
		{
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			((Object)val).name = name;
			val.displayText = displayText;
			val.clearPreviousText = true;
			val.maxCharactersToType = 35;
			val.buyItemIndex = -1;
			val.buyVehicleIndex = -1;
			val.isConfirmationNode = false;
			val.buyRerouteToMoon = -1;
			val.displayPlanetInfo = -1;
			val.shipUnlockableID = -1;
			val.buyUnlockable = true;
			val.returnFromStorage = false;
			val.itemCost = 0;
			val.creatureFileID = -1;
			val.creatureName = "";
			val.storyLogFileID = -1;
			val.overrideOptions = false;
			val.acceptAnything = false;
			val.loadImageSlowly = false;
			val.persistentImage = false;
			if (terminalEvent != null)
			{
				val.terminalEvent = terminalEvent;
			}
			return val;
		}

		private static TerminalKeyword CreateTerminalKeyword(string name, string word, TerminalNode resultNode)
		{
			TerminalKeyword val = ScriptableObject.CreateInstance<TerminalKeyword>();
			((Object)val).name = name;
			val.word = word;
			val.specialKeywordResult = resultNode;
			return val;
		}

		private static void AddKeywordToTerminal(TerminalKeyword keyword)
		{
			int num = TerminalPatch.nList.allKeywords.Length;
			Array.Resize(ref TerminalPatch.nList.allKeywords, num + 1);
			TerminalPatch.nList.allKeywords[num] = keyword;
			Logger.LogInfo((object)("Added " + keyword.word + " (" + ((Object)keyword).name + ") keyword to Terminal.allKeywords"));
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("NoteBoxz.SelectableInteriors");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		private void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public class LLLSelectSynchronizer : NetworkBehaviour
	{
		public NetworkVariable<int> SelectedIndex = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (!((NetworkBehaviour)this).IsServer)
			{
				NetworkVariable<int> selectedIndex = SelectedIndex;
				selectedIndex.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)selectedIndex.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnSelectedIndexChanged));
			}
		}

		private void OnSelectedIndexChanged(int oldValue, int newValue)
		{
			LLLselect.Logger.LogMessage((object)string.Format("{0}Selected index changed from {1} to {2}", ((NetworkBehaviour)this).IsServer ? "" : "(Synced) ", oldValue, newValue));
		}

		private void Update()
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				SelectedIndex.Value = LLLselect.LVidForceing;
			}
			else
			{
				LLLselect.LVidForceing = SelectedIndex.Value;
			}
		}

		protected override void __initializeVariables()
		{
			if (SelectedIndex == null)
			{
				throw new Exception("LLLSelectSynchronizer.SelectedIndex cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SelectedIndex).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SelectedIndex, "SelectedIndex");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SelectedIndex);
			((NetworkBehaviour)this).__initializeVariables();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LLLSelectSynchronizer";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "NoteBoxz.SelectableInteriors";

		public const string PLUGIN_NAME = "LLLselect";

		public const string PLUGIN_VERSION = "1.2.0";
	}
}
namespace LLLselect.Patches
{
	[HarmonyPatch(typeof(RoundManager))]
	public class RoundManagerPatch
	{
		public static Dictionary<SelectableLevel, IntWithRarity[]> InitalRaries = new Dictionary<SelectableLevel, IntWithRarity[]>();

		public static bool Newfloor;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void AwakePostFix(RoundManager __instance)
		{
			((Component)__instance).gameObject.AddComponent<LLLSelectSynchronizer>();
			LLLselect.Logger.LogDebug((object)"LLLSelectSynchronizer added to RoundManager");
		}

		[HarmonyPatch("GenerateNewFloor")]
		[HarmonyPrefix]
		public static void GenerateNewFloorPreFix()
		{
			Newfloor = true;
		}

		[HarmonyPatch("GenerateNewFloor")]
		[HarmonyPostfix]
		public static void GenerateNewFloorPostFix()
		{
			Newfloor = false;
		}

		[HarmonyPatch("GetRandomWeightedIndex")]
		[HarmonyPrefix]
		public static bool Prefix(int[] weights, Random randomSeed, ref int __result)
		{
			if (Newfloor)
			{
				LLLselect.Logger.LogInfo((object)$"RandomWeightIndex called when loading new floor with {randomSeed} seed and {weights.Length} weights");
				if (LLLselect.ValidIDs.Contains(LLLselect.LVidForceing))
				{
					__result = LLLselect.LVidForceing;
					LLLselect.Logger.LogMessage((object)$"Forced ID: {LLLselect.LVidForceing}");
					if (RoundManager.Instance.currentLevel.dungeonFlowTypes.Length - 1 < __result)
					{
						LLLselect.Logger.LogWarning((object)$"Current Level doesn't have {__result} as a flow type! Injecting flow...");
						if (!InitalRaries.ContainsKey(RoundManager.Instance.currentLevel))
						{
							InitalRaries.Add(RoundManager.Instance.currentLevel, RoundManager.Instance.currentLevel.dungeonFlowTypes);
						}
						Array.Resize(ref RoundManager.Instance.currentLevel.dungeonFlowTypes, __result + 1);
					}
					if (RoundManager.Instance.currentLevel.dungeonFlowTypes[__result] != StartOfRoundPatch.FlowTypes[__result])
					{
						RoundManager.Instance.currentLevel.dungeonFlowTypes[__result] = StartOfRoundPatch.FlowTypes[__result];
						LLLselect.Logger.LogMessage((object)$"Injected flow at index {__result}");
					}
					return false;
				}
				if (InitalRaries.ContainsKey(RoundManager.Instance.currentLevel))
				{
					int num = RoundManager.Instance.currentLevel.dungeonFlowTypes.Length;
					int num2 = InitalRaries[RoundManager.Instance.currentLevel].Length;
					LLLselect.Logger.LogMessage((object)("Resetting " + RoundManager.Instance.currentLevel.PlanetName + "'s flows back to default" + $" ({num} -> {num2})"));
					RoundManager.Instance.currentLevel.dungeonFlowTypes = InitalRaries[RoundManager.Instance.currentLevel];
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatch
	{
		public static List<IntWithRarity> FlowTypes = new List<IntWithRarity>();

		[HarmonyPatch("StartGame")]
		[HarmonyPrefix]
		public static void StartGamePreFix(StartOfRound __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer)
			{
				if (LLLselect.DefaultInteriorID.Value != -1)
				{
					LLLselect.LVidForceing = LLLselect.DefaultInteriorID.Value;
					LLLselect.Logger.LogInfo((object)$"DefaultInteriorID is set to {LLLselect.DefaultInteriorID.Value}");
				}
				if (LLLselect.FullRandom)
				{
					Random random = new Random(__instance.randomMapSeed);
					int index = Random.Range(0, LLLselect.ValidIDs.Count);
					LLLselect.LVidForceing = LLLselect.ValidIDs[index];
					LLLselect.Logger.LogInfo((object)$"FullRandom is set to true, returning random LV id {LLLselect.LVidForceing} (possible ids: 0-{LLLselect.ValidIDs.Count - 1})");
				}
			}
		}

		public static void SetFlows(StartOfRound __instance)
		{
			List<string> list = new List<string>();
			list.AddRange(LLL_GETMOONFLOWS());
			PopulateFlowTypes();
			LLLselect.AddNoneChangeNode();
			LLLselect.AddFullRandomNode();
			string text = string.Join("\n", list);
			LLLselect.InteriorViewNode.displayText = "Possible Interiors: \n" + text + " \n \n Use the command 'SetInside ID' to force an interior to be loaded \n";
			LLLselect.DefaultInteriorID = LLLselect.Config.Bind<int>("General", "Default Interior ID", -1, "Default Interior ID to be forced whenever the game is started. (Set to -1 to not use) Possible Flows: \n" + text);
			LLLselect.DefaultFullRandom = LLLselect.Config.Bind<bool>("General", "Full Random", false, "If true, a random interior will be selected every time a new floor is generated. (Default: false)");
			LLLselect.FullRandom = LLLselect.DefaultFullRandom.Value;
			if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
			{
				BindLCConfigs();
			}
		}

		public static void BindLCConfigs()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			LethalConfigManager.SetModDescription("Allows you to select which interior will be loaded");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(LLLselect.DefaultInteriorID));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(LLLselect.DefaultFullRandom));
		}

		public static void PopulateFlowTypes()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			FlowTypes = new List<IntWithRarity>();
			for (int i = 0; i < LLLselect.ValidIDs.Count; i++)
			{
				FlowTypes.Add(new IntWithRarity());
			}
			foreach (ExtendedDungeonFlow extendedDungeonFlow in PatchedContent.ExtendedDungeonFlows)
			{
				if (LLLselect.ValidIDs.Contains(extendedDungeonFlow.DungeonID))
				{
					LLLselect.Logger.LogInfo((object)$"Adding {extendedDungeonFlow.DungeonName} ({extendedDungeonFlow.DungeonID}) to the flowTypes list");
					IntWithRarity val = new IntWithRarity();
					val.id = extendedDungeonFlow.DungeonID;
					val.overrideLevelAmbience = null;
					FlowTypes[extendedDungeonFlow.DungeonID] = val;
				}
			}
		}

		public static List<string> LLL_GETMOONFLOWS()
		{
			List<string> list = new List<string>();
			foreach (ExtendedDungeonFlow extendedDungeonFlow in PatchedContent.ExtendedDungeonFlows)
			{
				list.Add($"{extendedDungeonFlow.DungeonName} ({extendedDungeonFlow.DungeonID})");
				if (!LLLselect.ValidIDs.Contains(extendedDungeonFlow.DungeonID))
				{
					LLLselect.ValidIDs.Add(extendedDungeonFlow.DungeonID);
				}
				LLLselect.AddChangeNode(extendedDungeonFlow.DungeonID, extendedDungeonFlow.DungeonName);
			}
			return list;
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class TerminalPatch
	{
		public static TerminalNodesList nList;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Start(Terminal __instance)
		{
			if (__instance.terminalNodes.allKeywords != null)
			{
				nList = __instance.terminalNodes;
				int num = __instance.terminalNodes.allKeywords.Length;
				Array.Resize(ref __instance.terminalNodes.allKeywords, num + 1);
				__instance.terminalNodes.allKeywords[num] = LLLselect.InteriorViewKeyword;
				LLLselect.Logger.LogInfo((object)"Added LLLselect keyword to Terminal.allKeywords");
				StartOfRoundPatch.SetFlows(StartOfRound.Instance);
			}
			else
			{
				LLLselect.Logger.LogWarning((object)"Unable to add LLLselect keyword: allKeywords is null");
			}
		}

		[HarmonyPatch("RunTerminalEvents")]
		[HarmonyPostfix]
		public static void RunTerminalEventsPatch(TerminalNode node)
		{
			try
			{
				if (node.terminalEvent.StartsWith("SetLV"))
				{
					string[] array = node.terminalEvent.Split(' ');
					if (array[1] == "FullRandom")
					{
						LLLselect.FullRandom = true;
						LLLselect.Logger.LogInfo((object)"Changed level to FullRandom");
					}
					else
					{
						int num = (LLLselect.LVidForceing = int.Parse(array[1]));
						LLLselect.FullRandom = false;
						LLLselect.Logger.LogInfo((object)$"Changed level to {num}");
					}
				}
			}
			catch
			{
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace NoteBoxz.SelectableInteriors.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}