Decompiled source of LethalConstellations v0.2.5

LethalConstellations.dll

Decompiled a month ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using LethalConfig;
using LethalConstellations.Compat;
using LethalConstellations.ConfigManager;
using LethalConstellations.EventStuff;
using LethalConstellations.PluginCore;
using LethalLevelLoader;
using LethalLevelLoader.Tools;
using LethalNetworkAPI;
using LethalNetworkAPI.Utils;
using Microsoft.CodeAnalysis;
using OpenLib;
using OpenLib.Common;
using OpenLib.Compat;
using OpenLib.ConfigManager;
using OpenLib.CoreMethods;
using OpenLib.Events;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LethalConstellations")]
[assembly: AssemblyDescription("https://github.com/darmuh/LethalConstellations")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalConstellations")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e2700abc-7bc7-4bd0-b787-effe68445b6a")]
[assembly: AssemblyFileVersion("0.2.5")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace LethalConstellations
{
	[BepInPlugin("com.github.darmuh.LethalConstellations", "LethalConstellations", "0.2.5")]
	[BepInDependency("imabatby.lethallevelloader", "1.3.8")]
	[BepInDependency("darmuh.OpenLib", "0.2.5")]
	public class Plugin : BaseUnityPlugin
	{
		public static class PluginInfo
		{
			public const string PLUGIN_GUID = "com.github.darmuh.LethalConstellations";

			public const string PLUGIN_NAME = "LethalConstellations";

			public const string PLUGIN_VERSION = "0.2.5";
		}

		public static Plugin instance;

		internal static ManualLogSource Log;

		public bool LethalMoonUnlocks;

		public bool LethalNetworkAPI;

		public Terminal Terminal;

		public TerminalNode dummyNode;

		private void Awake()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"LethalConstellations is loading with version 0.2.5!");
			Subscribers.Subscribe();
			Configuration.GeneratedConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, "LethalConstellations_Generated.cfg"), true);
			Configuration.BindConfigSettings();
			Log.LogInfo((object)"LethalConstellations load complete!");
		}

		internal static void MoreLogs(string message)
		{
			if (Configuration.ExtensiveLogging.Value)
			{
				Log.LogInfo((object)message);
			}
		}

		internal static void Spam(string message)
		{
			if (Configuration.DeveloperLogging.Value)
			{
				Log.LogDebug((object)message);
			}
		}

		internal static void ERROR(string message)
		{
			Log.LogError((object)message);
		}

		internal static void WARNING(string message)
		{
			Log.LogWarning((object)message);
		}
	}
}
namespace LethalConstellations.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("LethalConstellations.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace LethalConstellations.ConfigManager
{
	public static class Configuration
	{
		public static ConfigFile GeneratedConfig;

		internal static ConfigEntry<string> MainConfigCode;

		internal static ConfigEntry<string> GeneratedConfigCode;

		public static ConfigEntry<bool> ExtensiveLogging { get; internal set; }

		public static ConfigEntry<bool> DeveloperLogging { get; internal set; }

		public static ConfigEntry<string> ConstellationList { get; internal set; }

		public static ConfigEntry<bool> HideUnaffordableConstellations { get; internal set; }

		public static ConfigEntry<bool> ModifyMoonPrices { get; internal set; }

		public static ConfigEntry<string> IgnoreList { get; internal set; }

		public static ConfigEntry<bool> RequireConfirmation { get; internal set; }

		public static ConfigEntry<string> AddHintTo { get; internal set; }

		public static ConfigEntry<string> CompanyDefaultConstellation { get; internal set; }

		public static ConfigEntry<bool> ConstellationsUseFauxWords { get; internal set; }

		public static ConfigEntry<string> ConstellationsWord { get; internal set; }

		public static ConfigEntry<string> ConstellationWord { get; internal set; }

		public static ConfigEntry<string> ConstellationsShortcuts { get; internal set; }

		public static ConfigEntry<string> ConstellationsHintText { get; internal set; }

		public static ConfigEntry<string> ConstellationsInfoText { get; internal set; }

		public static ConfigEntry<bool> ConstellationSpecificInfoNodes { get; internal set; }

		public static void BindConfigSettings()
		{
			Plugin.Log.LogInfo((object)"Binding configuration settings");
			ExtensiveLogging = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Debug", "ExtensiveLogging", false, "Enable or Disable extensive logging for this mod.");
			DeveloperLogging = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Debug", "DeveloperLogging", false, "Enable or Disable developer logging for this mod. (this will fill your log file FAST)");
			ConstellationList = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "ConstellationList", "", "Comma separated list of your ConstellationWord Names, or leave blank for default LLL moon tags");
			CompanyDefaultConstellation = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "CompanyDefaultConstellation", "", "The company's default constellation.\nThis constellation will be assigned when loading saves starting at the company moon.");
			IgnoreList = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "IgnoreList", "Liquidation,Moon2Example", "Comma separated list of moon names that should not be touched by this mod.\nGenerally you'll almost always have Liquidation in this list until it's a real moon as well as any moons you dont want associated with any particular constellation");
			ModifyMoonPrices = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "ModifyMoonPrices", true, "Disable this to stop this mod from modifying any moon prices");
			RequireConfirmation = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "RequireConfirmation", true, "Enable this to require add a confirmation check before routing to a constellation and spending credits");
			HideUnaffordableConstellations = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "HideUnaffordableConstellations", false, "Enable this to hide constellations that you can't afford to route to.");
			AddHintTo = ConfigSetup.MakeClampedString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "AddHintTo", "both", "Choose where to add hints to the main 'constellations' command", new AcceptableValueList<string>(new string[4] { "both", "none", "help", "other" }));
			ConstellationSpecificInfoNodes = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "ConstellationSpecificInfoNodes", false, "Enable this to add config options to the dynamic config for each constellation to have info nodes with customizable text");
			ConstellationsUseFauxWords = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "ConstellationsUseFauxWords", true, "Disable this to use normal terminal keywords instead of Faux Keywords.\nWith this enabled you can only use a constellation word to route to it when in the constellations menu.");
			ConstellationsWord = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Customization", "ConstellationsWord", "Constellations", "Use this config item to change any instance of the word 'Constellations' with your own specific word.\nThe terminal keyword will use this one!!!");
			ConstellationWord = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Customization", "ConstellationWord", "Constellation", "Use this config item to change any instance of the word 'Constellation' with your own specific word.");
			ConstellationsShortcuts = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Customization", "ConstellationsShortcut", "", "Specify a list of shortcuts to use for the constellations menu command.\nEach shortcut keyword is separated by a ','");
			ConstellationsHintText = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Customization", "ConstellationsHintText", ">[keyword]\nTo display Constellations available for routing", "text displayed for the hint added to commands like 'help' and 'other' regarding the constellations menu command");
			ConstellationsInfoText = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Customization", "ConstellationsInfoText", "Use this command to display Constellations available for routing.\n\nRoute to a specific constellation to update your moons listing!\r\n\r\n", "Use this config item to change any instance of the word 'ConstellationWord' with your own specific word");
			MainConfigCode = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Tools", "MainConfigCode", "", "Paste a code here from the web config editor for the main config\nWARNING: Some settings require a complete relaunch of the game and sometimes even deleting a previously generated config!");
			GeneratedConfigCode = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Tools", "GeneratedConfigCode", "", "Paste a code here from the web config editor for the generated config.\nThis will only apply if you have already loaded into the lobby once.");
			((BaseUnityPlugin)Plugin.instance).Config.Save();
			ConfigSetup.RemoveOrphanedEntries(((BaseUnityPlugin)Plugin.instance).Config);
			Collections.ConstellationWord = ConstellationWord.Value;
			Collections.ConstellationsWord = ConstellationsWord.Value;
		}
	}
}
namespace LethalConstellations.PluginCore
{
	public class ClassMapper
	{
		public string consName;

		public List<string> constelMoons = new List<string>();

		public List<string> stayHiddenMoons = new List<string>();

		public bool buyOnce;

		public int constelPrice;

		public string defaultMoon;

		public ExtendedLevel defaultMoonLevel;

		internal string menuText;

		internal string infoText;

		public bool isHidden;

		public string optionalParams = "";

		public bool isLocked;

		public bool oneTimePurchase;

		public bool canRouteCompany;

		internal string shortcutList;

		internal ClassMapper(string cName, int cPrice = 0, string defMoon = "", string menuText = "")
		{
			consName = cName;
			constelPrice = cPrice;
			defaultMoon = defMoon;
			this.menuText = menuText;
			oneTimePurchase = false;
			isLocked = false;
		}

		internal static void UpdateCNames(List<ClassMapper> constellations, Dictionary<string, string> fixedNames)
		{
			if (constellations.Count < 1 || fixedNames.Count < 1)
			{
				return;
			}
			foreach (KeyValuePair<string, string> fixedName in fixedNames)
			{
				if (CheckForAndUpdateCName(constellations, fixedName.Key, fixedName.Value))
				{
					Plugin.Spam("CheckForAndUpadteCName success");
				}
			}
		}

		public static bool TryGetConstellation(List<ClassMapper> constellations, string query, out ClassMapper outConst)
		{
			Plugin.Spam("TryGetConstellation:");
			Plugin.Spam(query);
			if (constellations.Count < 1 || query.Length < 1)
			{
				Plugin.Spam("Invalid search in TryGetConstellation()");
				outConst = null;
				return false;
			}
			foreach (ClassMapper constellation in constellations)
			{
				if (constellation.consName.ToLower() == query.ToLower() || constellation.shortcutList.ToLower().Contains(query.ToLower()))
				{
					Plugin.Spam("constellation found with name: " + constellation.consName);
					outConst = constellation;
					return true;
				}
			}
			Plugin.Spam("Cannot find " + query);
			outConst = null;
			return false;
		}

		internal static bool CheckForAndUpdateCName(List<ClassMapper> constellations, string query, string newValue)
		{
			if (constellations.Count < 1 || query.Length < 1)
			{
				Plugin.Spam("Invalid search in CheckForCName()");
				return false;
			}
			foreach (ClassMapper constellation in constellations)
			{
				if (constellation.consName == query)
				{
					constellation.consName = newValue;
					Plugin.Spam("bad name " + query + " updated to " + constellation.consName);
					return true;
				}
			}
			Plugin.Spam("Unable to find bad name - " + query);
			return false;
		}

		internal static void UpdateConstellationUnlocks()
		{
			if (Collections.ConstellationsOTP.Count == 0)
			{
				return;
			}
			foreach (string item in Collections.ConstellationsOTP)
			{
				if (TryGetConstellation(Collections.ConstellationStuff, item, out ClassMapper outConst) && outConst != null)
				{
					if (outConst.buyOnce && !outConst.oneTimePurchase)
					{
						outConst.oneTimePurchase = true;
					}
					Plugin.Spam(outConst.consName + " detected as unlocked from save file");
				}
			}
		}

		internal static void ResetUnlockedConstellations(List<ClassMapper> constellations)
		{
			if (constellations.Count == 0)
			{
				return;
			}
			foreach (ClassMapper constellation in constellations)
			{
				constellation.oneTimePurchase = false;
				Plugin.Spam(constellation.consName + " OTP has been reset");
			}
		}
	}
	public class Collections
	{
		internal static List<string> ConstellationsList = new List<string>();

		public static List<ClassMapper> ConstellationStuff = new List<ClassMapper>();

		internal static Dictionary<string, string> ConstellationCats = new Dictionary<string, string>();

		internal static Dictionary<ExtendedLevel, int> MoonPrices = new Dictionary<ExtendedLevel, int>();

		internal static Dictionary<string, string> CNameFix = new Dictionary<string, string>();

		internal static string CompanyMoon = "Gordion";

		public static string CurrentConstellation = "";

		internal static string ConstellationsWord;

		internal static string ConstellationWord;

		internal static TerminalNode ConstellationsNode;

		internal static List<string> ConstellationsOTP = new List<string>();

		internal static void Start()
		{
			MoonPrices.Clear();
		}
	}
	internal class MainMenu
	{
		internal static string MainMenuText(string MainMenuText, Dictionary<string, string> Categories)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(MainMenuText + "\r\n");
			stringBuilder.Append("Current " + Collections.ConstellationWord + ": " + Collections.CurrentConstellation + "\r\n\r\n");
			if (Categories.Count > 0)
			{
				foreach (KeyValuePair<string, string> Category in Categories)
				{
					stringBuilder.Append("[" + Category.Key.ToUpper() + "]\r\n" + Category.Value + "\r\n\r\n");
				}
			}
			else
			{
				stringBuilder.Append("Unable to route to any " + Collections.ConstellationsWord + " at this time!\r\n\r\n");
			}
			return stringBuilder.ToString();
		}

		internal static string ReturnMainMenu()
		{
			MenuStuff.CreateConstellationCategories();
			return MainMenuText("========== " + Collections.ConstellationsWord + " Routing Matrix ==========\r\n", Collections.ConstellationCats);
		}
	}
	internal class MenuStuff
	{
		internal static bool makeMenus;

		internal static void PreInit()
		{
			if (FixBadConfig())
			{
				Plugin.Spam("ConstellationWord custom words updated to " + Collections.ConstellationsWord);
			}
			if (FixBadNames())
			{
				UpdateBadNames();
			}
			Init();
		}

		internal static void Init()
		{
			Plugin.Spam("CreateConstellationCategories()");
			CreateConstellationCategories();
			Plugin.Spam("ConstellationsMainMenu()");
			ConstellationsMainMenu();
			Plugin.Spam("CreateConstellationCommands()");
			CreateConstellationCommands();
			CreateDummyNode();
			MoonStuff.ModifyMoonPrices();
		}

		internal static void UpdateBadNames()
		{
			Plugin.Spam("Updating dictionaries with corrected ConstellationWord Names");
			ClassMapper.UpdateCNames(Collections.ConstellationStuff, Collections.CNameFix);
		}

		internal static bool FixBadConfig()
		{
			if (DynamicBools.TryGetKeyword(Collections.ConstellationsWord))
			{
				Collections.ConstellationsWord = GetCleanKeyWord();
				Collections.ConstellationWord = Collections.ConstellationsWord;
				return true;
			}
			return false;
		}

		internal static bool FixBadNames()
		{
			if (Collections.ConstellationsList.Count < 1 || Configuration.ConstellationsUseFauxWords.Value)
			{
				return false;
			}
			Collections.CNameFix.Clear();
			List<string> list = new List<string>();
			int num = 0;
			foreach (string constellations in Collections.ConstellationsList)
			{
				if (DynamicBools.TryGetKeyword(constellations))
				{
					Plugin.Spam("Keyword already exists for " + constellations);
					string cleanKeyWord = GetCleanKeyWord();
					Collections.CNameFix.Add(constellations, cleanKeyWord);
					list.Add(cleanKeyWord);
					num++;
				}
				else
				{
					list.Add(constellations);
				}
			}
			if (num > 0)
			{
				Collections.ConstellationsList = list;
				Plugin.Spam("ConstellationsList replaced with newList with VALID KEYWORDS");
				return true;
			}
			return false;
		}

		internal static string GetCleanKeyWord()
		{
			for (int i = 0; i < StartOfRound.Instance.randomNames.Length - 1; i++)
			{
				Random random = new Random();
				int num = random.Next(0, StartOfRound.Instance.randomNames.Length);
				string text = StartOfRound.Instance.randomNames[num];
				if (!DynamicBools.TryGetKeyword(text))
				{
					return text;
				}
			}
			return "invalidWord";
		}

		internal static void CreateConstellationCategories()
		{
			Collections.ConstellationCats.Clear();
			if (Collections.ConstellationStuff.Count < 1)
			{
				return;
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				Plugin.Spam(item.consName + " category creation");
				int count = item.constelMoons.Count;
				if (count >= 1)
				{
					string menuText = item.menuText;
					string defaultMoon = item.defaultMoon;
					string newValue = "";
					if ((Object)(object)item.defaultMoonLevel == (Object)null)
					{
						Plugin.WARNING(item.consName + " defaultMoonLevel is NULL. This will affect performance of the mod");
					}
					else
					{
						newValue = TerminalManager.GetWeatherConditions(item.defaultMoonLevel);
					}
					int constPrice = LevelStuff.GetConstPrice(item.consName);
					menuText = menuText.Replace("[~t]", "\t").Replace("[~n]", "\n").Replace("[name]", item.consName)
						.Replace("[price]", $"{constPrice}")
						.Replace("[defaultmoon]", defaultMoon ?? "")
						.Replace("[currentweather]", newValue)
						.Replace("[optionals]", item.optionalParams);
					if ((!Configuration.HideUnaffordableConstellations.Value || constPrice <= Plugin.instance.Terminal.groupCredits) && !item.isHidden)
					{
						Collections.ConstellationCats.Add(item.consName, menuText);
					}
				}
			}
		}

		internal static void ConstellationsMainMenu()
		{
			Plugin.Spam($"{Collections.ConstellationCats.Count}");
			Collections.ConstellationsNode = AddingThings.AddNodeManual("Constellations_Menu", Collections.ConstellationsWord, (Func<string>)MainMenu.ReturnMainMenu, true, 0, ConfigSetup.defaultListing, 0, (Func<string>)null, (Func<string>)null, "", "", false, 1, "", false, "");
			TerminalNode val = BasicTerminal.CreateNewTerminalNode();
			val.displayText = Configuration.ConstellationsInfoText.Value + "\r\n";
			val.clearPreviousText = true;
			TerminalKeyword val2 = default(TerminalKeyword);
			if (DynamicBools.TryGetKeyword("info", ref val2))
			{
				AddingThings.AddCompatibleNoun(ref val2, Collections.ConstellationsWord.ToLower(), val);
				Plugin.Spam("Adding info stuff");
			}
			if (Configuration.ConstellationsShortcuts.Value.Length > 0)
			{
				List<string> keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(Configuration.ConstellationsShortcuts.Value, ',');
				foreach (string item in keywordsPerConfigItem)
				{
					AddingThings.AddKeywordToExistingNode(item, Collections.ConstellationsNode, true);
					Plugin.Spam(item + " added to ConstellationsNode");
					if ((Object)(object)val2 != (Object)null)
					{
						AddingThings.AddCompatibleNoun(ref val2, item.ToLower(), val);
					}
				}
			}
			AddHintsToNodes();
		}

		internal static void AddHintsToNodes()
		{
			string text = Configuration.ConstellationsHintText.Value.Replace("[keyword]", Collections.ConstellationsWord.ToUpper() ?? "");
			TerminalNode val = default(TerminalNode);
			if (LogicHandling.TryGetFromAllNodes("OtherCommands", ref val))
			{
				if (Configuration.AddHintTo.Value == "both" || Configuration.AddHintTo.Value == "help")
				{
					AddingThings.AddToHelpCommand(text ?? "");
				}
				if (Configuration.AddHintTo.Value == "both" || Configuration.AddHintTo.Value == "other")
				{
					AddingThings.AddToExistingNodeText("\n" + text, ref val);
				}
			}
		}

		internal static void CreateDummyNode()
		{
			Plugin.instance.dummyNode = AddingThings.CreateDummyNode("constellations_dummy", true, "");
		}

		private static void AddConstellationRoute(bool FauxWord, bool confirmation, ClassMapper item)
		{
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			if (confirmation)
			{
				if (FauxWord)
				{
					FauxKeyword val = new FauxKeyword(Collections.ConstellationsWord.ToLower(), item.consName.ToLower(), (Func<string>)LevelStuff.AskRouteConstellation);
					val.AddConfirm((Func<string>)LevelStuff.RouteConstellation, (Func<string>)LevelStuff.DenyRouteConstellation);
					AddingThings.AddToFauxListing(val, ConfigSetup.defaultListing);
					Plugin.Spam("route command for " + item.consName + " added");
					AddShortcuts(item, FauxWords: true, addConfirm: true);
					return;
				}
				TerminalNode val2 = AddingThings.AddNodeManual(item.consName ?? "", item.consName.ToLower() ?? "", (Func<string>)LevelStuff.AskRouteConstellation, true, 1, ConfigSetup.defaultListing, 0, (Func<string>)LevelStuff.RouteConstellation, (Func<string>)LevelStuff.DenyRouteConstellation, "", "", false, 1, "", true, "");
				if (item.consName.Any((char c) => !char.IsLetterOrDigit(c)))
				{
					CommandRegistry.AddSpecialListString(ref ConfigSetup.defaultListing, val2, item.consName);
				}
				TerminalKeyword val3 = default(TerminalKeyword);
				if (DynamicBools.TryGetKeyword("route", ref val3))
				{
					AddingThings.AddCompatibleNoun(ref val3, item.consName.ToLower(), val2);
				}
				Plugin.Spam("route command for " + item.consName + " added");
				AddShortcuts(item, FauxWords: false, addConfirm: true, val2);
			}
			else if (FauxWord)
			{
				FauxKeyword val4 = new FauxKeyword(Collections.ConstellationsWord.ToLower(), item.consName.ToLower(), (Func<string>)LevelStuff.RouteConstellation);
				AddingThings.AddToFauxListing(val4, ConfigSetup.defaultListing);
				Plugin.Spam("route command for " + item.consName + " added");
				AddShortcuts(item, FauxWords: true, addConfirm: false);
			}
			else
			{
				TerminalNode val5 = AddingThings.AddNodeManual(item.consName ?? "", item.consName.ToLower() ?? "", (Func<string>)LevelStuff.RouteConstellation, true, 0, ConfigSetup.defaultListing, 0, (Func<string>)null, (Func<string>)null, "", "", false, 1, "", false, "");
				TerminalKeyword val6 = default(TerminalKeyword);
				if (DynamicBools.TryGetKeyword("route", ref val6))
				{
					AddingThings.AddCompatibleNoun(ref val6, item.consName.ToLower(), val5);
				}
				Plugin.Spam("route command for " + item.consName + " added");
				AddShortcuts(item, FauxWords: false, addConfirm: true, val5);
			}
		}

		internal static void CreateConstellationCommands()
		{
			if (Collections.ConstellationStuff.Count < 1)
			{
				return;
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				if (item.constelMoons.Count >= 1)
				{
					AddConstellationRoute(Configuration.ConstellationsUseFauxWords.Value, Configuration.RequireConfirmation.Value, item);
				}
			}
			TerminalKeyword val = default(TerminalKeyword);
			if (!Configuration.ConstellationSpecificInfoNodes.Value || Collections.ConstellationStuff.Count <= 0 || Configuration.ConstellationsUseFauxWords.Value || !DynamicBools.TryGetKeyword("info", ref val))
			{
				return;
			}
			foreach (ClassMapper item2 in Collections.ConstellationStuff)
			{
				TerminalNode val2 = BasicTerminal.CreateNewTerminalNode();
				((Object)val2).name = item2.consName + "_info";
				val2.clearPreviousText = true;
				val2.displayText = item2.infoText + "\r\n";
				Plugin.Spam("Adding info command for " + item2.consName);
				AddingThings.AddCompatibleNoun(ref val, item2.consName.ToLower(), val2);
				List<string> keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(item2.shortcutList, ',');
				foreach (string item3 in keywordsPerConfigItem)
				{
					AddingThings.AddCompatibleNoun(ref val, item3.ToLower(), val2);
				}
			}
		}

		internal static void AddShortcuts(ClassMapper item, bool FauxWords, bool addConfirm, TerminalNode newRouteNode = null)
		{
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			if (item.shortcutList.Length <= 0)
			{
				return;
			}
			List<string> keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(item.shortcutList, ',');
			foreach (string item2 in keywordsPerConfigItem)
			{
				if (!FauxWords)
				{
					AddingThings.AddKeywordToExistingNode(item2, newRouteNode, true);
					continue;
				}
				FauxKeyword val;
				if (addConfirm)
				{
					val = new FauxKeyword(Collections.ConstellationsWord.ToLower(), item2, (Func<string>)LevelStuff.AskRouteConstellation);
					val.AddConfirm((Func<string>)LevelStuff.RouteConstellation, (Func<string>)LevelStuff.DenyRouteConstellation);
				}
				else
				{
					val = new FauxKeyword(Collections.ConstellationsWord.ToLower(), item2, (Func<string>)LevelStuff.RouteConstellation);
				}
				AddingThings.AddToFauxListing(val, ConfigSetup.defaultListing);
			}
		}
	}
	internal class MoonStuff
	{
		internal static void ModifyMoonPrices()
		{
			Plugin.Spam("MODIFYMOONPRICES");
			if (Collections.MoonPrices.Count < 1 || !Configuration.ModifyMoonPrices.Value)
			{
				return;
			}
			foreach (KeyValuePair<ExtendedLevel, int> moonPrice in Collections.MoonPrices)
			{
				Plugin.Spam($"Modifying {moonPrice.Key.NumberlessPlanetName} price from {moonPrice.Key.RoutePrice} to {moonPrice.Value}");
				moonPrice.Key.RoutePrice = moonPrice.Value;
			}
		}

		internal static ExtendedLevel GetExtendedLevel(string levelName)
		{
			foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
			{
				if (extendedLevel.NumberlessPlanetName.ToLower() == levelName.ToLower())
				{
					return extendedLevel;
				}
			}
			Plugin.WARNING("WARNING: Unable to get extendedLevel from " + levelName + "!!");
			return null;
		}

		internal static bool TryGetMoon(string levelName, Dictionary<string, int> moonPrices, out int price)
		{
			price = -1;
			if (moonPrices.Count == 0)
			{
				return false;
			}
			foreach (KeyValuePair<string, int> moonPrice in moonPrices)
			{
				if (moonPrice.Key.ToLower() == levelName.ToLower())
				{
					price = moonPrice.Value;
					return true;
				}
			}
			return false;
		}
	}
	internal class SaveManager
	{
		internal static void InitSave()
		{
			Plugin.Spam("InitSave");
			if (!Plugin.instance.LethalNetworkAPI)
			{
				Plugin.WARNING("Networking is disabled!");
				LevelStuff.DefaultConstellation();
				return;
			}
			Collections.ConstellationsOTP.Clear();
			ClassMapper.ResetUnlockedConstellations(Collections.ConstellationStuff);
			NetworkThings.InitNetworkThings();
			if (!GameNetworkManager.Instance.isHostingGame)
			{
				NetworkThings.RequestSyncFromHost();
				return;
			}
			InitUnlocks();
			InitCurrent();
		}

		internal static void InitUnlocks()
		{
			if (!ES3.KeyExists("LethalConstellations_Unlocks", GameNetworkManager.Instance.currentSaveFileName))
			{
				Plugin.Spam("Creating save key for LethalConstellations_Unlocks");
				ES3.Save<List<string>>("LethalConstellations_Unlocks", Collections.ConstellationsOTP, GameNetworkManager.Instance.currentSaveFileName);
				NetworkThings.SyncUnlockSet(Collections.ConstellationsOTP);
			}
			else
			{
				Collections.ConstellationsOTP = ES3.Load<List<string>>("LethalConstellations_Unlocks", GameNetworkManager.Instance.currentSaveFileName);
				Plugin.Spam("Updating constellation unlocks from save file");
				NetworkThings.SyncUnlockSet(Collections.ConstellationsOTP);
				ClassMapper.UpdateConstellationUnlocks();
			}
		}

		internal static void SaveUnlocks(List<string> unlockList)
		{
			if (GameNetworkManager.Instance.isHostingGame)
			{
				Plugin.Spam("saving LethalConstellations_Unlocks");
				ES3.Save<List<string>>("LethalConstellations_Unlocks", unlockList, GameNetworkManager.Instance.currentSaveFileName);
			}
		}

		internal static void InitCurrent()
		{
			if (!ES3.KeyExists("LethalConstellations_Current", GameNetworkManager.Instance.currentSaveFileName))
			{
				Plugin.Spam("Creating save key for LethalConstellations_Current");
				LevelStuff.GetCurrentConstellation(LevelManager.CurrentExtendedLevel.NumberlessPlanetName);
				string currentConstellation = Collections.CurrentConstellation;
				Plugin.Spam("CurrentConstellation: " + Collections.CurrentConstellation);
				ES3.Save<string>("LethalConstellations_Current", Collections.CurrentConstellation, GameNetworkManager.Instance.currentSaveFileName);
				NetworkThings.SyncCurrentSet(currentConstellation);
			}
			else
			{
				string text = ES3.Load<string>("LethalConstellations_Current", GameNetworkManager.Instance.currentSaveFileName);
				Plugin.Spam("CurrentConstellation fromSave: " + text);
				Plugin.Spam("Updating current constellation from save file");
				NetworkThings.SyncCurrentSet(text);
			}
		}

		internal static void SaveCurrentConstellation(string currentConstellation)
		{
			if (GameNetworkManager.Instance.isHostingGame)
			{
				Plugin.Spam("saving LethalConstellations_Current");
				ES3.Save<string>("LethalConstellations_Current", currentConstellation, GameNetworkManager.Instance.currentSaveFileName);
			}
		}
	}
	internal class LevelStuff
	{
		internal static bool gotConstellation = false;

		internal static bool cancelConfirmation = false;

		internal static string constellationName = "";

		internal static string RouteConstellation()
		{
			if (CantRouteConst(out string failText))
			{
				return failText;
			}
			string defaultLevel = GetDefaultLevel(constellationName);
			int levelID = GetLevelID(defaultLevel);
			if (levelID != -1)
			{
				int constPrice = GetConstPrice(constellationName);
				if (Plugin.instance.Terminal.groupCredits < constPrice)
				{
					return "Unable to afford to travel to " + Collections.ConstellationWord + " - " + constellationName.ToUpper() + "\r\n\r\n";
				}
				Collections.CurrentConstellation = constellationName;
				Plugin.Spam($"oldcreds: {Plugin.instance.Terminal.groupCredits}");
				int num = Plugin.instance.Terminal.groupCredits - constPrice;
				Plugin.Spam($"newCreds amount = {Plugin.instance.Terminal.groupCredits}");
				StartOfRound.Instance.ChangeLevelServerRpc(levelID, num);
				gotConstellation = false;
				if (constPrice > 0)
				{
					Plugin.instance.Terminal.PlayTerminalAudioServerRpc(0);
				}
				NewEvents.RouteConstellationSuccess.Invoke();
				OneTimePurchaseCheck(constellationName);
				return $"Travelling to {Collections.ConstellationWord} - {Collections.CurrentConstellation.ToUpper()}\nYour new credits balance: ${num}\r\n\r\n";
			}
			return "ERROR: Unable to load constellation default level!\r\n\r\n";
		}

		internal static string AskRouteConstellation()
		{
			if (CantRouteConst(out string failText))
			{
				return failText;
			}
			return "Travel to " + Collections.ConstellationWord + " - " + constellationName.ToUpper() + "?\n\n\n\n\n\n\n\n\n\n\n\nPlease CONFIRM or DENY.\n";
		}

		internal static string DenyRouteConstellation()
		{
			string text = constellationName.ToUpper();
			ResetConstVars();
			return "Route to " + Collections.ConstellationWord + " " + text + " has been canceled.\r\n\r\n\r\n";
		}

		internal static void ResetConstVars()
		{
			cancelConfirmation = true;
			gotConstellation = false;
			constellationName = "";
		}

		internal static bool CantRouteConst(out string failText)
		{
			Plugin.Spam("CantRouteConst");
			if (Collections.ConstellationStuff.Count < 1)
			{
				ResetConstVars();
				failText = "Configuration failure detected!\r\n\r\n";
				return true;
			}
			if (StartOfRound.Instance.travellingToNewLevel)
			{
				ResetConstVars();
				failText = "Ship is currently in motion, unable to change routing at this time!\r\n\r\n";
				return true;
			}
			if (!StartOfRound.Instance.inShipPhase)
			{
				ResetConstVars();
				failText = "Ship needs to be in orbit in order to travel to new " + Collections.ConstellationWord + "!\r\n\r\n";
				return true;
			}
			if (Plugin.instance.Terminal.screenText.text == null || Plugin.instance.Terminal.textAdded < 0)
			{
				ResetConstVars();
				failText = "Unable to determine terminal text\r\n\r\n";
				return true;
			}
			if (Plugin.instance.Terminal.screenText.text.Length <= Plugin.instance.Terminal.textAdded)
			{
				ResetConstVars();
				failText = "Unable to determine terminal command given\r\n\r\n";
				return true;
			}
			Plugin.Spam("Getting screen text");
			string text = Plugin.instance.Terminal.screenText.text.Substring(Plugin.instance.Terminal.screenText.text.Length - Plugin.instance.Terminal.textAdded);
			if (text.ToLower().StartsWith("route"))
			{
				text = text.Substring(5).TrimStart(Array.Empty<char>());
			}
			else if (text.ToLower().StartsWith("info"))
			{
				text = text.Substring(4).TrimStart(Array.Empty<char>());
				if (ClassMapper.TryGetConstellation(Collections.ConstellationStuff, text, out ClassMapper outConst))
				{
					failText = outConst.infoText + "\r\n";
					ResetConstVars();
					return true;
				}
				ResetConstVars();
				failText = "Unable to determine terminal command given\r\n\r\n";
				return true;
			}
			Plugin.Spam(text);
			Plugin.Spam($"{Collections.ConstellationStuff.Count}");
			if (ClassMapper.TryGetConstellation(Collections.ConstellationStuff, text, out ClassMapper outConst2))
			{
				Plugin.Spam("Current Constellation: " + Collections.CurrentConstellation);
				if (Collections.CurrentConstellation == outConst2.consName)
				{
					failText = "You are already located at " + Collections.ConstellationWord + " - " + Collections.CurrentConstellation + "...\r\n\r\n";
					ResetConstVars();
					return true;
				}
				if (!gotConstellation)
				{
					constellationName = outConst2.consName;
					Plugin.Spam("keyword detected setting constellationName - " + constellationName);
					gotConstellation = true;
				}
				if (outConst2.isLocked)
				{
					ResetConstVars();
					failText = "Unable to travel to " + outConst2.consName + ". " + Collections.ConstellationWord + " is locked!\r\n\r\n";
					return true;
				}
			}
			failText = "";
			return false;
		}

		internal static int GetConstPrice(string constName)
		{
			if (Collections.ConstellationStuff.Count < 1)
			{
				return 0;
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				if (item.consName.ToLower() == constName.ToLower())
				{
					if (!OneTimePurchaseDone(item))
					{
						return item.constelPrice;
					}
					Plugin.Spam(item.consName + " is designated as a OneTimePurchase, and now costs 0 credits");
					return 0;
				}
			}
			return 0;
		}

		internal static void OneTimePurchaseCheck(string constName)
		{
			if (Collections.ConstellationStuff.Count < 1)
			{
				return;
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				if (!(item.consName.ToLower() == constName.ToLower()))
				{
					continue;
				}
				if (!item.buyOnce || !Plugin.instance.LethalNetworkAPI)
				{
					break;
				}
				if (!item.oneTimePurchase)
				{
					Plugin.Spam("Updating oneTimePurchase to true");
					item.oneTimePurchase = true;
					if (!Collections.ConstellationsOTP.Contains(item.consName))
					{
						Collections.ConstellationsOTP.Add(item.consName);
						SaveManager.SaveUnlocks(Collections.ConstellationsOTP);
						NetworkThings.SyncUnlockSet(Collections.ConstellationsOTP);
					}
					else
					{
						Plugin.WARNING("--- Error with oneTimePurchaseCheck, already in list ---");
					}
				}
			}
		}

		internal static bool OneTimePurchaseDone(ClassMapper item)
		{
			if (!item.buyOnce)
			{
				return false;
			}
			if (item.oneTimePurchase)
			{
				return true;
			}
			return false;
		}

		internal static string GetDefaultLevel(string constellation)
		{
			if (Collections.ConstellationStuff.Count < 1)
			{
				return "";
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				Plugin.Spam("checking " + item.consName + " to " + constellation);
				if (item.consName.ToLower() == constellation.ToLower())
				{
					return item.defaultMoon;
				}
			}
			return "";
		}

		internal static int GetLevelID(string levelName)
		{
			foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
			{
				Plugin.Spam("checking " + extendedLevel.NumberlessPlanetName + " vs " + levelName);
				if (extendedLevel.NumberlessPlanetName.ToLower() == levelName.ToLower())
				{
					return extendedLevel.SelectableLevel.levelID;
				}
			}
			return -1;
		}

		internal static void UpdateLevelList(ClassMapper thisConstellation, bool enableMoons)
		{
			if (!enableMoons)
			{
				Plugin.Spam("Disabling all moons in: " + thisConstellation.consName);
				{
					foreach (string constelMoon in thisConstellation.constelMoons)
					{
						AdjustExtendedLevel(constelMoon, thisConstellation, thisConstellation: false);
					}
					return;
				}
			}
			Plugin.Spam("Enabling all moons in: " + thisConstellation.consName);
			foreach (string constelMoon2 in thisConstellation.constelMoons)
			{
				AdjustExtendedLevel(constelMoon2, thisConstellation, thisConstellation: true);
			}
		}

		internal static void AdjustExtendedLevel(string levelName, ClassMapper myConst, bool thisConstellation)
		{
			if (Plugin.instance.LethalMoonUnlocks)
			{
				return;
			}
			foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
			{
				if (!(extendedLevel.NumberlessPlanetName.ToLower() == levelName.ToLower()))
				{
					continue;
				}
				if (!thisConstellation)
				{
					Plugin.Spam(extendedLevel.NumberlessPlanetName + " should be DISABLED");
					extendedLevel.IsRouteHidden = true;
					extendedLevel.IsRouteLocked = true;
					extendedLevel.LockedRouteNodeText = extendedLevel.NumberlessPlanetName + " is not located in this " + Collections.ConstellationWord + ".\n\n\tType \"" + Collections.ConstellationsWord + "\" to see a listing of LethalConstellations.\r\n\r\n";
				}
				else
				{
					Plugin.Spam(extendedLevel.NumberlessPlanetName + " should be ENABLED");
					extendedLevel.IsRouteLocked = false;
					if (!myConst.stayHiddenMoons.Contains(extendedLevel.NumberlessPlanetName) && extendedLevel.NumberlessPlanetName.ToLower() != Collections.CompanyMoon.ToLower())
					{
						extendedLevel.IsRouteHidden = false;
					}
					extendedLevel.LockedRouteNodeText = "";
				}
			}
		}

		internal static void AdjustToNewConstellation(string levelName, string constellationName)
		{
			if (constellationName.Length == 0)
			{
				Plugin.WARNING("Invalid constellationName at AdjustToNewConstellation");
				return;
			}
			Plugin.Spam("Adjusting to " + constellationName + " from " + levelName);
			if (levelName.ToLower() == Collections.CompanyMoon.ToLower() && ClassMapper.TryGetConstellation(Collections.ConstellationStuff, constellationName, out ClassMapper outConst))
			{
				AdjustExtendedLevel(outConst.defaultMoon, outConst, outConst.canRouteCompany);
				return;
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				if (item.consName == constellationName)
				{
					UpdateLevelList(item, enableMoons: true);
					if (item.canRouteCompany)
					{
						AdjustExtendedLevel(Collections.CompanyMoon, item, thisConstellation: true);
					}
					else
					{
						AdjustExtendedLevel(Collections.CompanyMoon, item, thisConstellation: false);
					}
				}
				else
				{
					UpdateLevelList(item, enableMoons: false);
				}
			}
			Collections.CurrentConstellation = constellationName;
			if (GameNetworkManager.Instance.isHostingGame)
			{
				SaveManager.SaveCurrentConstellation(Collections.CurrentConstellation);
			}
		}

		internal static void GetCurrentConstellation(string levelName)
		{
			if (levelName.Length == 0)
			{
				Plugin.WARNING("Invalid levelName at GetCurrentConstellation");
				return;
			}
			if (levelName.ToLower() == Collections.CompanyMoon.ToLower())
			{
				DefaultConstellation();
				return;
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				List<string> list = item.constelMoons.ConvertAll((string x) => x.ToLower());
				if (list.Contains(levelName.ToLower()))
				{
					Collections.CurrentConstellation = item.consName;
					Plugin.Spam("DefaultConstellation set to " + Collections.CurrentConstellation);
					AdjustToNewConstellation(levelName, Collections.CurrentConstellation);
				}
			}
		}

		internal static void DefaultConstellation()
		{
			string text = ((!((Object)(object)LevelManager.CurrentExtendedLevel == (Object)null)) ? LevelManager.CurrentExtendedLevel.NumberlessPlanetName : ExtendedLevel.GetNumberlessPlanetName(StartOfRound.Instance.currentLevel));
			if (text.ToLower() == Collections.CompanyMoon.ToLower() && Collections.CurrentConstellation.Length < 1)
			{
				Plugin.WARNING("Current save is located at the Company! Setting to default!");
				if (TryGetDefaultConstellation(out ClassMapper theConst) && theConst.canRouteCompany)
				{
					AdjustToNewConstellation(theConst.defaultMoon, theConst.consName);
					return;
				}
				Plugin.WARNING("Unable to load default constellation from config item. Setting to first contellation in list.");
				AdjustToNewConstellation(Collections.ConstellationStuff[0].defaultMoon, Collections.ConstellationStuff[0].consName);
			}
		}

		internal static bool TryGetDefaultConstellation(out ClassMapper theConst)
		{
			if (Collections.ConstellationStuff.Count == 0)
			{
				Plugin.ERROR("Unable to detect ConstellationStuff listing!!");
				theConst = null;
				return false;
			}
			if (ClassMapper.TryGetConstellation(Collections.ConstellationStuff, Configuration.CompanyDefaultConstellation.Value, out theConst))
			{
				Plugin.Spam("Returning " + theConst.consName);
				return true;
			}
			Plugin.Spam("Config item not matching anything, returning first constellation: " + Collections.ConstellationStuff[0].consName);
			theConst = Collections.ConstellationStuff[0];
			return true;
		}
	}
}
namespace LethalConstellations.EventStuff
{
	public class NewEvents
	{
		public static CustomEvent RouteConstellationSuccess = new CustomEvent();
	}
	internal class LLLStuff
	{
		internal static bool usingTags;

		public static void LLLSetup()
		{
			Collections.Start();
			if (Configuration.ConstellationList.Value.Length < 1)
			{
				Collections.ConstellationsList = GetDefaultConsellations();
			}
			else
			{
				Collections.ConstellationsList = CommonStringStuff.GetKeywordsPerConfigItem(Configuration.ConstellationList.Value, ',');
			}
			Plugin.Spam("ConstellationList:");
			foreach (string constellations in Collections.ConstellationsList)
			{
				Plugin.Spam(constellations);
			}
			List<string> keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(Configuration.IgnoreList.Value, ',');
			keywordsPerConfigItem = keywordsPerConfigItem.ConvertAll((string s) => s.ToLower());
			Plugin.Spam("list created");
			foreach (string constellations2 in Collections.ConstellationsList)
			{
				ConfigEntry<string> val = ConfigSetup.MakeString(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + constellations2, constellations2 + " menuText", "Route to " + Collections.ConstellationWord + " [name][~t]$[price][~n]Default Moon: [defaultmoon] [currentweather] [optionals]", "The text displayed for this " + Collections.ConstellationWord + "'s menu item");
				ConfigEntry<string> val2 = ConfigSetup.MakeString(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + constellations2, constellations2 + " shortcuts", "", "Specify a list of shortcuts to use for routing to the " + constellations2 + " " + Collections.ConstellationWord + ".\nEach shortcut keyword is separated by a ','");
				ConfigEntry<bool> val3 = ConfigSetup.MakeBool(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + constellations2, constellations2 + " isHidden", false, "Enable this to hide this " + Collections.ConstellationWord + " from the constellation listing");
				ConfigEntry<bool> val4 = ConfigSetup.MakeBool(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + constellations2, constellations2 + " canRouteCompany", true, "Enable this to allow this " + Collections.ConstellationWord + " to route to the company moon");
				ConfigEntry<bool> val5 = ConfigSetup.MakeBool(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + constellations2, constellations2 + " One-Time Purchase", false, "Enable this to allow routing to this " + Collections.ConstellationWord + " for free after paying for it once");
				ClassMapper classMapper = new ClassMapper(constellations2);
				classMapper.menuText = val.Value;
				classMapper.isHidden = val3.Value;
				classMapper.canRouteCompany = val4.Value;
				classMapper.shortcutList = val2.Value;
				classMapper.buyOnce = val5.Value;
				if (Configuration.ConstellationSpecificInfoNodes.Value)
				{
					ConfigEntry<string> val6 = ConfigSetup.MakeString(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + constellations2, constellations2 + " infoText", Collections.ConstellationWord + " - " + constellations2 + "\n\n\nThis [ConstellationWord] contains moons in it. Route to it and find out which!\r\n\r\n", "The text that displays with the info command for this " + Collections.ConstellationWord);
					if (val6.Value.Contains("[ConstellationWord]"))
					{
						val6.Value = val6.Value.Replace("[ConstellationWord]", Collections.ConstellationWord);
					}
					classMapper.infoText = val6.Value;
				}
				classMapper.constelMoons = new List<string>();
				classMapper.stayHiddenMoons = new List<string>();
				Collections.ConstellationStuff.Add(classMapper);
			}
			Plugin.Spam("about to sort through extendedlevel");
			GetLLLStuffForConfig(PatchedContent.ExtendedLevels, keywordsPerConfigItem);
			SetDefaultMoon(Collections.ConstellationStuff);
			Plugin.Spam($"ConfigCount: {Configuration.GeneratedConfig.Count}");
			Configuration.GeneratedConfig.Save();
			ConfigSetup.RemoveOrphanedEntries(Configuration.GeneratedConfig);
			LethalConfigStuff();
		}

		internal static void LethalConfigStuff()
		{
			if (Plugin.instance.LethalConfig)
			{
				LConfig.QueueConfig(Configuration.GeneratedConfig);
				LConfig.QueueConfig(ConfigLoader.configFile);
			}
		}

		internal static List<string> GetDefaultConsellations()
		{
			List<string> result = new List<string>(3) { "Alpha", "Bravo", "Charlie" };
			List<string> list = new List<string>(3) { "safe", "corruption detected", "???" };
			List<string> list2 = new List<string>();
			if (PatchedContent.ExtendedLevels.Count < 1)
			{
				return result;
			}
			foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
			{
				Plugin.Spam("---------------- Checking " + extendedLevel.NumberlessPlanetName + " tags ----------------");
				string item;
				if (!Configuration.ConstellationsUseFauxWords.Value)
				{
					if (list.Contains(extendedLevel.SelectableLevel.riskLevel.ToLower()))
					{
						continue;
					}
					item = extendedLevel.SelectableLevel.riskLevel + " Tier";
				}
				else
				{
					item = GetFirstUniqueTag(extendedLevel);
				}
				if (!list2.Contains(item))
				{
					list2.Add(item);
				}
				Plugin.Spam("---------------- End of checks ----------------");
			}
			usingTags = true;
			return list2;
		}

		internal static string GetDefaultCName(List<string> constList)
		{
			if (constList.Count < 1)
			{
				return "default";
			}
			Random random = new Random();
			int index = random.Next(0, constList.Count);
			return constList[index];
		}

		private static bool DoesLevelHaveTag(ExtendedLevel level, string query)
		{
			foreach (ContentTag contentTag in ((ExtendedContent)level).ContentTags)
			{
				if (contentTag.contentTagName.ToLower() == query.ToLower())
				{
					return true;
				}
			}
			return false;
		}

		private static string GetFirstUniqueTag(ExtendedLevel level)
		{
			List<string> list = new List<string>(5) { "free", "paid", "custom", "vanilla", "company" };
			foreach (ContentTag contentTag in ((ExtendedContent)level).ContentTags)
			{
				if (!list.Contains(contentTag.contentTagName.ToLower()) && contentTag.contentTagName.Length >= 3 && !Enumerable.Contains(contentTag.contentTagName, ' '))
				{
					return contentTag.contentTagName;
				}
			}
			return "Unknown";
		}

		internal static string GetTagInfo(ExtendedLevel level, List<string> constList)
		{
			string defaultCName = GetDefaultCName(constList);
			foreach (string @const in constList)
			{
				if (Configuration.ConstellationsUseFauxWords.Value)
				{
					if (DoesLevelHaveTag(level, @const))
					{
						return @const;
					}
				}
				else if (@const.Contains(level.SelectableLevel.riskLevel))
				{
					return @const;
				}
			}
			if (constList.Contains("Unknown Tier"))
			{
				return "Unknown Tier";
			}
			return defaultCName;
		}

		internal static void SetDefaultMoon(List<ClassMapper> allConstell)
		{
			Plugin.Spam("Getting Default Moons/Prices");
			foreach (ClassMapper item in allConstell)
			{
				Plugin.Spam("Setting defaults for " + item.consName);
				string randomDefault = GetRandomDefault(item);
				int moonPrice = GetMoonPrice(randomDefault);
				Plugin.Spam($"constelMoons - {item.constelMoons.Count}");
				ConfigEntry<string> val = ConfigSetup.MakeString(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + item.consName, item.consName + " defaultMoon", randomDefault, "Default moon to route to when selecting this " + Collections.ConstellationWord);
				item.defaultMoon = val.Value;
				Plugin.Spam("Default Moon for " + item.consName + " set to " + val.Value);
				item.defaultMoonLevel = MoonStuff.GetExtendedLevel(item.defaultMoon);
				if ((Object)(object)item.defaultMoonLevel == (Object)null)
				{
					Plugin.WARNING("defaultMoonLevel was NULL due to invalid config item.\n\nSetting default moon to new random and updating config item!");
					string levelName = (val.Value = (item.defaultMoon = GetRandomDefault(item)));
					item.defaultMoonLevel = MoonStuff.GetExtendedLevel(levelName);
				}
				ConfigEntry<int> val2 = ConfigSetup.MakeClampedInt(Configuration.GeneratedConfig, Collections.ConstellationWord + " " + item.consName, item.consName + " constellationPrice", moonPrice, "Set the price to route to this " + Collections.ConstellationWord + " and it's defaultMoon", 0, 9999);
				item.constelPrice = val2.Value;
			}
		}

		internal static void GetLLLStuffForConfig(List<ExtendedLevel> extendedLevels, List<string> ignoreList)
		{
			foreach (ExtendedLevel extendedLevel in extendedLevels)
			{
				string defaultCName = GetDefaultCName(Collections.ConstellationsList);
				Plugin.Spam(defaultCName);
				if (ignoreList.Contains(extendedLevel.NumberlessPlanetName.ToLower()))
				{
					continue;
				}
				Plugin.Spam("not in ignoreList");
				if (extendedLevel.NumberlessPlanetName.ToLower() == Collections.CompanyMoon.ToLower())
				{
					continue;
				}
				Plugin.Spam("not the company moon");
				ConfigEntry<int> val = ConfigSetup.MakeClampedInt(Configuration.GeneratedConfig, "Moons", extendedLevel.NumberlessPlanetName + " Price", extendedLevel.RoutePrice, "Set a custom route price for this moon (should autopopulate with the correct default price)", 0, 99999);
				ConfigEntry<bool> val2 = ConfigSetup.MakeBool(Configuration.GeneratedConfig, "Moons", extendedLevel.NumberlessPlanetName + " Stay Hidden", extendedLevel.IsRouteHidden, "Set this to true to keep " + extendedLevel.NumberlessPlanetName + " hidden even when you're in it's " + Collections.ConstellationWord);
				if (usingTags)
				{
					string tagInfo = GetTagInfo(extendedLevel, Collections.ConstellationsList);
					ConfigEntry<string> val3 = ConfigSetup.MakeClampedString(Configuration.GeneratedConfig, "Moons", extendedLevel.NumberlessPlanetName + " " + Collections.ConstellationWord, tagInfo, "Specify which " + Collections.ConstellationWord + " " + extendedLevel.NumberlessPlanetName + " belongs to.\nClamped to what is set in [ConstellationList] (default listing)", new AcceptableValueList<string>(Collections.ConstellationsList.ToArray()));
					AddToConstelMoons(extendedLevel.NumberlessPlanetName, val3.Value, val2.Value);
				}
				else
				{
					ConfigEntry<string> levelToConstellation = ConfigSetup.MakeString(Configuration.GeneratedConfig, "Moons", extendedLevel.NumberlessPlanetName + " " + Collections.ConstellationWord, defaultCName, "Specify which " + Collections.ConstellationWord + " " + extendedLevel.NumberlessPlanetName + " belongs to.\nShould match an item from [ConstellationList]\nIf adding to multiple " + Collections.ConstellationsWord + ", separate each " + Collections.ConstellationWord + " by a comma.\nWill be autoset to a random " + Collections.ConstellationWord + " if not matching one.");
					if (levelToConstellation.Value.Contains(","))
					{
						List<string> keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(levelToConstellation.Value, ',');
						foreach (string item in keywordsPerConfigItem)
						{
							AddToConstelMoons(extendedLevel.NumberlessPlanetName, item, val2.Value);
						}
					}
					else if (Collections.ConstellationsList.Any((string c) => c.ToLower() == levelToConstellation.Value.ToLower()))
					{
						AddToConstelMoons(extendedLevel.NumberlessPlanetName, levelToConstellation.Value, val2.Value);
					}
					else
					{
						Random random = new Random();
						int index = random.Next(0, Collections.ConstellationsList.Count);
						levelToConstellation.Value = Collections.ConstellationsList[index];
						AddToConstelMoons(extendedLevel.NumberlessPlanetName, levelToConstellation.Value, val2.Value);
					}
				}
				Collections.MoonPrices.Add(extendedLevel, val.Value);
			}
		}

		internal static void AddToConstelMoons(string newMoon, string cName, bool stayHidden)
		{
			if (Collections.ConstellationStuff.Count < 0)
			{
				return;
			}
			foreach (ClassMapper item in Collections.ConstellationStuff)
			{
				if (item.consName == cName && !item.constelMoons.Contains(newMoon))
				{
					item.constelMoons.Add(newMoon);
					if (stayHidden)
					{
						item.stayHiddenMoons.Add(newMoon);
					}
					Plugin.Spam($"adding {newMoon} to {cName} / stayHidden: {stayHidden}");
				}
			}
		}

		internal static bool CheckForConfigName(string configName)
		{
			foreach (ConfigDefinition key in ((BaseUnityPlugin)Plugin.instance).Config.Keys)
			{
				if (key.Key == configName)
				{
					return true;
				}
			}
			return false;
		}

		internal static int GetMoonPrice(string moonName)
		{
			if (Collections.MoonPrices.Count < 1)
			{
				return 0;
			}
			foreach (KeyValuePair<ExtendedLevel, int> moonPrice in Collections.MoonPrices)
			{
				if (moonPrice.Key.NumberlessPlanetName.ToLower() == moonName.ToLower())
				{
					return moonPrice.Value;
				}
			}
			return 0;
		}

		internal static string GetRandomDefault(ClassMapper constellation)
		{
			if (constellation.constelMoons.Count == 0)
			{
				return "";
			}
			Random random = new Random();
			int index = random.Next(0, constellation.constelMoons.Count);
			return constellation.constelMoons[index];
		}
	}
	public class Subscribers
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ParameterEvent<Terminal> <0>__OnTerminalAwake;

			public static Event <1>__OnTerminalStart;

			public static ParameterEvent<TerminalNode> <2>__OnLoadNode;

			public static Event <3>__OnLevelChange;

			public static Event <4>__OnStartup;

			public static Action <5>__LLLSetup;

			public static Action <6>__LoadCodesButton;

			public static Action <7>__GenerateWebConfig;
		}

		public static void Subscribe()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			EventManager.TerminalAwake.AddListener((ParameterEvent<Terminal>)OnTerminalAwake);
			CustomEvent terminalStart = EventManager.TerminalStart;
			object obj = <>O.<1>__OnTerminalStart;
			if (obj == null)
			{
				Event val = OnTerminalStart;
				<>O.<1>__OnTerminalStart = val;
				obj = (object)val;
			}
			terminalStart.AddListener((Event)obj);
			EventManager.TerminalLoadNewNode.AddListener((ParameterEvent<TerminalNode>)OnLoadNode);
			CustomEvent startOfRoundChangeLevel = EventManager.StartOfRoundChangeLevel;
			object obj2 = <>O.<3>__OnLevelChange;
			if (obj2 == null)
			{
				Event val2 = OnLevelChange;
				<>O.<3>__OnLevelChange = val2;
				obj2 = (object)val2;
			}
			startOfRoundChangeLevel.AddListener((Event)obj2);
			CustomEvent gameNetworkManagerStart = EventManager.GameNetworkManagerStart;
			object obj3 = <>O.<4>__OnStartup;
			if (obj3 == null)
			{
				Event val3 = OnStartup;
				<>O.<4>__OnStartup = val3;
				obj3 = (object)val3;
			}
			gameNetworkManagerStart.AddListener((Event)obj3);
			Plugin.onSetupComplete += LLLStuff.LLLSetup;
		}

		public static void OnTerminalAwake(Terminal instance)
		{
			Plugin.instance.Terminal = instance;
			Plugin.MoreLogs("Setting Plugin.instance.Terminal");
		}

		public static void OnLoadNode(TerminalNode node)
		{
			if (LevelStuff.cancelConfirmation)
			{
				LevelStuff.cancelConfirmation = false;
				Plugin.Spam("cancelConfirmation is true and node is in confirmation, routing to dummy node");
				Plugin.instance.dummyNode.displayText = node.displayText;
				Plugin.instance.Terminal.LoadNewNode(Plugin.instance.dummyNode);
			}
		}

		public static void OnTerminalStart()
		{
			MenuStuff.PreInit();
			SaveManager.InitSave();
		}

		public static void OnLevelChange()
		{
			Plugin.Spam("setting currentLevel");
			Plugin.Spam($"{LevelManager.CurrentExtendedLevel.NumberlessPlanetName}, {LevelManager.CurrentExtendedLevel.IsRouteLocked}, {LevelManager.CurrentExtendedLevel.IsRouteHidden}, {LevelManager.CurrentExtendedLevel.LockedRouteNodeText}");
			LevelStuff.GetCurrentConstellation(LevelManager.CurrentExtendedLevel.NumberlessPlanetName);
		}

		public static void OnStartup()
		{
			if (Plugin.instance.LobbyCompat)
			{
				Plugin.Log.LogInfo((object)"BMX_LobbyCompat detected!");
				BMX_LobbyCompat.SetBMXCompat(false);
			}
			if (StartGame.SoftCompatibility("com.xmods.lethalmoonunlocks", ref Plugin.instance.LethalMoonUnlocks))
			{
				Plugin.Log.LogInfo((object)"LethalMoonUnlocks Detected! Disabling moon unlock/hiding from this mod.");
			}
			if (StartGame.SoftCompatibility("LethalNetworkAPI", ref Plugin.instance.LethalNetworkAPI))
			{
				Plugin.Log.LogInfo((object)"NetworkApi detected, networking unlocked!");
			}
			if (Plugin.instance.LethalConfig)
			{
				Plugin.Log.LogInfo((object)"LethalConfig Detected!");
				LethalConfigSoft.AddButton("Tools", "LoadCodes", "Click this to refresh all mod configs from code values assigned to [GeneratedConfigCode] and [MainConfigCode]", "Load Config Codes", (Action)LConfig.LoadCodesButton);
				LethalConfigSoft.AddButton("Tools", "GenerateWebConfigs", "Click this to generate web pages for both config files.\nThese web pages can be used to generate config codes", "Generate WebConfigs", (Action)LConfig.GenerateWebConfig);
				Plugin.Spam("Buttons added!");
			}
		}

		public static void OnClientConnected()
		{
			if (GameNetworkManager.Instance.isHostingGame && Plugin.instance.LethalNetworkAPI && Collections.ConstellationsOTP != null && Collections.ConstellationsOTP.Count != 0)
			{
				NetworkThings.SyncUnlockSet(Collections.ConstellationsOTP);
			}
		}
	}
}
namespace LethalConstellations.Compat
{
	internal class LConfig
	{
		internal static void QueueConfig(ConfigFile configName)
		{
			if (Plugin.instance.LethalConfig && LethalConfigSoft.IsLethalConfigUpdated())
			{
				Plugin.Spam("Queuing file " + configName.ConfigFilePath);
				LethalConfigManager.QueueCustomConfigFileForLateAutoGeneration(configName);
			}
		}

		internal static void LoadCodesButton()
		{
			if (Plugin.instance.LethalConfig)
			{
				if (Configuration.GeneratedConfigCode.Value.Length > 1)
				{
					WebHelper.ReadCompressedConfig(ref Configuration.GeneratedConfigCode, Configuration.GeneratedConfig);
				}
				if (Configuration.MainConfigCode.Value.Length > 1)
				{
					WebHelper.ReadCompressedConfig(ref Configuration.MainConfigCode, ((BaseUnityPlugin)Plugin.instance).Config);
				}
			}
		}

		internal static void GenerateWebConfig()
		{
			if (Plugin.instance.LethalConfig)
			{
				WebHelper.WebConfig(Configuration.GeneratedConfig);
				WebHelper.WebConfig(((BaseUnityPlugin)Plugin.instance).Config);
			}
		}
	}
	internal class NetworkThings
	{
		internal static void InitNetworkThings()
		{
			if (Plugin.instance.LethalNetworkAPI)
			{
				LNetworkEvent val = LNetworkEvent.Connect("consUnlockedSyncREQ", (Action<ulong>)HostClientSync, (Action)null, (Action<ulong>)null);
				LNetworkMessage<List<string>> val2 = LNetworkMessage<List<string>>.Connect("constellationsUnlocked", (Action<List<string>, ulong>)SyncUnlockHost, (Action<List<string>>)SyncUnlockClient, (Action<List<string>, ulong>)null);
				LNetworkMessage<string> val3 = LNetworkMessage<string>.Connect("currentConst", (Action<string, ulong>)SyncCurrentHost, (Action<string>)SyncCurrentClient, (Action<string, ulong>)null);
			}
		}

		internal static void SyncUnlockSet(List<string> unlockedConst)
		{
			if (Plugin.instance.LethalNetworkAPI)
			{
				if (unlockedConst.Count == 0)
				{
					Plugin.WARNING("Attempting to sync blank ConstellationsOTP!!!");
				}
				LNetworkMessage<List<string>> val = LNetworkMessage<List<string>>.Connect("constellationsUnlocked", (Action<List<string>, ulong>)SyncUnlockHost, (Action<List<string>>)SyncUnlockClient, (Action<List<string>, ulong>)null);
				if (LNetworkUtils.IsHostOrServer)
				{
					val.SendClients(unlockedConst, LNetworkUtils.AllConnectedClients);
				}
				else
				{
					val.SendServer(unlockedConst);
				}
			}
		}

		internal static void SyncCurrentSet(string currentConstellation)
		{
			if (Plugin.instance.LethalNetworkAPI)
			{
				if (currentConstellation.Length == 0)
				{
					Plugin.WARNING("Attempting to sync blank currentConstellation!!!");
				}
				LNetworkMessage<string> val = LNetworkMessage<string>.Connect("currentConst", (Action<string, ulong>)SyncCurrentHost, (Action<string>)SyncCurrentClient, (Action<string, ulong>)null);
				if (LNetworkUtils.IsHostOrServer)
				{
					val.SendClients(currentConstellation, LNetworkUtils.AllConnectedClients);
				}
				else
				{
					val.SendServer(currentConstellation);
				}
			}
		}

		internal static void RequestSyncFromHost()
		{
			if (Plugin.instance.LethalNetworkAPI)
			{
				Plugin.Spam("Requesting sync from host");
				LNetworkMessage<List<string>> val = LNetworkMessage<List<string>>.Connect("constellationsUnlocked", (Action<List<string>, ulong>)null, (Action<List<string>>)SyncUnlockClient, (Action<List<string>, ulong>)null);
				LNetworkEvent val2 = LNetworkEvent.Connect("consUnlockedSyncREQ", (Action<ulong>)HostClientSync, (Action)null, (Action<ulong>)null);
				val2.InvokeServer();
			}
		}

		internal static void HostClientSync(ulong clientRequesting)
		{
			if (Plugin.instance.LethalNetworkAPI)
			{
				Plugin.Spam($"HostClientSync, requested by {clientRequesting}");
				if (LNetworkUtils.IsHostOrServer)
				{
					Plugin.Spam("Host sending collection");
					SyncUnlockSet(Collections.ConstellationsOTP);
					SyncCurrentSet(Collections.CurrentConstellation);
				}
			}
		}

		internal static void SyncUnlockHost(List<string> newValue, ulong clientSending)
		{
			if (Plugin.instance.LethalNetworkAPI && Collections.ConstellationsOTP != newValue)
			{
				Plugin.Spam("SYNCING NEW UNLOCK LIST - HOST");
				Collections.ConstellationsOTP = newValue;
				ClassMapper.UpdateConstellationUnlocks();
				SyncUnlockSet(Collections.ConstellationsOTP);
				SaveManager.SaveUnlocks(Collections.ConstellationsOTP);
			}
		}

		internal static void SyncUnlockClient(List<string> newValue)
		{
			if (Plugin.instance.LethalNetworkAPI && !LNetworkUtils.IsHostOrServer && Collections.ConstellationsOTP != newValue)
			{
				Plugin.Spam("SYNCING NEW UNLOCK LIST");
				Collections.ConstellationsOTP = newValue;
				ClassMapper.UpdateConstellationUnlocks();
			}
		}

		internal static void SyncCurrentHost(string newValue, ulong clientSending)
		{
			if (Plugin.instance.LethalNetworkAPI && !(Collections.CurrentConstellation == newValue))
			{
				Plugin.Spam("SYNCING NEW UNLOCK LIST - HOST");
				Collections.CurrentConstellation = newValue;
				ClassMapper.UpdateConstellationUnlocks();
				SaveManager.SaveCurrentConstellation(Collections.CurrentConstellation);
			}
		}

		internal static void SyncCurrentClient(string newValue)
		{
			if (Plugin.instance.LethalNetworkAPI && !LNetworkUtils.IsHostOrServer && !(Collections.CurrentConstellation == newValue))
			{
				Plugin.Spam("SYNCING NEW UNLOCK LIST");
				Collections.CurrentConstellation = newValue;
			}
		}
	}
}