Decompiled source of MADNESS v6.9.47

Plugins/Madness/McBasedBreezy/UpdatedRundownProgression.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json;
using System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using GTFO.API;
using GTFO.API.JSON;
using GTFO.API.JSON.Converters;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem.Collections.Generic;
using MTFO.Managers;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UpdatedRundownProgression.ConfigFiles;
using UpdatedRundownProgression.Plugin;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("UpdatedRundownProgression")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UpdatedRundownProgression")]
[assembly: AssemblyTitle("UpdatedRundownProgression")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace UpdatedRundownProgression.Plugin
{
	public class CM_IconScript : MonoBehaviour
	{
		public bool isInvisible;

		public bool ChangeText;

		public string DecryptionText = string.Empty;

		private CM_ExpeditionIcon_New icon;

		public void Setup(CM_ExpeditionIcon_New icon_New)
		{
			icon = icon_New;
		}

		private void Update()
		{
			((RectTransformComp)icon).SetVisible(!isInvisible);
			if (((Behaviour)icon.m_decryptErrorText).isActiveAndEnabled != ChangeText)
			{
				((Component)icon.m_decryptErrorText).gameObject.SetActive(ChangeText);
			}
		}
	}
	[BepInPlugin("com.Breeze.RundownProgression", "RundownProgression", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("GTFO.exe")]
	internal class EntryPoint : BasePlugin
	{
		public static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions
		{
			ReadCommentHandling = JsonCommentHandling.Skip,
			PropertyNameCaseInsensitive = true,
			IncludeFields = true,
			AllowTrailingCommas = true,
			WriteIndented = true
		};

		public static ManualLogSource? LogSource { get; private set; }

		public static Harmony? m_Harmony { get; private set; }

		public override void Load()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			LogSource = ((BasePlugin)this).Log;
			m_Harmony = new Harmony("_CustomRundownProgression_");
			m_Harmony.PatchAll();
			InjectLibTest.SetupInjectLib();
			SerializerOptions.Converters.Add((JsonConverter)new LocalizedTextConverter());
			SerializerOptions.Converters.Add((JsonConverter)new Vector3Converter());
			SerializerOptions.Converters.Add((JsonConverter)new Vector2Converter());
			SerializerOptions.Converters.Add((JsonConverter)new ColorConverter());
			if (InjectLibTest.IsLoaded)
			{
				SerializerOptions.Converters.Add(InjectLibTest.Converter);
			}
			RundownProgressionSetup.Load();
			ClassInjector.RegisterTypeInIl2Cpp<CM_IconScript>();
		}

		public static void Debug(string message)
		{
			LogSource.LogDebug((object)("[DEBUG] " + message));
		}

		public static void DebugWarning(string message)
		{
			LogSource.LogWarning((object)("[WARNING] " + message));
		}

		public static void DebugError(string message)
		{
			LogSource.LogError((object)("[ERROR] " + message));
		}
	}
	public static class RundownProgressionSetup
	{
		public static string jsonPath = Path.Combine(ConfigManager.CustomPath, name);

		public static List<CustomProgressionFile> ProgressionFiles = new List<CustomProgressionFile>();

		public static string name { get; } = "RundownProgression.json";


		public static CustomProgressionFile GetCustomProgressionFile(string rundownName)
		{
			for (int i = 0; i < ProgressionFiles.Count; i++)
			{
				if (ProgressionFiles[i].RundownName == rundownName)
				{
					return ProgressionFiles[i];
				}
			}
			return null;
		}

		public static CustomProgressionFile GetCustomProgressionFile(uint ID)
		{
			for (int i = 0; i < ProgressionFiles.Count; i++)
			{
				if (ProgressionFiles[i].RundownID == ID)
				{
					return ProgressionFiles[i];
				}
			}
			return null;
		}

		public static void Load()
		{
			if (!File.Exists(jsonPath))
			{
				EntryPoint.DebugWarning("Could not locate " + name);
				string contents = JsonSerializer.Serialize(new List<CustomProgressionFile>
				{
					new CustomProgressionFile()
				}, EntryPoint.SerializerOptions);
				File.WriteAllText(jsonPath, contents);
			}
			else
			{
				ProgressionFiles = JsonSerializer.Deserialize<List<CustomProgressionFile>>(File.ReadAllText(jsonPath), EntryPoint.SerializerOptions);
				EntryPoint.Debug(name + " had loaded successfully");
			}
		}
	}
	public static class LoadClearData
	{
		private static Dictionary<uint, RundownInformation> AllRundownInformation = new Dictionary<uint, RundownInformation>();

		public static string DirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "GTFO-Modding", "MCProgression_Rundowns");

		public static ClearsJsonFile GetClearData(uint rundownID)
		{
			return (AllRundownInformation[rundownID].ClearData != null) ? AllRundownInformation[rundownID].ClearData : null;
		}

		public static string GetClearPath(uint rundownID)
		{
			return AllRundownInformation[rundownID].RundownClearPath;
		}

		public static RundownDataBlock GetRundownDataBlockAtPath(string path)
		{
			return JsonSerializer.Deserialize<RundownDataBlock>(path, EntryPoint.SerializerOptions);
		}

		public static void Load()
		{
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			if (!Directory.Exists(DirectoryPath))
			{
				Directory.CreateDirectory(DirectoryPath);
			}
			AllRundownInformation.Clear();
			GameSetupDataBlock block = GameDataBlockBase<GameSetupDataBlock>.GetBlock(1u);
			int count = block.RundownIdsToLoad.Count;
			bool flag = default(bool);
			for (int i = 0; i < count; i++)
			{
				RundownDataBlock block2 = GameDataBlockBase<RundownDataBlock>.GetBlock(block.RundownIdsToLoad[i]);
				string text = "Clears_" + ((GameDataBlockBase<RundownDataBlock>)(object)block2).name + ".json";
				string path = Path.Combine(DirectoryPath, text);
				ClearsJsonFile newClearFile = null;
				if (File.Exists(path))
				{
					ReadClearFile(File.ReadAllText(path), path, block2, out newClearFile);
				}
				else
				{
					newClearFile = new ClearsJsonFile();
					string contents = JsonSerializer.Serialize(newClearFile, EntryPoint.SerializerOptions);
					File.WriteAllText(path, contents);
					ManualLogSource logSource = EntryPoint.LogSource;
					BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(28, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" clear file has been created");
					}
					logSource.LogDebug(val);
				}
				AllRundownInformation.Add(((GameDataBlockBase<RundownDataBlock>)(object)block2).persistentID, new RundownInformation(block2, path, newClearFile));
			}
		}

		private static void ReadClearFile(string jsonContent, string path, RundownDataBlock block, out ClearsJsonFile newClearFile)
		{
			if (jsonContent.Contains("TierAClearData"))
			{
				OldClearJsonFile oldClearJsonFile = JsonSerializer.Deserialize<OldClearJsonFile>(jsonContent, EntryPoint.SerializerOptions);
				Dictionary<string, ClearData> clearDatas = new Dictionary<string, ClearData>();
				ParseClearList(oldClearJsonFile.TierAClearData, block, (eRundownTier)1).ToList().ForEach(delegate(KeyValuePair<string, ClearData> x)
				{
					clearDatas.Add(x.Key, x.Value);
				});
				ParseClearList(oldClearJsonFile.TierBClearData, block, (eRundownTier)2).ToList().ForEach(delegate(KeyValuePair<string, ClearData> x)
				{
					clearDatas.Add(x.Key, x.Value);
				});
				ParseClearList(oldClearJsonFile.TierCClearData, block, (eRundownTier)3).ToList().ForEach(delegate(KeyValuePair<string, ClearData> x)
				{
					clearDatas.Add(x.Key, x.Value);
				});
				ParseClearList(oldClearJsonFile.TierDClearData, block, (eRundownTier)4).ToList().ForEach(delegate(KeyValuePair<string, ClearData> x)
				{
					clearDatas.Add(x.Key, x.Value);
				});
				ParseClearList(oldClearJsonFile.TierEClearData, block, (eRundownTier)5).ToList().ForEach(delegate(KeyValuePair<string, ClearData> x)
				{
					clearDatas.Add(x.Key, x.Value);
				});
				newClearFile = new ClearsJsonFile(clearDatas, oldClearJsonFile.AllClearsInRundown);
				string contents = JsonSerializer.Serialize(newClearFile, EntryPoint.SerializerOptions);
				File.WriteAllText(path, contents);
				EntryPoint.LogSource.LogDebug((object)"Old progression file found, converting it to a newer one");
			}
			else
			{
				newClearFile = JsonSerializer.Deserialize<ClearsJsonFile>(jsonContent, EntryPoint.SerializerOptions);
			}
		}

		private static Dictionary<string, ClearData> ParseClearList(List<ClearData> dataToParse, RundownDataBlock block, eRundownTier Tier)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected I4, but got Unknown
			Dictionary<string, ClearData> dictionary = new Dictionary<string, ClearData>();
			switch (Tier - 1)
			{
			case 0:
			{
				for (int j = 0; j < block.TierA.Count; j++)
				{
					if (dataToParse[j].HighClears > 0)
					{
						dictionary.Add(block.TierA[j].Descriptive.PublicName, dataToParse[j]);
					}
				}
				break;
			}
			case 1:
			{
				for (int l = 0; l < block.TierB.Count; l++)
				{
					if (dataToParse[l].HighClears > 0)
					{
						dictionary.Add(block.TierB[l].Descriptive.PublicName, dataToParse[l]);
					}
				}
				break;
			}
			case 2:
			{
				for (int m = 0; m < block.TierC.Count; m++)
				{
					if (dataToParse[m].HighClears > 0)
					{
						dictionary.Add(block.TierC[m].Descriptive.PublicName, dataToParse[m]);
					}
				}
				break;
			}
			case 3:
			{
				for (int k = 0; k < block.TierD.Count; k++)
				{
					if (dataToParse[k].HighClears > 0)
					{
						dictionary.Add(block.TierD[k].Descriptive.PublicName, dataToParse[k]);
					}
				}
				break;
			}
			case 4:
			{
				for (int i = 0; i < block.TierE.Count; i++)
				{
					if (dataToParse[i].HighClears > 0)
					{
						dictionary.Add(block.TierE[i].Descriptive.PublicName, dataToParse[i]);
					}
				}
				break;
			}
			}
			return dictionary;
		}
	}
	public class RundownInformation
	{
		public RundownDataBlock? RundownBlock { get; set; }

		public string? RundownClearPath { get; set; }

		public ClearsJsonFile? ClearData { get; set; }

		public RundownInformation(RundownDataBlock rundown, string path, ClearsJsonFile jsonFileData)
		{
			RundownBlock = rundown;
			RundownClearPath = path;
			ClearData = jsonFileData;
		}
	}
	public static class InjectLibTest
	{
		private const string GUID = "GTFO.InjectLib";

		public static JsonConverter Converter { get; private set; }

		public static bool IsLoaded { get; private set; }

		public static void SetupInjectLib()
		{
			if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("GTFO.InjectLib", out var value))
			{
				return;
			}
			try
			{
				Assembly assembly = value.Instance.GetType().Assembly ?? null;
				if ((object)assembly == null)
				{
					throw new Exception("Could not find assembly");
				}
				Type[] types = assembly.GetTypes();
				Type type = types.First((Type t) => t.Name == "InjectLibConnector");
				if ((object)type == null)
				{
					throw new Exception("InjectLibConnector could not be found");
				}
				Converter = (JsonConverter)Activator.CreateInstance(type);
				IsLoaded = true;
			}
			catch (Exception value2)
			{
				EntryPoint.DebugError($"Error while loading inject lib: {value2}");
			}
		}
	}
}
namespace UpdatedRundownProgression.Patches
{
	public class OnLevelEnter
	{
		public static void OnDrop()
		{
			uint num = default(uint);
			RundownManager.TryGetIdFromLocalRundownKey(RundownManager.ActiveRundownKey, ref num);
			ClearsJsonFile clearData = LoadClearData.GetClearData(num);
			CustomProgressionFile customProgressionFile = RundownProgressionSetup.GetCustomProgressionFile(num);
			PageRundown_SetRundownFullyRevealed.Refresh = true;
			if (clearData == null)
			{
				EntryPoint.DebugError("COULD NOT RETRIEVE CLEARS FILE. IT WAS NULL.");
				return;
			}
			foreach (CustomTierRequirements tierRequirement in customProgressionFile.TierRequirements)
			{
				EvaluateRequirement(tierRequirement, clearData);
			}
		}

		private static void EvaluateRequirement(CustomTierRequirements requirements, ClearsJsonFile clearFile)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			pActiveExpedition activeExpeditionData = RundownManager.GetActiveExpeditionData();
			if (requirements.Tier != activeExpeditionData.tier || requirements.ExpIndex != activeExpeditionData.expeditionIndex)
			{
				return;
			}
			ExpeditionInTierData val = default(ExpeditionInTierData);
			foreach (ProgressionWardenEvent item in requirements.WardenEventsOnLand)
			{
				if (RundownManager.TryGetExpedition(item.Expedition.Tier, item.Expedition.ExpeditionIndex, ref val) && clearFile.ClearData.ContainsKey(val.Descriptive.PublicName))
				{
					ClearData clears = clearFile.ClearData[val.Descriptive.PublicName];
					if (PageRundown_UpdateProgress.CheckTierReq(clears, item.NeededClears))
					{
						ExecuteEventsFromList(item.WardenEvents);
					}
				}
			}
		}

		private static void ExecuteEventsFromList(List<WardenObjectiveEventData> wardenObjectiveEvents)
		{
			foreach (WardenObjectiveEventData wardenObjectiveEvent in wardenObjectiveEvents)
			{
				WorldEventManager.ExecuteEvent(wardenObjectiveEvent, 0f);
			}
		}
	}
	[HarmonyPatch(typeof(CM_PageRundown_New), "UpdateExpeditionIconProgression")]
	public static class PageRundown_UpdateProgress
	{
		public static CM_PageRundown_New RundownPage;

		public static bool GetProgressionForRundown(out RundownProgData rundownData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			rundownData = default(RundownProgData);
			if (!Object.op_Implicit((Object)(object)RundownPage))
			{
				return false;
			}
			Enumerator<CM_ExpeditionIcon_New> enumerator = RundownPage.m_expIconsAll.GetEnumerator();
			while (enumerator.MoveNext())
			{
				CM_ExpeditionIcon_New current = enumerator.Current;
				if (((Component)current).gameObject.active)
				{
					bool flag = RundownManager.HasSecondaryLayer(current.DataBlock);
					bool flag2 = RundownManager.HasThirdLayer(current.DataBlock);
					bool flag3 = RundownManager.HasAllCompletetionPossibility(current.DataBlock);
					rundownData.totalMain++;
					if (flag)
					{
						rundownData.totalSecondary++;
					}
					if (flag2)
					{
						rundownData.totalThird++;
					}
					if (flag3)
					{
						rundownData.totalAllClear++;
					}
				}
			}
			return true;
		}

		public static void Postfix(CM_PageRundown_New __instance)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)__instance))
			{
				return;
			}
			RundownPage = __instance;
			Enumerator<CM_ExpeditionIcon_New> enumerator = __instance.m_expIconsAll.GetEnumerator();
			while (enumerator.MoveNext())
			{
				CM_ExpeditionIcon_New current = enumerator.Current;
				if (!Object.op_Implicit((Object)(object)((Component)current).gameObject.GetComponent<CM_IconScript>()))
				{
					((Component)current).gameObject.AddComponent<CM_IconScript>().Setup(current);
				}
			}
			ClearData allClearsInRundown = LoadClearData.GetClearData(((GameDataBlockBase<RundownDataBlock>)(object)__instance.m_currentRundownData).persistentID).AllClearsInRundown;
			if (allClearsInRundown == null)
			{
				return;
			}
			CustomProgressionFile customProgressionFile = RundownProgressionSetup.GetCustomProgressionFile(((GameDataBlockBase<RundownDataBlock>)(object)__instance.m_currentRundownData).name);
			if (customProgressionFile != null)
			{
				RundownProgData val = default(RundownProgData);
				val.clearedMain = allClearsInRundown.HighClears;
				val.clearedSecondary = allClearsInRundown.SecondaryClears;
				val.clearedThird = allClearsInRundown.OverloadClears;
				val.clearedAllClear = allClearsInRundown.PEClears;
				RundownProgData val2 = val;
				__instance.m_tierMarker1.SetProgression(val2, customProgressionFile.TierARequirements);
				__instance.m_tierMarker2.SetProgression(val2, customProgressionFile.TierBRequirements);
				__instance.m_tierMarker3.SetProgression(val2, customProgressionFile.TierCRequirements);
				__instance.m_tierMarker4.SetProgression(val2, customProgressionFile.TierDRequirements);
				__instance.m_tierMarker5.SetProgression(val2, customProgressionFile.TierERequirements);
				PageRundown_SetRundownFullyRevealed.Refresh = true;
				Enumerator<CM_ExpeditionIcon_New> enumerator2 = __instance.m_expIconsAll.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					CM_ExpeditionIcon_New current2 = enumerator2.Current;
					EditIcon(current2, __instance.m_currentRundownData, customProgressionFile, LoadClearData.GetClearData(((GameDataBlockBase<RundownDataBlock>)(object)__instance.m_currentRundownData).persistentID));
				}
			}
		}

		private static void EditIcon(CM_ExpeditionIcon_New icon, RundownDataBlock rundownData, CustomProgressionFile customProgression, ClearsJsonFile clearsFile)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			CustomTierRequirements customTierRequirements = null;
			ExpeditionInTierData dataBlock = icon.DataBlock;
			icon.HideArtifactHeat();
			((Component)icon.m_statusText).gameObject.transform.position = ((Component)icon.m_artifactHeatText).gameObject.transform.position;
			CM_IconScript component = ((Component)icon).gameObject.GetComponent<CM_IconScript>();
			foreach (CustomTierRequirements tierRequirement in customProgression.TierRequirements)
			{
				if (icon.Tier == tierRequirement.Tier && icon.ExpIndex == tierRequirement.ExpIndex)
				{
					customTierRequirements = tierRequirement;
				}
			}
			if (customTierRequirements.ChangePosition)
			{
				((Component)icon).transform.localPosition = customTierRequirements.NewPosition;
			}
			if (customTierRequirements.LockData.HideExpedition)
			{
				component.isInvisible = true;
			}
			ClearData clearData = null;
			clearData = (clearsFile.ClearData.ContainsKey(icon.DataBlock.Descriptive.PublicName) ? clearsFile.ClearData[icon.DataBlock.Descriptive.PublicName] : new ClearData());
			string[] array = new string[4]
			{
				clearData.HighClears.ToString(),
				"-",
				"-",
				"-"
			};
			array[0] = clearData.HighClears.ToString();
			if (customTierRequirements == null)
			{
				return;
			}
			if (RundownManager.HasSecondaryLayer(dataBlock))
			{
				array[1] = clearData.SecondaryClears.ToString();
			}
			if (RundownManager.HasThirdLayer(dataBlock))
			{
				array[2] = clearData.OverloadClears.ToString();
			}
			if (RundownManager.HasAllCompletetionPossibility(dataBlock))
			{
				array[3] = clearData.PEClears.ToString();
			}
			switch (customTierRequirements.LockData.LockType)
			{
			case eLockType.UnlockedByTierClears:
				if (CheckTierReq(clearsFile.AllClearsInRundown, GetTierProgressionData(icon.Tier, customProgression)))
				{
					icon.SetStatus((eExpeditionIconStatus)4, array[0], array[1], array[2], array[3], 1f);
					icon.Accessibility = (eExpeditionAccessibility)2;
					component.isInvisible = false;
				}
				else
				{
					icon.SetStatus((eExpeditionIconStatus)1, array[0], array[1], array[2], array[3], 1f);
					icon.Accessibility = (eExpeditionAccessibility)1;
					component.isInvisible = false;
				}
				break;
			case eLockType.UnlockedByOtherExpedition:
			{
				bool canUnlock = false;
				CalculateExpeditionReq(customTierRequirements.LockData.Requirements, icon, clearsFile, out canUnlock);
				if (canUnlock)
				{
					icon.SetStatus((eExpeditionIconStatus)4, array[0], array[1], array[2], array[3], 1f);
					icon.Accessibility = (eExpeditionAccessibility)2;
					component.isInvisible = false;
				}
				else
				{
					icon.SetStatus((eExpeditionIconStatus)1, array[0], array[1], array[2], array[3], 1f);
					icon.Accessibility = (eExpeditionAccessibility)1;
				}
				break;
			}
			default:
				icon.SetStatus((eExpeditionIconStatus)4, array[0], array[1], array[2], array[3], 1f);
				icon.Accessibility = (eExpeditionAccessibility)2;
				break;
			}
		}

		public static void CalculateExpeditionReq(List<ExpeditionFinder> requirements, CM_ExpeditionIcon_New icon, ClearsJsonFile clearsFile, out bool canUnlock)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			List<bool> list = new List<bool>();
			bool flag = false;
			for (int i = 0; i < requirements.Count; i++)
			{
				ExpeditionFinder expeditionFinder = requirements[i];
				ClearData clearData = null;
				string publicName = GetIconFromTier(expeditionFinder.Expedition.Tier, expeditionFinder.Expedition.ExpeditionIndex).DataBlock.Descriptive.PublicName;
				if (!clearsFile.ClearData.ContainsKey(publicName))
				{
					if (!expeditionFinder.SupportEmptyClears)
					{
						canUnlock = false;
						list.Add(item: false);
						continue;
					}
					clearData = new ClearData();
				}
				else
				{
					clearData = clearsFile.ClearData[publicName];
				}
				bool flag2 = CheckTierReq(clearData, expeditionFinder.NeededClearData);
				list.Add(flag2);
				if (!flag2)
				{
					continue;
				}
				flag = expeditionFinder.ForceUnlock;
				CM_IconScript component = ((Component)icon).gameObject.GetComponent<CM_IconScript>();
				component.isInvisible = expeditionFinder.MakeExpeditionInvisible;
				if (expeditionFinder.SetDecrypted)
				{
					icon.SetStatus((eExpeditionIconStatus)5, "-", "-", "-", "-", 1f);
					icon.Accessibility = (eExpeditionAccessibility)3;
					if (!string.IsNullOrWhiteSpace(expeditionFinder.DecryptedText))
					{
						((TMP_Text)icon.m_decryptErrorText).m_text = expeditionFinder.DecryptedText;
					}
					continue;
				}
				if (expeditionFinder.UnlockDecrypted)
				{
					if (icon.DataBlock.Descriptive.SkipExpNumberInName)
					{
						icon.SetShortName(icon.DataBlock.Descriptive.Prefix);
					}
					else
					{
						icon.SetShortName(icon.DataBlock.Descriptive.Prefix + (icon.ExpIndex + 1));
					}
					icon.SetPublicName(icon.DataBlock.Descriptive.PublicName + (icon.DataBlock.Descriptive.IsExtraExpedition ? "<color=orange><size=80%>://EXT</size></color>" : ""));
					icon.SetFullName(icon.ShortName + " : " + icon.DataBlock.Descriptive.PublicName);
					icon.SetStatus((eExpeditionIconStatus)1, "-", "-", "-", "-", 1f);
					icon.Accessibility = (eExpeditionAccessibility)1;
				}
				((TMP_Text)icon.m_decryptErrorText).SetText(expeditionFinder.DecryptedText, true);
				component.ChangeText = expeditionFinder.ChangeLockText;
			}
			canUnlock = flag || !list.Contains(item: false);
		}

		public static bool CheckTierReq(ClearData clears, RundownTierProgressionData clearsNeeded)
		{
			bool flag = clears.HighClears >= clearsNeeded.MainSectors;
			bool flag2 = clears.SecondaryClears >= clearsNeeded.SecondarySectors;
			bool flag3 = clears.OverloadClears >= clearsNeeded.ThirdSectors;
			bool flag4 = clears.PEClears >= clearsNeeded.AllClearedSectors;
			return flag && flag2 && flag3 && flag4;
		}

		public static bool CheckTierReq(ClearData clears, ClearData clearsNeeded)
		{
			bool flag = clears.HighClears >= clearsNeeded.HighClears;
			bool flag2 = clears.SecondaryClears >= clearsNeeded.SecondaryClears;
			bool flag3 = clears.OverloadClears >= clearsNeeded.OverloadClears;
			bool flag4 = clears.PEClears >= clearsNeeded.PEClears;
			return flag && flag2 && flag3 && flag4;
		}

		public static CM_ExpeditionIcon_New GetIconFromTier(eRundownTier tier, int expeditionIndex)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected I4, but got Unknown
			if (!Object.op_Implicit((Object)(object)RundownPage))
			{
				return null;
			}
			return (CM_ExpeditionIcon_New)((tier - 1) switch
			{
				0 => RundownPage.m_expIconsTier1[expeditionIndex], 
				1 => RundownPage.m_expIconsTier2[expeditionIndex], 
				2 => RundownPage.m_expIconsTier3[expeditionIndex], 
				3 => RundownPage.m_expIconsTier4[expeditionIndex], 
				4 => RundownPage.m_expIconsTier5[expeditionIndex], 
				_ => null, 
			});
		}

		public static RundownTierProgressionData GetTierProgressionData(eRundownTier tier, CustomProgressionFile customProgression)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected I4, but got Unknown
			switch (tier - 1)
			{
			case 0:
				return customProgression.TierARequirements;
			case 1:
				return customProgression.TierBRequirements;
			case 2:
				return customProgression.TierCRequirements;
			case 3:
				return customProgression.TierDRequirements;
			case 4:
				return customProgression.TierERequirements;
			default:
				EntryPoint.DebugWarning("Got default case where it shouldn't");
				return null;
			}
		}
	}
	[HarmonyPatch(typeof(CM_PageRundown_New), "Setup")]
	public static class PageRundown_Setup
	{
		public static void Postfix()
		{
			LoadClearData.Load();
			LevelAPI.OnEnterLevel += OnLevelEnter.OnDrop;
			EntryPoint.Debug("Loading the clear data");
		}
	}
	[HarmonyPatch(typeof(CM_PageRundown_New), "Update")]
	public static class PageRundown_SetRundownFullyRevealed
	{
		public static bool Refresh;

		public static void Postfix(CM_PageRundown_New __instance)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.m_rundownIsRevealed)
			{
				return;
			}
			ClearData allClearsInRundown = LoadClearData.GetClearData(((GameDataBlockBase<RundownDataBlock>)(object)__instance.m_currentRundownData).persistentID).AllClearsInRundown;
			if (allClearsInRundown != null && PageRundown_UpdateProgress.GetProgressionForRundown(out var rundownData))
			{
				if (Object.op_Implicit((Object)(object)__instance.m_tierMarkerSectorSummary))
				{
					__instance.m_tierMarkerSectorSummary.SetSectorIconTextForMain($"{allClearsInRundown.HighClears}<size=50%>/{rundownData.totalMain}</size>", "#FFFFFFCC");
					__instance.m_tierMarkerSectorSummary.SetSectorIconTextForSecondary($"{allClearsInRundown.SecondaryClears}<size=50%>/{rundownData.totalSecondary}</size>", "#CCCCCCCC");
					__instance.m_tierMarkerSectorSummary.SetSectorIconTextForThird($"{allClearsInRundown.OverloadClears}<size=50%>/{rundownData.totalThird}</size>", "#CCCCCCCC");
					__instance.m_tierMarkerSectorSummary.SetSectorIconTextForAllCleared($"{allClearsInRundown.PEClears}<size=50%>/{rundownData.totalAllClear}</size>", "#CCCCCCCC");
				}
				CustomProgressionFile customProgressionFile = RundownProgressionSetup.GetCustomProgressionFile(((GameDataBlockBase<RundownDataBlock>)(object)__instance.m_currentRundownData).name);
				if (customProgressionFile != null)
				{
					__instance.m_tierMarker1.SetVisible(!customProgressionFile.HideTierMarkers, 0f);
					__instance.m_tierMarker2.SetVisible(!customProgressionFile.HideTierMarkers, 0f);
					__instance.m_tierMarker3.SetVisible(!customProgressionFile.HideTierMarkers, 0f);
					__instance.m_tierMarker4.SetVisible(!customProgressionFile.HideTierMarkers, 0f);
					__instance.m_tierMarker5.SetVisible(!customProgressionFile.HideTierMarkers, 0f);
					Refresh = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")]
	public static class PageSuccess_OnEnable
	{
		public static void Postfix(CM_PageExpeditionSuccess __instance)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Invalid comparison between Unknown and I4
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			uint num = default(uint);
			RundownManager.TryGetIdFromLocalRundownKey(RundownManager.ActiveRundownKey, ref num);
			if (num == 0)
			{
				return;
			}
			ClearsJsonFile clearData = LoadClearData.GetClearData(num);
			string clearPath = LoadClearData.GetClearPath(num);
			if (clearData == null)
			{
				EntryPoint.DebugError("COULD NOT RETRIEVE CLEARS FILE. IT WAS NULL.");
				return;
			}
			ClearData clearData2 = null;
			string publicName = RundownManager.ActiveExpedition.Descriptive.PublicName;
			if (clearData.ClearData.ContainsKey(publicName))
			{
				clearData2 = clearData.ClearData[publicName];
			}
			else
			{
				clearData2 = new ClearData();
				clearData.ClearData.Add(publicName, clearData2);
			}
			bool flag = (int)WardenObjectiveManager.CurrentState.main_status == 40;
			bool flag2 = (int)WardenObjectiveManager.CurrentState.second_status == 40;
			bool flag3 = (int)WardenObjectiveManager.CurrentState.third_status == 40;
			bool flag4 = flag && flag2 && flag3;
			bool flag5 = clearData2.HighClears == 0;
			bool flag6 = clearData2.SecondaryClears == 0;
			bool flag7 = clearData2.OverloadClears == 0;
			bool flag8 = clearData2.PEClears == 0;
			if (flag)
			{
				if (flag5)
				{
					clearData.AllClearsInRundown.HighClears++;
				}
				clearData2.HighClears++;
			}
			if (flag2)
			{
				if (flag6)
				{
					clearData.AllClearsInRundown.SecondaryClears++;
				}
				clearData2.SecondaryClears++;
			}
			if (flag3)
			{
				if (flag7)
				{
					clearData.AllClearsInRundown.OverloadClears++;
				}
				clearData2.OverloadClears++;
			}
			if (flag4)
			{
				if (flag8)
				{
					clearData.AllClearsInRundown.PEClears++;
				}
				clearData2.PEClears++;
			}
			string contents = JsonSerializer.Serialize((object)clearData, EntryPoint.SerializerOptions);
			File.WriteAllText(clearPath, contents);
		}
	}
}
namespace UpdatedRundownProgression.ConfigFiles
{
	public class ClearData
	{
		public int HighClears { get; set; }

		public int SecondaryClears { get; set; }

		public int OverloadClears { get; set; }

		public int PEClears { get; set; }

		public ClearData()
		{
			HighClears = 0;
			SecondaryClears = 0;
			OverloadClears = 0;
			PEClears = 0;
		}
	}
	public class ClearsJsonFile
	{
		public ClearData? AllClearsInRundown { get; set; }

		public Dictionary<string, ClearData> ClearData { get; set; }

		public ClearsJsonFile(Dictionary<string, ClearData> dictionaryToCopy, ClearData totalClears)
		{
			AllClearsInRundown = totalClears;
			ClearData = dictionaryToCopy;
		}

		public ClearsJsonFile()
		{
			AllClearsInRundown = new ClearData();
			ClearData = new Dictionary<string, ClearData>();
		}
	}
	public class OldClearJsonFile
	{
		public List<ClearData> TierAClearData = new List<ClearData>();

		public List<ClearData> TierBClearData = new List<ClearData>();

		public List<ClearData> TierCClearData = new List<ClearData>();

		public List<ClearData> TierDClearData = new List<ClearData>();

		public List<ClearData> TierEClearData = new List<ClearData>();

		public ClearData AllClearsInRundown { get; set; }
	}
	public class CustomProgressionFile
	{
		public List<CustomTierRequirements> TierRequirements = new List<CustomTierRequirements>();

		public string? PathToRundownDataBlock { get; set; }

		public string? RundownName { get; set; }

		public uint RundownID { get; set; }

		public bool HideTierMarkers { get; set; }

		public RundownTierProgressionData TierARequirements { get; set; }

		public RundownTierProgressionData TierBRequirements { get; set; }

		public RundownTierProgressionData TierCRequirements { get; set; }

		public RundownTierProgressionData TierDRequirements { get; set; }

		public RundownTierProgressionData TierERequirements { get; set; }

		public CustomProgressionFile()
		{
			PathToRundownDataBlock = "";
			RundownName = "INTERNAL_NAME";
			RundownID = 1u;
			HideTierMarkers = false;
			TierRequirements = new List<CustomTierRequirements>
			{
				new CustomTierRequirements()
			};
		}
	}
	public class CustomTierRequirements
	{
		public int ExpIndex { get; set; }

		public eRundownTier Tier { get; set; }

		public bool ChangePosition { get; set; }

		public Vector3 NewPosition { get; set; }

		public ExpeditionLockData? LockData { get; set; }

		public List<ProgressionWardenEvent> WardenEventsOnLand { get; set; }

		public CustomTierRequirements()
		{
			ExpIndex = 0;
			Tier = (eRundownTier)1;
			LockData = new ExpeditionLockData();
			WardenEventsOnLand = new List<ProgressionWardenEvent>
			{
				new ProgressionWardenEvent()
			};
		}
	}
	public class ExpeditionLockData
	{
		public List<ExpeditionFinder> Requirements = new List<ExpeditionFinder>();

		public bool HideExpedition { get; set; }

		public eLockType LockType { get; set; }

		public ExpeditionLockData()
		{
			HideExpedition = false;
			LockType = eLockType.UnlockedByTierClears;
			Requirements = new List<ExpeditionFinder>
			{
				new ExpeditionFinder()
			};
		}
	}
	public class ProgressionWardenEvent
	{
		public List<WardenObjectiveEventData> WardenEvents = new List<WardenObjectiveEventData>();

		public ExpIndex? Expedition { get; set; }

		public ClearData? NeededClears { get; set; }

		public ProgressionWardenEvent()
		{
			Expedition = new ExpIndex();
			NeededClears = new ClearData();
			WardenEvents = new List<WardenObjectiveEventData>();
		}
	}
	public class ExpeditionFinder
	{
		public ClearData? NeededClearData { get; set; }

		public ExpIndex? Expedition { get; set; }

		public bool MakeExpeditionInvisible { get; set; }

		public bool SetDecrypted { get; set; }

		public bool UnlockDecrypted { get; set; }

		public bool ChangeLockText { get; set; }

		public string? DecryptedText { get; set; }

		public bool ForceUnlock { get; set; }

		public bool SupportEmptyClears { get; set; }

		public ExpeditionFinder()
		{
			NeededClearData = new ClearData();
			Expedition = new ExpIndex();
			MakeExpeditionInvisible = false;
			SetDecrypted = false;
			UnlockDecrypted = false;
			ChangeLockText = false;
			DecryptedText = "";
		}
	}
	public class ExpIndex
	{
		public int ExpeditionIndex { get; set; }

		public eRundownTier Tier { get; set; }

		public ExpIndex()
		{
			ExpeditionIndex = 0;
			Tier = (eRundownTier)1;
		}
	}
	public enum eLockType
	{
		UnlockedByTierClears,
		UnlockedByOtherExpedition
	}
}

Plugins/Madness/McBasedBreezy/UpdatedExtraSettings.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using System.Text.Json.Serialization;
using AIGraph;
using AK;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using CellMenu;
using ChainedPuzzles;
using Enemies;
using FluffyUnderware.DevTools.Extensions;
using GTFO.API;
using GTFO.API.Components;
using GTFO.API.JSON;
using GTFO.API.JSON.Converters;
using GTFO.Exlude.Test;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppJsonNet;
using Il2CppJsonNet.Linq;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using InjectLib.JsonNETInjection;
using InjectLib.JsonNETInjection.Converter;
using InjectLib.JsonNETInjection.Handler;
using InjectLib.JsonNETInjection.Supports;
using LevelGeneration;
using Localization;
using MTFO.Managers;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;
using UpdatedExtraSettings.ConfigFiles;
using UpdatedExtraSettings.ConfigFiles.ExtraConfigInfo;
using UpdatedExtraSettings.ConfigFiles.WardenEventInfo;
using UpdatedExtraSettings.GameScripts;
using UpdatedExtraSettings.GameScripts.HackDoors;
using UpdatedExtraSettings.GameScripts.Misc;
using UpdatedExtraSettings.GameScripts.PowerAllZones;
using UpdatedExtraSettings.GameScripts.ReactorEvents;
using UpdatedExtraSettings.GameScripts.TerminalPortal;
using UpdatedExtraSettings.GameScripts.TimedDoors;
using UpdatedExtraSettings.GameScripts.WardenObjectives;
using UpdatedExtraSettings.Managers;
using UpdatedExtraSettings.Managers.PowerOnZones;
using UpdatedExtraSettings.Managers.ScanManagers;
using UpdatedExtraSettings.Patches;
using UpdatedExtraSettings.Patches.ActionClasses;
using UpdatedExtraSettings.Patches.HSUActivatorPatches;
using UpdatedExtraSettings.PluginInfo;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("UpdatedExtraSettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UpdatedExtraSettings")]
[assembly: AssemblyTitle("UpdatedExtraSettings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace GTFO.Exlude.Test
{
	public class TestScript : MonoBehaviour
	{
		public string Name;

		public GameObject prefab;

		private void Start()
		{
		}

		private void Update()
		{
		}
	}
}
namespace UpdatedExtraSettings.PluginInfo
{
	internal class CustomEnumsHandler
	{
		private static Dictionary<string, object> customEvents = new Dictionary<string, object>();

		private static Dictionary<string, object> customTerminalCommands = new Dictionary<string, object>();

		public static void Inject()
		{
			RegisterEvents();
			EnumInjector.InjectEnumValues<eWardenObjectiveEventType>(customEvents);
			EnumInjector.InjectEnumValues<TERM_Command>(customTerminalCommands);
			PluginSetup.LogSource.LogDebug((object)"Injecting enums");
		}

		private static void RegisterEvents()
		{
			eCustomWardenEventType[] values = Enum.GetValues<eCustomWardenEventType>();
			for (int i = 0; i < values.Length; i++)
			{
				eCustomWardenEventType eCustomWardenEventType2 = values[i];
				customEvents.Add(eCustomWardenEventType2.ToString(), (int)eCustomWardenEventType2);
			}
			eTERM_Custom_Command[] values2 = Enum.GetValues<eTERM_Custom_Command>();
			for (int j = 0; j < values2.Length; j++)
			{
				eTERM_Custom_Command eTERM_Custom_Command2 = values2[j];
				customTerminalCommands.Add(eTERM_Custom_Command2.ToString(), (int)eTERM_Custom_Command2);
			}
		}
	}
	public enum eCustomWardenEventType
	{
		TogglePowerZone = 50,
		ActivatePortal,
		ToggleBlindPlayer,
		StopPlayerMovement,
		WarpSinglePlayer,
		CreateNavMarker,
		AddLogToTerminal,
		LockSecurityDoor,
		CleanupEnemiesInZone,
		AddTimeToTimedExpedition,
		ToggleCameraShake,
		ToggleFakeEndScreen,
		InstantLoss,
		ToggleFadout,
		ProperSubtitle,
		ProperSubObjective,
		ToggleTerminalCommand,
		EditPlayerInventory,
		ChangeSecurityDoorAlarm,
		TurnOffLightsInDimension,
		LoopEvents
	}
	public enum eTERM_Custom_Command
	{
		Test = 50
	}
	public interface ICustomEventHandler
	{
		void Trigger(ExtendedWardenData data);
	}
	public class PowerZoneEventHandler : ICustomEventHandler
	{
		public void Trigger(ExtendedWardenData data)
		{
			PowerZoneObjectiveManager.Current.OnWardenEventTrigger(data);
			PluginSetup.LogSource.LogDebug((object)"PowerZoneEventHandler: Triggered");
		}

		public PowerZoneEventHandler()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("PowerZoneEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}
	}
	public class PortalActivatorEventHandler : ICustomEventHandler
	{
		public static Dictionary<GlobalZoneIndex, LG_DimensionPortal> Portals = new Dictionary<GlobalZoneIndex, LG_DimensionPortal>();

		public void Trigger(ExtendedWardenData data)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			LG_Zone zone = ExtraManager.GetZone(data.DimensionIndex, data.Layer, data.LocalIndex);
			LG_DimensionPortal val = Portals[new GlobalZoneIndex(zone.DimensionIndex, zone.Layer.m_type, zone.LocalIndex)];
			if (!Object.op_Implicit((Object)(object)val))
			{
				PluginSetup.LogSource.LogWarning((object)"WARNING: The portal does not exist!");
				return;
			}
			val.m_targetDimension = data.ExtraData.PortalInfo.TargetDimensionIndex;
			val.m_targetZone = data.ExtraData.PortalInfo.TargetZoneIndex;
			val.m_portalEventData = new WardenObjectiveEventData
			{
				ChainPuzzle = val.PortalChainPuzzle,
				UseStaticBioscanPoints = false,
				Type = (eWardenObjectiveEventType)8,
				DimensionIndex = val.m_targetDimension,
				LocalIndex = val.m_targetZone,
				Delay = val.m_teleportDelay
			};
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(30, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Targeting dimension: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<eDimensionIndex>(val.m_targetDimension);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" | Zone: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<eLocalZoneIndex>(val.m_targetZone);
			}
			logSource.LogDebug(val2);
			pDimensionPortalState state = val.m_stateReplicator.State;
			state.isSequenceIncomplete = false;
			state.status = (eDimensionPortalStatus)1;
			val.m_stateReplicator.State = state;
			pItemData_Custom val3 = default(pItemData_Custom);
			val.SetPortalKeyInserted(ref val3);
			PluginSetup.LogSource.LogDebug((object)"Activating portal");
		}

		private static void OnLevelCleanup()
		{
			Portals.Clear();
			Portals.TrimExcess();
		}

		public PortalActivatorEventHandler()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			BuilderActions.OnLevelCleanup = (Action)Delegate.Combine(BuilderActions.OnLevelCleanup, new Action(OnLevelCleanup));
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("PortalActivatorEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}
	}
	public class ToggleCameraShakeEventHandler : ICustomEventHandler
	{
		public GameObject? CameraShake = null;

		public ToggleCameraShakeEventHandler()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			BuilderActions.OnLevelCleanup = (Action)Delegate.Combine(BuilderActions.OnLevelCleanup, new Action(OnLevelCleanup));
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToggleCameraShakeEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void OnLevelCleanup()
		{
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			PluginSetup.LogSource.LogDebug((object)("Triggering CameraShakeEffect Event | Duration: " + data.ExtraData.CameraShakeInfo.Duration));
			CameraShakeInfo cameraShakeInfo = data.ExtraData.CameraShakeInfo;
			if (!Object.op_Implicit((Object)(object)CameraShake))
			{
				CameraShake = new GameObject("CameraShake_Player");
				CameraShake.transform.parent = ((Component)PlayerManager.GetLocalPlayerAgent()).transform;
				CameraShake.transform.localPosition = new Vector3(0f, 0f, 0f);
				CameraShakeEffect val = CameraShake.AddComponent<CameraShakeEffect>();
			}
			CameraShakeEffect component = CameraShake.GetComponent<CameraShakeEffect>();
			component.Radius = cameraShakeInfo.Radius;
			component.Duration = cameraShakeInfo.Duration;
			component.Amplitude = cameraShakeInfo.Amplitude;
			component.Frequency = cameraShakeInfo.Frequency;
			component.PlayOnEnable = cameraShakeInfo.PlayOnEnable;
			component.directional = cameraShakeInfo.Directional;
			component.Play();
		}
	}
	public class ToggleFakeEndScreen : ICustomEventHandler
	{
		public static bool FakeWinScreenActive;

		public ToggleFakeEndScreen()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToggleCameraShakeEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			if (data.Enabled)
			{
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(PlaySequence(data.Duration)), (Action)null);
			}
			else
			{
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ToggleLobbyFix()), (Action)null);
			}
		}

		public IEnumerator PlaySequence(float timeToWaitBeforeFlashBack)
		{
			FakeWinScreenActive = true;
			FocusStateManager.EnterMenu((eCM_MenuPage)17, true);
			FocusStateManager.MapToggleAllowed = false;
			FocusStateManager.MenuToggleAllowed = false;
			yield return (object)new WaitForSeconds(timeToWaitBeforeFlashBack);
			FocusStateManager.ExitMenu(true);
			FocusStateManager.ChangeState((eFocusState)4, true);
			FocusStateManager.MapToggleAllowed = true;
			FocusStateManager.MenuToggleAllowed = true;
			FakeWinScreenActive = false;
		}

		public IEnumerator ToggleLobbyFix()
		{
			FocusStateManager.EnterMenu((eCM_MenuPage)13, true);
			yield return (object)new WaitForSeconds(0.1f);
			FocusStateManager.ExitMenu(true);
		}
	}
	public class ToggleInstantLoss : ICustomEventHandler
	{
		public ToggleInstantLoss()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToggleInstantLoss");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			GameStateManager.ChangeState((eGameStateName)15);
		}
	}
	public class ToggleNavMarker : ICustomEventHandler
	{
		private Dictionary<string, LG_WorldEventNavMarker> navMarkers = new Dictionary<string, LG_WorldEventNavMarker>();

		public ToggleNavMarker()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			BuilderActions.OnLevelCleanup = (Action)Delegate.Combine(BuilderActions.OnLevelCleanup, new Action(OnLevelCleanup));
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToggleNavMarker");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void OnLevelCleanup()
		{
			foreach (KeyValuePair<string, LG_WorldEventNavMarker> navMarker in navMarkers)
			{
				ObjectExt.Destroy((Object)(object)((Component)navMarker.Value).gameObject);
			}
			navMarkers.Clear();
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			NavMarkerInfo navMarkerInfo = data.ExtraData.NavMarkerInfo;
			if (navMarkers.ContainsKey(navMarkerInfo.NavMarkerName))
			{
				LG_WorldEventNavMarker val = navMarkers[navMarkerInfo.NavMarkerName];
				Dimension trackingDimension = default(Dimension);
				Dimension.GetDimension(data.DimensionIndex, ref trackingDimension);
				val.m_placeNavMarkerOnGo.m_marker.TrackingDimension = trackingDimension;
				if (!Object.op_Implicit((Object)(object)val))
				{
					PluginSetup.LogSource.LogError((object)"ERROR: NAVE MARKER COMPONENET WAS NULL!");
					return;
				}
				if (navMarkerInfo.ChangeExistingMarkerPosition)
				{
					((Component)val).transform.position = data.Position;
				}
				if (navMarkerInfo.ChangeStyle)
				{
					val.m_placeNavMarkerOnGo.UpdatePlayerColor(navMarkerInfo.NavMarkerColor);
					val.m_placeNavMarkerOnGo.m_marker.SetStyle(navMarkerInfo.NavMarkerStyle);
				}
				if (navMarkerInfo.EnabledNavMarker)
				{
					val.ShowMarker();
				}
				else
				{
					val.HideMarker();
				}
			}
			else
			{
				GameObject val2 = new GameObject(navMarkerInfo.NavMarkerName);
				val2.transform.position = data.Position;
				LG_WorldEventNavMarker val3 = val2.AddComponent<LG_WorldEventNavMarker>();
				val3.SetupWorldEventComponent();
				Dimension trackingDimension2 = default(Dimension);
				Dimension.GetDimension(data.DimensionIndex, ref trackingDimension2);
				val3.m_placeNavMarkerOnGo.m_marker.TrackingDimension = trackingDimension2;
				navMarkers.Add(navMarkerInfo.NavMarkerName, val3);
				if (navMarkerInfo.ChangeStyle)
				{
					val3.m_placeNavMarkerOnGo.UpdatePlayerColor(navMarkerInfo.NavMarkerColor);
					val3.m_placeNavMarkerOnGo.m_marker.SetStyle(navMarkerInfo.NavMarkerStyle);
				}
				if (navMarkerInfo.EnabledNavMarker)
				{
					val3.ShowMarker();
				}
				else
				{
					val3.HideMarker();
				}
			}
		}
	}
	public class ToggleFadout : ICustomEventHandler
	{
		public GameObject PreScreenWinPrefab;

		public GameObject PreScreenWin;

		public CM_PreSuccessScreen_FadeOut FadeoutSuccess;

		public ToggleFadout()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			AssetAPI.OnAssetBundlesLoaded += delegate
			{
				PreScreenWinPrefab = AssetAPI.GetLoadedAsset<GameObject>("Assets/MyPrefabs/CM_PreSuccessScreen_Fadeout.prefab");
				PreScreenWin = Object.Instantiate<GameObject>(PreScreenWinPrefab);
				PreScreenWin.layer = LayerManager.LAYER_UI;
				FadeoutSuccess = PreScreenWin.GetComponent<CM_PreSuccessScreen_FadeOut>();
				((Behaviour)FadeoutSuccess).enabled = false;
			};
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToggleFadout");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			((Behaviour)FadeoutSuccess).enabled = true;
			FadeoutSuccess.m_time = data.Duration;
			FadeoutSuccess.Awake();
		}
	}
	public class TogglePlayerMovement : ICustomEventHandler
	{
		public TogglePlayerMovement()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TogglePlayerMovement");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
			((Component)localPlayerAgent.Locomotion).gameObject.SetActive(data.Enabled);
			PlayerCharacterController component = ((Component)localPlayerAgent).GetComponent<PlayerCharacterController>();
			((Component)component).gameObject.SetActive(data.Enabled);
		}
	}
	public class ProperSubtitles : ICustomEventHandler
	{
		public ProperSubtitles()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ProperSubtitles");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			string text = ((Object)data.SoundSubtitle).ToString();
			float duration = data.Duration;
			GuiManager.PlayerLayer.m_subtitles.ShowMultiLineSubtitle(text, duration);
		}
	}
	public class ProperSubObjectives : ICustomEventHandler
	{
		public ProperSubObjectives()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ProperSubObjectives");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			string text = ((Object)data.CustomSubObjectiveHeader).ToString();
			string text2 = ((Object)data.CustomSubObjective).ToString();
			PUI_GameObjectives wardenObjective = GuiManager.PlayerLayer.m_wardenObjective;
			int num = (int)data.Duration;
			if (wardenObjective.m_progressionObjectiveMap.ContainsKey(num) && !data.Enabled)
			{
				wardenObjective.RemoveProgressionObjective(num, false);
			}
			if (!wardenObjective.m_progressionObjectiveMap.ContainsKey(num) && data.Enabled)
			{
				PUI_ProgressionObjective val = Object.Instantiate<PUI_ProgressionObjective>(wardenObjective.m_progressionObjectivePrefab, wardenObjective.m_progressionObjectivesParent);
				wardenObjective.m_progressionObjectives.Add(val);
				wardenObjective.m_progressionObjectiveMap[num] = val;
				wardenObjective.m_progressionObjectivePriorityMap[val] = 1;
				((TMP_Text)val.m_header).text = wardenObjective.StyleMainObjText(WardenObjectiveManager.ReplaceFragmentsInString(data.Layer, WardenObjectiveManager.GetCurrentChainIndex(data.Layer), text, true), false, "");
				((TMP_Text)val.m_text).text = wardenObjective.StyleSubObjText(WardenObjectiveManager.ReplaceFragmentsInString(data.Layer, WardenObjectiveManager.GetCurrentChainIndex(data.Layer), text2, true), (SubObjectiveStyleType)0, 5);
				val.ResizeAccordingToText();
				CoroutineManager.BlinkIn(((Component)val).gameObject, 0f);
				CoroutineManager.BlinkIn(val.Header, 0.1f);
				CoroutineManager.BlinkIn(val.SubObjective, 0.5f);
			}
			if (wardenObjective.m_progressionObjectiveMap.ContainsKey(num) && data.Enabled)
			{
				PUI_ProgressionObjective val = wardenObjective.m_progressionObjectiveMap[num];
				((TMP_Text)val.m_header).text = wardenObjective.StyleMainObjText(WardenObjectiveManager.ReplaceFragmentsInString(data.Layer, WardenObjectiveManager.GetCurrentChainIndex(data.Layer), text, true), false, "");
				((TMP_Text)val.m_text).text = wardenObjective.StyleSubObjText(WardenObjectiveManager.ReplaceFragmentsInString(data.Layer, WardenObjectiveManager.GetCurrentChainIndex(data.Layer), text2, true), (SubObjectiveStyleType)0, 5);
				val.ResizeAccordingToText();
				CoroutineManager.BlinkIn(val.Header, 0.1f);
				CoroutineManager.BlinkIn(val.SubObjective, 0.5f);
			}
		}
	}
	public class CleanupEnemiesInZoneEventHandler : ICustomEventHandler
	{
		public CleanupEnemiesInZoneEventHandler()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CleanupEnemiesInZoneEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			LG_Zone zone = ExtraManager.GetZone(data.DimensionIndex, data.Layer, data.LocalIndex);
			Enumerator<AIG_CourseNode> enumerator = zone.m_courseNodes.GetEnumerator();
			while (enumerator.MoveNext())
			{
				AIG_CourseNode current = enumerator.Current;
				if (current.m_enemiesInNode.Count != 0)
				{
					KillEnemies(current.m_enemiesInNode, data.Enabled, data.Duration);
				}
			}
		}

		private void KillEnemies(List<EnemyAgent> enemiesToKill, bool despawn, float duration)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (duration == 0f)
			{
				for (int i = 0; i < enemiesToKill.Count; i++)
				{
					if (despawn)
					{
						enemiesToKill[i].OnDeSpawn();
					}
					else
					{
						enemiesToKill[i].Damage.MeleeDamage(((Dam_SyncedDamageBase)enemiesToKill[i].Damage).HealthMax, (Agent)null, Vector3.zero, Vector3.forward, 0, 1f, 1f, 1f, 1f, false, (DamageNoiseLevel)0, 0u);
					}
				}
			}
			else
			{
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(KillEnemiesDelayed(enemiesToKill, despawn, duration)), (Action)null);
			}
		}

		private IEnumerator KillEnemiesDelayed(List<EnemyAgent> enemiesToKill, bool despawn, float duration)
		{
			for (int i = 0; i < enemiesToKill.Count; i++)
			{
				if (despawn)
				{
					enemiesToKill[i].OnDeSpawn();
				}
				else
				{
					enemiesToKill[i].Damage.MeleeDamage(((Dam_SyncedDamageBase)enemiesToKill[i].Damage).HealthMax, (Agent)null, Vector3.zero, Vector3.forward, 0, 1f, 1f, 1f, 1f, false, (DamageNoiseLevel)0, 0u);
				}
				yield return (object)new WaitForSeconds(duration);
			}
		}
	}
	public class AddLogToTerminalEventHandler : ICustomEventHandler
	{
		public AddLogToTerminalEventHandler()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("AddLogToTerminalEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			TerminalLogInfo terminalLogInfo = data.ExtraData.TerminalLogInfo;
			LG_ComputerTerminal terminalFromIndex = ExtraManager.GetTerminalFromIndex(data.DimensionIndex, data.Layer, data.LocalIndex, data.GenTermIndex);
			if (data.Enabled)
			{
				terminalFromIndex.AddLocalLog(terminalLogInfo.LogData, true);
			}
			else
			{
				terminalFromIndex.RemoveLocalLog(terminalLogInfo.LogData.FileName);
			}
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(15, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Adding log ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(terminalLogInfo.LogData.FileName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(terminalFromIndex.PublicName);
			}
			logSource.LogDebug(val);
		}
	}
	public class ToggleTerminalCommandEventHandler : ICustomEventHandler
	{
		public static Dictionary<GlobalZoneIndex, LG_WardenObjective_Reactor> Reactors = new Dictionary<GlobalZoneIndex, LG_WardenObjective_Reactor>();

		public ToggleTerminalCommandEventHandler()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			LevelAPI.OnLevelCleanup += OnLevelCleanup;
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToggleTerminalCommandEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		private static void OnLevelCleanup()
		{
			Reactors.Clear();
			Reactors.TrimExcess();
		}

		private void RemoveCommand(ref pComputerTerminalState state, TERM_Command cmd)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			bool flag = default(bool);
			for (int i = 0; i < ((Il2CppArrayBase<TERM_Command>)(object)state.RemovedCommands).Length; i++)
			{
				if ((int)((Il2CppArrayBase<TERM_Command>)(object)state.RemovedCommands)[i] == 0)
				{
					((Il2CppArrayBase<TERM_Command>)(object)state.RemovedCommands)[i] = cmd;
					break;
				}
				if (((Il2CppArrayBase<TERM_Command>)(object)state.RemovedCommands)[i] == cmd)
				{
					ManualLogSource logSource = PluginSetup.LogSource;
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(56, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Attempting to remove a command ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((object)(TERM_Command)(ref cmd)).ToString());
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" that is already removed!");
					}
					logSource.LogError(val);
					break;
				}
			}
		}

		private void AddCommand(ref pComputerTerminalState state, TERM_Command cmd)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			bool flag = default(bool);
			for (int i = 0; i < ((Il2CppArrayBase<TERM_Command>)(object)state.RemovedCommands).Length; i++)
			{
				if (((Il2CppArrayBase<TERM_Command>)(object)state.RemovedCommands)[i] == cmd)
				{
					((Il2CppArrayBase<TERM_Command>)(object)state.RemovedCommands)[i] = (TERM_Command)0;
					ManualLogSource logSource = PluginSetup.LogSource;
					BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(31, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Removing ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((object)(TERM_Command)(ref cmd)).ToString());
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from removed commands");
					}
					logSource.LogDebug(val);
					break;
				}
			}
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			GlobalZoneIndex key = default(GlobalZoneIndex);
			((GlobalZoneIndex)(ref key))..ctor(data.DimensionIndex, data.Layer, data.LocalIndex);
			LG_ComputerTerminal val = (LG_ComputerTerminal)(data.IsReactorTerminal ? ((object)Reactors[key].m_terminal) : ((object)ExtraManager.GetTerminalFromIndex(data.DimensionIndex, data.Layer, data.LocalIndex, data.GenTermIndex)));
			val.TrySyncSetCommandRule(data.TerminalCommand, data.TerminalCommandRule);
			if (data.Enabled)
			{
				pComputerTerminalState state = val.m_stateReplicator.State;
				AddCommand(ref state, data.TerminalCommand);
				val.TrySyncSetCommandShow(data.TerminalCommand);
				val.m_stateReplicator.State = state;
			}
			else
			{
				val.TrySyncSetCommandHidden(data.TerminalCommand);
				pComputerTerminalState state2 = val.m_stateReplicator.State;
				RemoveCommand(ref state2, data.TerminalCommand);
				val.m_stateReplicator.State = state2;
			}
		}
	}
	public class WarpSinglePlayerEventHandler : ICustomEventHandler
	{
		public WarpSinglePlayerEventHandler()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("WarpSinglePlayerEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			WarpSinglePlayerInfo singlePlayerWarpInfo = data.ExtraData.SinglePlayerWarpInfo;
			int num = (data.ExtraData.SinglePlayerWarpInfo.RandomPlayer ? Builder.SessionSeedRandom.Range(0, PlayerManager.AlivePlayerAgentsInLevel, "NO_TAG") : singlePlayerWarpInfo.PlayerIndex);
			PlayerAgent val = PlayerManager.PlayerAgentsInLevel[num];
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Attempting to warp ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(val.Owner.NickName);
			}
			logSource.LogDebug(val2);
			Dimension val3 = default(Dimension);
			if (Dimension.GetDimension(data.DimensionIndex, ref val3))
			{
				(Vector3, Vector3) tuple = default((Vector3, Vector3));
				if (singlePlayerWarpInfo.RandomWarpPoint && val3.CourseGraph != null)
				{
					for (int i = 0; i < val3.CourseGraph.m_nodes.Count; i++)
					{
						if (val3.CourseGraph.m_nodes[i].IsValid)
						{
							tuple.Item1 = val3.CourseGraph.m_nodes[i].GetRandomPositionInside();
							break;
						}
					}
				}
				else
				{
					tuple.Item1 = val3.DimensionLevel.GetRandomSpawnPoint().position;
				}
				tuple.Item2 = Random.onUnitSphere;
				val.TryWarpTo(val3.DimensionIndex, tuple.Item1, tuple.Item2, singlePlayerWarpInfo.IncludeBots);
			}
			else
			{
				PluginSetup.LogSource.LogWarning((object)"Could not get valid dimension to warp to :(");
			}
		}
	}
	public class EditPlayerInventoryEventHandler : ICustomEventHandler
	{
		private List<InventorySlot> gearSlots = new List<InventorySlot>
		{
			(InventorySlot)10,
			(InventorySlot)1,
			(InventorySlot)2,
			(InventorySlot)3
		};

		public EditPlayerInventoryEventHandler()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("EditPlayerInventoryEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		private void RefreshEquipment()
		{
		}

		private void OnLevelCleanup()
		{
		}

		private void RemoveSlot(InventorySlot slot)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			PlayerBackpackManager.ClearLocalSlot(slot, true, false);
		}

		private GearIDRange GetGearIDRange(InventorySlot slot, int index)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return ((Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot(slot))[index];
		}

		private bool AreConditionsMet(List<WeaponCondition> conditions)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (conditions == null)
			{
				return true;
			}
			List<bool> list = new List<bool>();
			if (conditions.Count == 0)
			{
				return true;
			}
			foreach (WeaponCondition condition in conditions)
			{
				for (int i = 0; i < gearSlots.Count; i++)
				{
					list.Add(DoWeaponConditionsMatch(condition, gearSlots[i]));
				}
			}
			return !list.Contains(item: false);
		}

		private bool DoWeaponConditionsMatch(WeaponCondition condition, InventorySlot slot)
		{
			//IL_0002: 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)
			return GetGearIDRange(condition.InventorySlot, condition.GearID) == PlayerBackpackManager.GetLocalItem(slot).GearIDRange;
		}

		private void ChangeWeapon(InventorySlot slot, int id)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			RemoveSlot(slot);
			PlayerBackpackManager.LocalBackpack.SpawnAndEquipGearAsync(slot, GetGearIDRange(slot, id), (delBackpackItemCallback)null);
			GuiManager.PlayerLayer.Inventory.UpdateAllSlots(PlayerManager.GetLocalPlayerAgent().Owner, (InventorySlot)0);
		}

		public void Trigger(ExtendedWardenData data)
		{
			PlayerInventoryEditInfo inventoryEditInfo = data.ExtraData.InventoryEditInfo;
			if (inventoryEditInfo.IsSinglePlayer)
			{
				EvaluateData(inventoryEditInfo, inventoryEditInfo.PlayerIndex);
			}
			else
			{
				EvaluateData(inventoryEditInfo);
			}
		}

		private void EvaluateData(PlayerInventoryEditInfo data)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (data.RemoveSlot)
			{
				RemoveSlot(data.TargetSlot);
			}
			if (data.ChangeWeapon && AreConditionsMet(data.Conditions))
			{
				ChangeWeapon(data.TargetSlot, data.GearID);
			}
			if (data.EquipSlot)
			{
				PlayerBackpackManager.EquipLocalGear(PlayerBackpackManager.GetLocalItem(data.TargetSlot).GearIDRange);
			}
		}

		private void EvaluateData(PlayerInventoryEditInfo data, int playerIndex)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerManager.GetLocalPlayerAgent().PlayerSlotIndex == playerIndex)
			{
				if (data.RemoveSlot)
				{
					RemoveSlot(data.TargetSlot);
				}
				if (data.ChangeWeapon && AreConditionsMet(data.Conditions))
				{
					ChangeWeapon(data.TargetSlot, data.GearID);
				}
				if (data.EquipSlot)
				{
					PlayerBackpackManager.EquipLocalGearAsync(data.TargetSlot, PlayerBackpackManager.GetLocalItem(data.TargetSlot).GearIDRange, (delBackpackItemCallback)null);
				}
			}
		}
	}
	public class TurnOffLightsInDimensionEventHandler : ICustomEventHandler
	{
		public TurnOffLightsInDimensionEventHandler()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TurnOffLightsInDimensionEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Dimension val = default(Dimension);
			if (!Dimension.GetDimension(data.DimensionIndex, ref val))
			{
				return;
			}
			Enumerator<LG_Layer> enumerator = val.Layers.GetEnumerator();
			while (enumerator.MoveNext())
			{
				LG_Layer current = enumerator.Current;
				Enumerator<LG_Zone> enumerator2 = current.m_zones.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					LG_Zone current2 = enumerator2.Current;
					current2.SetLightsInZone(data.Enabled);
				}
			}
		}
	}
	public class ToggleBlindPlayerEventHandler : ICustomEventHandler
	{
		private Texture2D texture;

		public ToggleBlindPlayerEventHandler()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_001d: 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
			texture = new Texture2D(1, 1);
			texture.SetPixel(0, 0, Color.black);
			texture.Apply();
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToggleBlindPlayerEventHandler");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been created");
			}
			logSource.LogDebug(val);
		}

		public void Trigger(ExtendedWardenData data)
		{
		}
	}
	internal class EventDataHandler : Il2CppJsonReferenceTypeHandler<WardenObjectiveEventData>
	{
		private static readonly JsonSerializerOptions _JsonOption;

		static EventDataHandler()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			_JsonOption = new JsonSerializerOptions(JsonSerializer.DefaultSerializerSettings);
			_JsonOption.IncludeFields = true;
			_JsonOption.Converters.Add((JsonConverter)new LocalizedTextConverter());
		}

		public override void OnRead(in Object result, in JToken jToken)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected I4, but got Unknown
			WardenObjectiveEventData val = ((Il2CppObjectBase)result).Cast<WardenObjectiveEventData>();
			if (Enum.IsDefined((eCustomWardenEventType)val.Type))
			{
				ExtendedWardenData extendedData = JsonSerializer.Deserialize<ExtendedWardenData>(((Object)jToken).ToString(), _JsonOption);
				val.PushData(extendedData);
			}
		}
	}
	internal class ItemDataHandler : Il2CppJsonReferenceTypeHandler<ItemDataBlock>
	{
		private static readonly JsonSerializerOptions _JsonOption;

		static ItemDataHandler()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			_JsonOption = new JsonSerializerOptions(JsonSerializer.DefaultSerializerSettings);
			_JsonOption.IncludeFields = true;
			_JsonOption.Converters.Add((JsonConverter)new LocalizedTextConverter());
		}

		public override void OnRead(in Object result, in JToken jToken)
		{
			ItemDataBlock val = ((Il2CppObjectBase)result).Cast<ItemDataBlock>();
			if (((GameDataBlockBase<ItemDataBlock>)(object)val).name.Contains("CONSUMABLE"))
			{
				ItemDataBlockInfo extension = JsonSerializer.Deserialize<ItemDataBlockInfo>(((Object)jToken).ToString(), _JsonOption);
				val.PushData(extension);
			}
		}
	}
	internal class EventTypeConverter : Il2CppJsonUnmanagedTypeConverter<eWardenObjectiveEventType>
	{
		protected override eWardenObjectiveEventType Read(JToken jToken, eWardenObjectiveEventType existingValue, JsonSerializer serializer)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected I4, but got Unknown
			int num = 0;
			JTokenType type = jToken.Type;
			JTokenType val = type;
			if ((int)val != 6)
			{
				if ((int)val != 8)
				{
					return (eWardenObjectiveEventType)0;
				}
				string value = (string)jToken;
				if (Enum.TryParse<eCustomWardenEventType>(value, ignoreCase: true, out var result))
				{
					num = (int)result;
				}
				else
				{
					if (!Enum.TryParse<eWardenObjectiveEventType>(value, ignoreCase: true, out eWardenObjectiveEventType result2))
					{
						return (eWardenObjectiveEventType)0;
					}
					num = (int)result2;
				}
			}
			else
			{
				num = (int)jToken;
			}
			return (eWardenObjectiveEventType)num;
		}

		protected override void Write(JsonWriter writer, eWardenObjectiveEventType value, JsonSerializer serializer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected I4, but got Unknown
			writer.WriteValue((int)value);
		}

		protected override Object ToIl2CppObject(eWardenObjectiveEventType value)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected I4, but got Unknown
			Int32 val = default(Int32);
			val.m_value = (int)value;
			return ((Int32)(ref val)).BoxIl2CppObject();
		}
	}
	public interface ICheckpointEvent
	{
		void OnCheckpointReload();

		void OnCheckpointStored();
	}
	[BepInPlugin("com.Breeze.ExtraSettings", "ExtraSettings", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("GTFO.exe")]
	public class PluginSetup : BasePlugin
	{
		public static ManualLogSource? LogSource;

		public static Harmony? m_Harmony;

		public static string ExtraSettingsPath = Path.Combine(ConfigManager.CustomPath, "ExtraSettings");

		public static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions
		{
			ReadCommentHandling = JsonCommentHandling.Skip,
			PropertyNameCaseInsensitive = true,
			IncludeFields = true,
			AllowTrailingCommas = true,
			WriteIndented = true
		};

		public override void Load()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			LogSource = ((BasePlugin)this).Log;
			if (!Directory.Exists(ExtraSettingsPath))
			{
				Directory.CreateDirectory(ExtraSettingsPath);
			}
			m_Harmony = new Harmony("UpdatedExtraSettings");
			m_Harmony.PatchAll();
			SerializerOptions.Converters.Add((JsonConverter)new LocalizedTextConverter());
			SerializerOptions.Converters.Add((JsonConverter)new Vector3Converter());
			SerializerOptions.Converters.Add((JsonConverter)new Vector2Converter());
			SerializerOptions.Converters.Add((JsonConverter)new ColorConverter());
			SerializerOptions.Converters.Add((JsonConverter)new InjectLibConnector());
			CustomEnumsHandler.Inject();
			JsonInjector.SetConverter<eWardenObjectiveEventType>((Il2CppJsonUnmanagedTypeConverter<eWardenObjectiveEventType>)new EventTypeConverter());
			JsonInjector.AddHandler<WardenObjectiveEventData>((Il2CppJsonReferenceTypeHandler<WardenObjectiveEventData>)(object)new EventDataHandler());
			JsonInjector.AddHandler<ItemDataBlock>((Il2CppJsonReferenceTypeHandler<ItemDataBlock>)(object)new ItemDataHandler());
			LoadConfigFiles();
			AssetAPI.OnAssetBundlesLoaded += LoadAssets;
			((BasePlugin)this).Log.LogDebug((object)"ExtraSettings has loaded!");
		}

		private static void LoadAssets()
		{
			PrefabAPI.CreateConsumableInstance<ConsumableSentry>("Assets/MyPrefabs/Consumable_Sentry.prefab");
		}

		public static void LoadConfigFiles()
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			HackDoorConfigSetup.Load();
			TerminalPortalConfigSetup.Load();
			ReactorWaveEventsConfigSetup.Load();
			TimedDoorsConfigSetup.Load();
			HuntEnemiesConfigSetup.Load();
			CustomTScansConfigSetup.Load();
			RandomAlarmConfigSetup.Load();
			CustomEnemySpawnsConfigSetup.Load();
			PowerAllZonesConfigSetup.Load();
			MiscConfigSetup.Load();
			stopwatch.Stop();
			LogSource.LogDebug((object)("It took " + stopwatch.ElapsedMilliseconds + " ms to load all the configs"));
		}
	}
	public class HackDoorConfigSetup
	{
		private static List<HackDoorConfigs>? Configs;

		public static Dictionary<uint, List<HackDoorSecond>>? EnabledConfigs = new Dictionary<uint, List<HackDoorSecond>>();

		private static string Name { get; } = "HackSecurityDoor.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<HackDoorConfigs>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<HackDoorConfigs>
				{
					new HackDoorConfigs()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i].DoorLockInfo);
				}
			}
		}
	}
	public class TerminalPortalConfigSetup
	{
		private static List<PortalTerminalCommandConfig>? Configs;

		public static Dictionary<uint, List<PortalTerminalCommandSecondaryConfig>> EnabledConfigs = new Dictionary<uint, List<PortalTerminalCommandSecondaryConfig>>();

		public static string Name { get; } = "TerminalPortal.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<PortalTerminalCommandConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<PortalTerminalCommandConfig>
				{
					new PortalTerminalCommandConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i].PortalInfo);
				}
			}
		}
	}
	public class ReactorWaveEventsConfigSetup
	{
		private static List<CustomReactorEventsConfig>? Configs;

		public static Dictionary<uint, List<ReactorPlacementConfig>> EnabledConfigs = new Dictionary<uint, List<ReactorPlacementConfig>>();

		public static string Name { get; } = "ReactorEvents.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<CustomReactorEventsConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<CustomReactorEventsConfig>
				{
					new CustomReactorEventsConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i].ReactorInfos);
				}
			}
		}
	}
	public class TimedDoorsConfigSetup
	{
		private static List<TimedDoorsConfig>? Configs;

		public static Dictionary<uint, List<TimedDoorsSecondConfig>> EnabledConfigs = new Dictionary<uint, List<TimedDoorsSecondConfig>>();

		public static string Name { get; } = "TimedDoors.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<TimedDoorsConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<TimedDoorsConfig>
				{
					new TimedDoorsConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i].DoorsInfo);
				}
			}
		}
	}
	public class HuntEnemiesConfigSetup
	{
		private static List<HuntEnemyObjectiveConfig>? Configs;

		public static Dictionary<uint, HuntEnemyObjectiveConfig> EnabledConfigs = new Dictionary<uint, HuntEnemyObjectiveConfig>();

		public static string Name { get; } = "HuntEnemies.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<HuntEnemyObjectiveConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<HuntEnemyObjectiveConfig>
				{
					new HuntEnemyObjectiveConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i]);
				}
			}
		}
	}
	public class CustomTScansConfigSetup
	{
		private static List<MovableScanConfig>? Configs;

		public static Dictionary<uint, List<SecondaryMovableScansConfig>> EnabledConfigs = new Dictionary<uint, List<SecondaryMovableScansConfig>>();

		public static string Name { get; } = "CustomTScans.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<MovableScanConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<MovableScanConfig>
				{
					new MovableScanConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i].ScansInformation);
				}
			}
		}
	}
	public class RandomAlarmConfigSetup
	{
		private static List<RandomAlarmConfig>? Configs;

		public static Dictionary<uint, List<RandomAlarmSecondConfig>> EnabledConfigs = new Dictionary<uint, List<RandomAlarmSecondConfig>>();

		public static string Name { get; } = "RandomAlarms.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<RandomAlarmConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<RandomAlarmConfig>
				{
					new RandomAlarmConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i].ScanInfo);
				}
			}
		}
	}
	public class CustomEnemySpawnsConfigSetup
	{
		private static List<CustomEnemySpawnsConfig>? Configs;

		public static Dictionary<uint, GroupInfo> EnabledConfigs = new Dictionary<uint, GroupInfo>();

		public static string Name { get; } = "EnemySpawns.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<CustomEnemySpawnsConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<CustomEnemySpawnsConfig>
				{
					new CustomEnemySpawnsConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i].GroupSpawns);
				}
			}
		}
	}
	public class PowerAllZonesConfigSetup
	{
		private static List<PowerAllZonesConfig>? Configs;

		public static Dictionary<uint, PowerAllZonesConfig> EnabledConfigs = new Dictionary<uint, PowerAllZonesConfig>();

		public static string Name { get; } = "PowerZones.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<PowerAllZonesConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<PowerAllZonesConfig>
				{
					new PowerAllZonesConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i]);
				}
			}
		}
	}
	public class MiscConfigSetup
	{
		private static List<MiscConfig>? Configs;

		public static Dictionary<uint, MiscConfig> EnabledConfigs = new Dictionary<uint, MiscConfig>();

		public static string Name { get; } = "Misc.json";


		public static void Load()
		{
			string path = Path.Combine(PluginSetup.ExtraSettingsPath, Name);
			if (File.Exists(path))
			{
				Configs = JsonSerializer.Deserialize<List<MiscConfig>>(File.ReadAllText(path), PluginSetup.SerializerOptions);
				PluginSetup.LogSource.LogDebug((object)(Name + " has loaded successfully"));
			}
			else
			{
				Configs = new List<MiscConfig>
				{
					new MiscConfig()
				};
				string contents = JsonSerializer.Serialize(Configs, PluginSetup.SerializerOptions);
				File.WriteAllText(path, contents);
				PluginSetup.LogSource.LogWarning((object)(Name + " did not exist, creating it now"));
			}
			EnabledConfigs.Clear();
			int count = Configs.Count;
			for (int i = 0; i < count; i++)
			{
				if (Configs[i].internalEnabled)
				{
					EnabledConfigs.Add(Configs[i].LevelID, Configs[i]);
				}
			}
		}
	}
	public static class SentryGunExtensions
	{
		public static bool IsConsumableSentry(this SentryGunInstance sentryGun)
		{
			if (ItemDataBlockExtensions.TryGetData(((Item)sentryGun).ItemDataBlock, out ItemDataBlockInfo extendedItemData))
			{
				return extendedItemData.IsConsumableSentry;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(StartMainGame), "Awake")]
	internal class StartGame_Awake_PF
	{
		public static List<Type> GameScripts = new List<Type>
		{
			typeof(HackDoorScript),
			typeof(TerminalPortalScript),
			typeof(ReactorEventScript),
			typeof(TerminalBackdoorScript),
			typeof(ReactorGenScript),
			typeof(UplinkScript),
			typeof(HSUActivatorScript),
			typeof(TimedDoorScript),
			typeof(PowerZoneTerminalScript),
			typeof(PowerZoneGeneratorScript),
			typeof(WorldInteractionCheckerScript),
			typeof(ConsumableSentry),
			typeof(TestScript)
		};

		public static void Postfix()
		{
			foreach (Type gameScript in GameScripts)
			{
				ClassInjector.RegisterTypeInIl2Cpp(gameScript);
			}
			PluginSetup.LogSource.LogDebug((object)"StartGame_Awake");
			ResetManager.StartGame();
			LevelGenActions.SetupActions();
			TerminalActions.SetupActions();
			EnemyActions.SetupActions();
			ChainedPuzzleActions.SetupActions();
			NetworkTransmission.SetupNetworkEvents();
			new PowerZoneObjectiveManager();
			new SyncScanManager();
		}

		private static void FindPouncerData()
		{
		}

		private static void AttachShadersToObjects()
		{
		}
	}
	[HarmonyPatch(typeof(GameDataInit), "ReInitialize")]
	internal class GameDataInit_ReInitialize
	{
		public static void Prefix()
		{
			PluginSetup.LoadConfigFiles();
			PluginSetup.LogSource.LogDebug((object)"Reloading config files");
		}
	}
	public static class WardenEventExtensions
	{
		public static Dictionary<int, EventDataHolder> WardenEvents = new Dictionary<int, EventDataHolder>();

		public static Dictionary<eCustomWardenEventType, ICustomEventHandler> EventTypes = new Dictionary<eCustomWardenEventType, ICustomEventHandler>
		{
			{
				eCustomWardenEventType.TogglePowerZone,
				new PowerZoneEventHandler()
			},
			{
				eCustomWardenEventType.ActivatePortal,
				new PortalActivatorEventHandler()
			},
			{
				eCustomWardenEventType.ToggleCameraShake,
				new ToggleCameraShakeEventHandler()
			},
			{
				eCustomWardenEventType.ToggleFakeEndScreen,
				new ToggleFakeEndScreen()
			},
			{
				eCustomWardenEventType.InstantLoss,
				new ToggleInstantLoss()
			},
			{
				eCustomWardenEventType.CreateNavMarker,
				new ToggleNavMarker()
			},
			{
				eCustomWardenEventType.ToggleFadout,
				new ToggleFadout()
			},
			{
				eCustomWardenEventType.StopPlayerMovement,
				new TogglePlayerMovement()
			},
			{
				eCustomWardenEventType.ProperSubtitle,
				new ProperSubtitles()
			},
			{
				eCustomWardenEventType.ProperSubObjective,
				new ProperSubObjectives()
			},
			{
				eCustomWardenEventType.CleanupEnemiesInZone,
				new CleanupEnemiesInZoneEventHandler()
			},
			{
				eCustomWardenEventType.AddLogToTerminal,
				new AddLogToTerminalEventHandler()
			},
			{
				eCustomWardenEventType.ToggleTerminalCommand,
				new ToggleTerminalCommandEventHandler()
			},
			{
				eCustomWardenEventType.WarpSinglePlayer,
				new WarpSinglePlayerEventHandler()
			},
			{
				eCustomWardenEventType.EditPlayerInventory,
				new EditPlayerInventoryEventHandler()
			},
			{
				eCustomWardenEventType.TurnOffLightsInDimension,
				new TurnOffLightsInDimensionEventHandler()
			},
			{
				eCustomWardenEventType.ToggleBlindPlayer,
				new ToggleBlindPlayerEventHandler()
			}
		};

		private static int _key = int.MinValue;

		public static void PushData(this WardenObjectiveEventData data, ExtendedWardenData extendedData)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected I4, but got Unknown
			WardenEvents[_key] = new EventDataHolder(data, extendedData);
			data.Count = _key;
			_key++;
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(74, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WardenEventExtensions: PushData has been called! \nType: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<eCustomWardenEventType>((eCustomWardenEventType)data.Type);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nHas Custom Data: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(extendedData.ExtraData != null);
			}
			logSource.LogDebug(val);
		}

		public static bool TryGetData(WardenObjectiveEventData eventData, out ExtendedWardenData? extendedData)
		{
			if (WardenEvents.TryGetValue(eventData.Count, out EventDataHolder value))
			{
				extendedData = value.extendedData;
				return extendedData != null;
			}
			extendedData = null;
			return false;
		}
	}
	public class ExtendedWardenData
	{
		public eCustomWardenEventType Type { get; set; }

		public WorldEventConditionPair Condition { get; set; } = new WorldEventConditionPair
		{
			ConditionIndex = -1,
			IsTrue = false
		};


		public eDimensionIndex DimensionIndex { get; set; }

		public LG_LayerType Layer { get; set; }

		public eLocalZoneIndex LocalIndex { get; set; }

		public int GenTermIndex { get; set; }

		public bool IsReactorTerminal { get; set; }

		public Vector3 Position { get; set; }

		public float Delay { get; set; }

		public float Duration { get; set; }

		public LocalizedText? WardenIntel { get; set; }

		public LocalizedText? CustomSubObjectiveHeader { get; set; }

		public LocalizedText? CustomSubObjective { get; set; }

		public LocalizedText? SoundSubtitle { get; set; }

		public TERM_Command TerminalCommand { get; set; }

		public TERM_CommandRule TerminalCommandRule { get; set; }

		public bool Enabled { get; set; }

		public ExtraEventDataHeader? ExtraData { get; set; }
	}
	public class ExtraEventDataHeader
	{
		public PowerZoneWardenInfo? PowerZoneInfo { get; set; }

		public PortalWardenInfo? PortalInfo { get; set; }

		public CameraShakeInfo? CameraShakeInfo { get; set; }

		public NavMarkerInfo? NavMarkerInfo { get; set; }

		public TerminalLogInfo? TerminalLogInfo { get; set; }

		public WarpSinglePlayerInfo? SinglePlayerWarpInfo { get; set; }

		public PlayerInventoryEditInfo? InventoryEditInfo { get; set; }
	}
	public class EventDataHolder
	{
		public WardenObjectiveEventData? original;

		public ExtendedWardenData? extendedData;

		public EventDataHolder(WardenObjectiveEventData? original, ExtendedWardenData? extendedData)
		{
			this.original = original;
			this.extendedData = extendedData;
		}
	}
}
namespace UpdatedExtraSettings.Patches
{
	[HarmonyPatch(typeof(Builder), "OnLevelCleanup")]
	internal class BuilderCleanup
	{
		public static void Postfix()
		{
			BuilderActions.OnLevelCleanup?.Invoke();
		}
	}
	[HarmonyPatch(typeof(Builder), "Build")]
	internal class Builder_Build_PF
	{
		public static void Postfix()
		{
			BuilderActions.OnBuild?.Invoke();
		}
	}
	[HarmonyPatch(typeof(CP_Bioscan_Core), "OnSyncStateChange")]
	internal class ChainedPuzzleCore_OnStateChange
	{
		public static bool Prefix(eBioscanStatus status, float progress, List<PlayerAgent> playersInScan, int playersMax, Il2CppStructArray<bool> reqItemStatus, bool isDropinState, CP_Bioscan_Core __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!MiscConfigSetup.EnabledConfigs.ContainsKey(ExtraManager.MainLevelLayout))
			{
				return true;
			}
			if ((int)status == 3)
			{
				ClusterScanManager value = null;
				SyncScanManager.Current.ScanManagers.TryGetValue(((Il2CppObjectBase)__instance.m_owner).Cast<ChainedPuzzleInstance>(), out value);
				if (value == null)
				{
					return true;
				}
				if (PlayerManager.PlayerAgentsInLevel.Count == 1)
				{
					foreach (CP_Bioscan_Core bioscanCore in value.BioscanCores)
					{
						if ((Object)(object)bioscanCore != (Object)(object)__instance)
						{
							bioscanCore.OnSyncStateChange(status, progress, playersInScan, playersMax, reqItemStatus, isDropinState);
						}
					}
					return true;
				}
				if (value.AreAllScansActive())
				{
					return true;
				}
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(ChainedPuzzleInstance), "SetupMovement")]
	internal class CustomTScansPatches
	{
		public static int ScanCreationIndex;

		public static bool Prefix(GameObject gameObject, LG_Area sourceArea, ChainedPuzzleInstance __instance)
		{
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			if (!CustomTScansConfigSetup.EnabledConfigs.ContainsKey(ExtraManager.MainLevelLayout))
			{
				return true;
			}
			SecondaryMovableScansConfig secondaryMovableScansConfig = null;
			if (CustomTScansConfigSetup.EnabledConfigs[ExtraManager.MainLevelLayout][ScanCreationIndex].ChainedPuzzleID == ((GameDataBlockBase<ChainedPuzzleDataBlock>)(object)__instance.Data).persistentID)
			{
				secondaryMovableScansConfig = CustomTScansConfigSetup.EnabledConfigs[ExtraManager.MainLevelLayout][ScanCreationIndex];
			}
			if (secondaryMovableScansConfig == null)
			{
				if (ScanCreationIndex < CustomTScansConfigSetup.EnabledConfigs[ExtraManager.MainLevelLayout].Count)
				{
					ScanCreationIndex++;
				}
				return true;
			}
			iChainedPuzzleMovable component = gameObject.GetComponent<iChainedPuzzleMovable>();
			if (component == null || !component.UsingStaticBioscanPoints)
			{
				return true;
			}
			CP_BasicMovable val = ((Il2CppObjectBase)component).Cast<CP_BasicMovable>();
			CP_Bioscan_Core val2 = ((Il2CppObjectBase)((Component)val).GetComponent<iChainedPuzzleCore>()).TryCast<CP_Bioscan_Core>();
			if ((Object)(object)val2 == (Object)null)
			{
				return true;
			}
			val2.m_revealWithHoloPath = false;
			for (int i = 0; i < secondaryMovableScansConfig.ScanPositions.Count; i++)
			{
				if (secondaryMovableScansConfig.ScanPositions[i].PuzzleIndex != val2.m_puzzleIndex)
				{
					continue;
				}
				foreach (Vector3 scanPoint in secondaryMovableScansConfig.ScanPositions[i].ScanPoints)
				{
					component.ScanPositions.Add(scanPoint);
				}
				val.m_amountOfPositions = secondaryMovableScansConfig.ScanPositions[i].AmountOfPositions;
				if (secondaryMovableScansConfig.ScanPositions[i].ScanSpeed != 0f)
				{
					val.m_movementSpeed = secondaryMovableScansConfig.ScanPositions[i].ScanSpeed;
				}
			}
			if (ScanCreationIndex < CustomTScansConfigSetup.EnabledConfigs[ExtraManager.MainLevelLayout].Count)
			{
				ScanCreationIndex++;
			}
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(48, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Setting up a custom T-Scan for ChainedpuzzleID ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<uint>(secondaryMovableScansConfig.ChainedPuzzleID);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("!");
			}
			logSource.LogDebug(val3);
			return false;
		}
	}
	[HarmonyPatch(typeof(CP_Cluster_Core), "Setup")]
	internal class CP_Cluster_Setup
	{
		public static Action<CP_Cluster_Core>? OnClusterSetup;

		public static void Postfix(CP_Cluster_Core __instance)
		{
			OnClusterSetup?.Invoke(__instance);
		}
	}
	[HarmonyPatch(typeof(CP_Bioscan_Core), "Setup")]
	internal class CP_Bioscan_Core_Setup
	{
		public static Action<CP_Bioscan_Core>? OnBioscanCoreSetup;

		public static void Postfix(CP_Bioscan_Core __instance)
		{
			OnBioscanCoreSetup?.Invoke(__instance);
		}
	}
	[HarmonyPatch(typeof(LG_PowerGenerator_Core), "SyncStatusChanged")]
	internal class GeneratorCore_SyncStatus_PF
	{
		public static Action<LG_PowerGenerator_Core, pPowerGeneratorState>? OnSyncStatusChanged;

		public static void Postfix(LG_PowerGenerator_Core __instance, pPowerGeneratorState state)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			OnSyncStatusChanged?.Invoke(__instance, state);
		}
	}
	[HarmonyPatch(typeof(LG_PowerGenerator_Core), "Setup")]
	internal class Generator_Core_Setup_PF
	{
		public static Action<LG_PowerGenerator_Core>? OnGeneratorSetup;

		public static Dictionary<(eDimensionIndex, LG_LayerType, eLocalZoneIndex), Extras.GeneratorInfo> GenInfo = new Dictionary<(eDimensionIndex, LG_LayerType, eLocalZoneIndex), Extras.GeneratorInfo>();

		public static void Postfix(LG_PowerGenerator_Core __instance)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			SortGenerator(__instance);
			OnGeneratorSetup?.Invoke(__instance);
			ManualLogSource logSource = PluginSetup.LogSource;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(15, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(__instance.PublicName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is being setup");
			}
			logSource.LogDebug(val);
		}

		private static void SortGenerator(LG_PowerGenerator_Core core)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			(eDimensionIndex, LG_LayerType, eLocalZoneIndex) key = (core.SpawnNode.m_dimension.DimensionIndex, core.OriginLayer, core.SpawnNode.m_zone.LocalIndex);
			if (GenInfo.ContainsKey(key))
			{
				GenInfo[key].GenCores.Add(core);
			}
			else
			{
				GenInfo.Add(key, new Extras.GeneratorInfo(core.SpawnNode.m_zone, core));
			}
		}

		public static LG_PowerGenerator_Core? GetCoreByIndex(LG_Zone genZone, int index)
		{
			//IL_0007: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (GenInfo.ContainsKey((genZone.DimensionIndex, genZone.Layer.m_type, genZone.LocalIndex)))
			{
				return GenInfo[(genZone.DimensionIndex, genZone.Layer.m_type, genZone.LocalIndex)].GenCores[index];
			}
			return null;
		}

		public static LG_PowerGenerator_Core? GetCoreByIndex(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex zoneIndex, int index)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (GenInfo.ContainsKey((dimensionIndex, layerType, zoneIndex)))
			{
				return GenInfo[(dimensionIndex, layerType, zoneIndex)].GenCores[index];
			}
			return null;
		}

		public static List<LG_PowerGenerator_Core>? GetCoresPerZone(LG_Zone genZone)
		{
			//IL_0007: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (GenInfo.ContainsKey((genZone.DimensionIndex, genZone.Layer.m_type, genZone.LocalIndex)))
			{
				return GenInfo[(genZone.DimensionIndex, genZone.Layer.m_type, genZone.LocalIndex)].GenCores;
			}
			return null;
		}

		public static List<LG_PowerGenerator_Core>? GetCoresPerZone(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex zoneIndex)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (GenInfo.ContainsKey((dimensionIndex, layerType, zoneIndex)))
			{
				return GenInfo[(dimensionIndex, layerType, zoneIndex)].GenCores;
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(LG_SecurityDoor_Locks), "SetupForChainedPuzzle")]
	internal class HackSecurityDoorPatches
	{
		public static Action<ChainedPuzzleInstance, LG_SecurityDoor_Locks>? OnChainedPuzzleSetup;

		public static void Postfix(ChainedPuzzleInstance puzzleToOpen, LG_SecurityDoor_Locks __instance)
		{
			OnChainedPuzzleSetup?.Invoke(puzzleToOpen, __instance);
		}

		public static void SetupHackLocks(ChainedPuzzleInstance instance, LG_SecurityDoor_Locks doorLock)
		{
			PluginSetup.LogSource.LogDebug((object)"Setting up Chained Puzzle Lock!");
			if (!HackDoorConfigSetup.EnabledConfigs.ContainsKey(ExtraManager.MainLevelLayout))
			{
				return;
			}
			int count = HackDoorConfigSetup.EnabledConfigs[ExtraManager.MainLevelLayout].Count;
			for (int i = 0; i < count; i++)
			{
				if (HackDoorConfigSetup.EnabledConfigs[ExtraManager.MainLevelLayout][i].ChainedPuzzleID == ((GameDataBlockBase<ChainedPuzzleDataBlock>)(object)instance.Data).persistentID)
				{
					((Component)doorLock.m_door).gameObject.AddComponent<HackDoorScript>().Setup(doorLock, HackDoorConfigSetup.EnabledConfigs[ExtraManager.MainLevelLayout][i]);
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAgent), "Setup")]
	internal class HuntingEnemiesPatches
	{
		public static Action<EnemyAgent>? OnEnemySetup;

		public static void Postfix(EnemyAgent __instance)
		{
			OnEnemySetup?.Invoke(__instance);
		}
	}
	[HarmonyPatch(typeof(ES_Dead), "CommonEnter")]
	internal class ES_Dead_CommonEnter
	{
		public static Action<ES_Dead>? OnCommonEnter;

		public static void Postfix(ES_Dead __instance)
		{
			OnCommonEnter?.Invoke(__instance);
		}
	}
	[HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")]
	public static class PageExpeditionSuccess_OnEnable
	{
		public static bool Prefix(CM_PageExpeditionSuccess __instance)
		{
			//IL_0695: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Invalid comparison between Unknown and I4
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e7: Invalid comparison between Unknown and I4
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fe: Invalid comparison between Unknown and I4
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			if (!ToggleFakeEndScreen.FakeWinScreenActive)
			{
				return true;
			}
			for (int i = 0; i < ((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports).Length; i++)
			{
				((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports)[i].SetVisible(false);
			}
			CM_PageBase.PostSound(EVENTS.MUSIC_EXPEDITION_SUCCESSFUL, "");
			((Component)__instance.m_btnLeaveExpedition).gameObject.SetActive(false);
			__instance.m_lobbyButtonVisible = false;
			__instance.m_showLobbybuttonTimer = Clock.Time + __instance.m_time_btnGotoLobby;
			if ((Object)(object)__instance.m_expeditionName != (Object)null && RundownManager.ActiveExpedition != null && RundownManager.ActiveExpedition.Descriptive != null)
			{
				string text = "???";
				string text2 = RundownManager.ActiveExpedition.GetShortName(RundownManager.GetActiveExpeditionData().expeditionIndex) + ":\"" + RundownManager.ActiveExpedition.Descriptive.PublicName + "\"<color=#ccc><size=70%> - " + text + "</size></color>";
				((TMP_Text)__instance.m_expeditionName).text = text2;
			}
			int checkpointUsage = CheckpointManager.CheckpointUsage;
			((Component)__instance.m_checkpointUsage).gameObject.SetActive(false);
			if (SNet.Slots.PlayerSlots != null)
			{
				bool flag = default(bool);
				Color color = default(Color);
				Color color2 = default(Color);
				for (int j = 0; j < ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Length; j++)
				{
					SNet_Slot val = ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots)[j];
					ManualLogSource logSource = PluginSetup.LogSource;
					BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(15, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Slot ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(j);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<SNet_Slot>(val);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" player: ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<SNet_Player>(val.player);
					}
					logSource.LogDebug(val2);
					if (val == null || !((Object)(object)val.player != (Object)null) || !val.player.IsInSlot)
					{
						continue;
					}
					((Color)(ref color))..ctor(0.3f, 0.3f, 0.3f, 0.4f);
					((Color)(ref color2))..ctor(1f, 1f, 1f, 0.65f);
					((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports)[j].SetColor(color2);
					((TMP_Text)((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports)[j].m_name).text = "<color=red>" + val.player.NickName + "</color>";
					PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(val.player);
					string text3 = "<size=150%><nobr>" + Text.Get(888u) + "</nobr></size>\n<color=white>";
					if (backpack != null)
					{
						string text4 = "";
						if (__instance.TryGetArchetypeName(backpack, (InventorySlot)1, ref text4))
						{
							text3 = text3 + text4 + "\n";
						}
						if (__instance.TryGetArchetypeName(backpack, (InventorySlot)2, ref text4))
						{
							text3 = text3 + text4 + "\n";
						}
						if (__instance.TryGetArchetypeName(backpack, (InventorySlot)3, ref text4))
						{
							text3 = text3 + text4 + "\n";
						}
						if (__instance.TryGetArchetypeName(backpack, (InventorySlot)10, ref text4))
						{
							text3 = text3 + text4 + "\n";
						}
					}
					string text5 = text3 + "</color></size>";
					PlayerAgent val3 = ((Il2CppObjectBase)val.player.PlayerAgent).TryCast<PlayerAgent>();
					string text6 = __instance.RandMedicalStatus();
					if ((Object)(object)val3 != (Object)null)
					{
						float healthRel = ((Dam_SyncedDamageBase)val3.Damage).GetHealthRel();
						if ((double)healthRel > 0.699999988079071)
						{
							text6 = Text.Get(889u);
						}
						else if ((double)healthRel > 0.5)
						{
							text6 = Text.Get(890u);
						}
						else if ((double)healthRel > 0.300000011920929)
						{
							text6 = Text.Get(891u);
						}
						else if ((double)healthRel > 0.0)
						{
							text6 = "<color=red>" + Text.Get(892u) + "</color>";
						}
						else
						{
							text6 = "<color=red>" + Text.Get(893u) + "</color>";
							((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports)[j].SetColor(color);
						}
					}
					string text7 = __instance.RandAmount();
					if ((Object)(object)val3 != (Object)null)
					{
						float infection = val3.Damage.Infection;
						text7 = ((!((double)infection <= 0.850000023841858)) ? Text.Get(894u) : ((!((double)infection <= 0.5)) ? Text.Get(895u) : (((double)infection <= 0.0) ? Text.Get(897u) : Text.Get(896u))));
					}
					string text8 = "<size=150%><nobr>" + Text.Get(898u) + "</nobr></size>\n" + Text.Format(899u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=white>" + text6 + "</color>\n") }) + Text.Format(900u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=white>" + text7 + "</color>\n") }) + Text.Format(901u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=white>" + __instance.RandMentalStatus() + "</color>\n") }) + Text.Format(915u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=white>" + __instance.RandAmount() + "</color>\n") });
					((TMP_Text)((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports)[j].m_gear).text = text5;
					((TMP_Text)((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports)[j].m_eval).text = text8;
					CoroutineManager.BlinkIn(((Component)((Il2CppArrayBase<CM_PageSuccess_PrisonerEvaluation>)(object)__instance.m_playerReports)[j]).gameObject, __instance.m_time_playerReports + (float)j * 0.2f);
				}
			}
			CoroutineManager.BlinkIn(__instance.m_header, __instance.m_time_header, (Transform)null);
			if ((Object)(object)__instance.m_expeditionName != (Object)null)
			{
				CoroutineManager.BlinkIn(__instance.m_expeditionName, __instance.m_time_expeditionName, (Transform)null);
			}
			bool flag2 = true;
			bool flag3 = RundownManager.HasSecondaryLayer(RundownManager.ActiveExpedition);
			bool flag4 = RundownManager.HasThirdLayer(RundownManager.ActiveExpedition);
			bool flag5 = (int)WardenObjectiveManager.CurrentState.main_status == 40;
			bool flag6 = false;
			bool flag7 = false;
			int num = 0;
			float num2 = 400f;
			CoroutineManager.BlinkOut(__instance.m_sectorsWhiteBox, __instance.m_time_sectorBox);
			CoroutineManager.BlinkIn(__instance.m_sectorHeader, __instance.m_time_sectorHeader);
			if (flag3)
			{
				flag6 = (int)WardenObjectiveManager.CurrentState.second_status == 40;
			}
			if (flag4)
			{
				flag7 = (int)WardenObjectiveManager.CurrentState.third_status == 40;
			}
			PluginSetup.LogSource.LogDebug((object)("CM_PageExpeditionSuccess.OnEnable, hasMain: " + flag2 + " hasSecond: " + flag3 + " hasThird: " + flag4 + " clearMain: " + flag5 + " clearSecond: " + flag6 + " clearThird: " + flag7));
			__instance.PlaceSectorIcon(__instance.m_sectorIconMain, (LG_LayerType)0, flag2, flag5, num2, ref num);
			__instance.PlaceSectorIcon(__instance.m_sectorIconSecond, (LG_LayerType)1, flag3, flag6, num2, ref num);
			__instance.PlaceSectorIcon(__instance.m_sectorIconThird, (LG_LayerType)2, flag4, flag7, num2, ref num);
			__instance.m_sectorIconAllCompleted.SetupAsFinishedAll(((Component)__instance).transform, 0.5f, true);
			((RectTransformComp)__instance.m_sectorIconAllCompleted).SetPosition(new Vector2((float)num * num2, 0f));
			if (flag5 && flag6 && flag7 && checkpointUsage == 0)
			{
				__instance.m_sectorIconAllCompleted.BlinkIn(__instance.m_time_allSectorsCleared);
			}
			else
			{
				((RectTransformComp)__instance.m_sectorIconAllCompleted).SetVisible(false);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerAgent), "Update")]
	internal class PlayerAgent_Update
	{
		private static float _cooldown = 2.5f;

		public static void Postfix(PlayerAgent __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Invalid comparison between Unknown and I4
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			if (!((Agent)__instance).IsLocallyOwned)
			{
				return;
			}
			if (_cooldown >= 0f)
			{
				_cooldown -= 1f * Time.deltaTime;
			}
			if (Input.GetKeyInt((KeyCode)57) && _cooldown <= 0f)
			{
				ManualLogSource logSource = PluginSetup.LogSource;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(80, 4, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nCURRENT PLAYER POSITION: \nPOSITION: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector3>(((Component)__instance).transform.position);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nROTATION: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Quaternion>(((Component)__instance).transform.rotation);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nEULER ANGLES: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector3>(((Component)__instance).transform.eulerAngles);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nLOOK DIRECTION: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector3>(((Agent)__instance).TargetLookDir);
				}
				logSource.LogDebug(val);
				_cooldown = 2.5f;
			}
			if (PowerZoneObjectiveManager.Current.configData != null && (int)GameStateManager.CurrentStateName == 10 && PowerZoneObjectiveManager.Current.configData.LayerToComplete == ((Agent)__instance).CourseNode.LayerType && PowerZoneObjectiveManager.Current.isReadyToUpdate)
			{
				string main = string.Format(PowerZoneObjectiveManager.Current.configData.ObjectiveHeader.ToUpper(), PowerZoneObjectiveManager.Current.AmountCompleted, PowerZoneObjectiveManager.Current.configData.AmountNeeded);
				string text = string.Format(PowerZoneObjectiveManager.Current.configData.SubObjectiveText.ToUpper(), $"<color=orange>{PowerZoneObjectiveManager.Current.AmountCompleted}</color>", $"<color=orange>{PowerZoneObjectiveManager.Current.configData.AmountNeeded}</color>");
				ExtraManager.SetSubAndMainObjective(main, GuiManager.PlayerLayer.m_wardenObjective.StyleSubObjText(text, (SubObjectiveStyleType)1, 5), PowerZoneObjectiveManager.Current.configData.LayerToComplete);
			}
		}
	}
	[HarmonyPatch(typeof(LG_DimensionPortal), "Setup")]
	internal class PortalTerminalCommandPatches
	{
		public static Action<LG_DimensionPortal>? OnPortalSetup;

		public static void Postfix(LG_DimensionPortal __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			PortalActivatorEventHandler.Portals.Add(new GlobalZoneIndex(__instance.SpawnNode.m_zone.DimensionIndex, __instance.SpawnNode.LayerType, __instance.SpawnNode.m_zone.LocalIndex), __instance);
			OnPortalSetup?.Invoke(__instance);
		}

		public static void PortalSetup(LG_DimensionPortal portal)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to inva

Plugins/Madness/McBasedHirnu/MadnessQOL.dll

Decompiled 2 weeks ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AIGraph;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using Enemies;
using GTFO.API;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MadnessQOL")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MadnessQOL")]
[assembly: AssemblyTitle("MadnessQOL")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace MadnessQOL
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("hirnukuono-MadnessQOL", "hirnukuono-MadnessQOL", "0.0.3")]
	public class Plugin : BasePlugin
	{
		private class MadnessQOL : MonoBehaviour
		{
			[CompilerGenerated]
			private sealed class <AntiCheese>d__5 : IEnumerator<object>, IDisposable, IEnumerator
			{
				private int <>1__state;

				private object <>2__current;

				private List<LG_WeakDoor>.Enumerator <>7__wrap1;

				private LG_WeakDoor <door>5__3;

				object IEnumerator<object>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <AntiCheese>d__5(int <>1__state)
				{
					this.<>1__state = <>1__state;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					int num = <>1__state;
					if (num == -3 || num == 1)
					{
						try
						{
						}
						finally
						{
							<>m__Finally1();
						}
					}
				}

				private bool MoveNext()
				{
					//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0066: Invalid comparison between Unknown and I4
					//IL_0122: Unknown result type (might be due to invalid IL or missing references)
					//IL_012c: Expected O, but got Unknown
					//IL_0083: Unknown result type (might be due to invalid IL or missing references)
					//IL_008d: Expected O, but got Unknown
					try
					{
						switch (<>1__state)
						{
						default:
							return false;
						case 0:
							<>1__state = -1;
							goto IL_002b;
						case 1:
							<>1__state = -3;
							<door>5__3.TriggerOperate(true);
							<door>5__3.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
							Log.LogInfo((object)"door cheese prevented. how u like dem apples?");
							unche.Add(<door>5__3);
							goto IL_00f3;
						case 2:
							<>1__state = -1;
							goto IL_002b;
						case 3:
							{
								<>1__state = -1;
								break;
							}
							IL_002b:
							<>7__wrap1 = doors.GetEnumerator();
							<>1__state = -3;
							goto IL_00fa;
							IL_00fa:
							if (<>7__wrap1.MoveNext())
							{
								<door>5__3 = <>7__wrap1.Current;
								if ((int)<door>5__3.LastStatus == 11 && !unche.Contains(<door>5__3))
								{
									<>2__current = (object)new WaitForSeconds(3f);
									<>1__state = 1;
									return true;
								}
								goto IL_00f3;
							}
							<>m__Finally1();
							<>7__wrap1 = default(List<LG_WeakDoor>.Enumerator);
							<>2__current = (object)new WaitForSeconds(1f);
							<>1__state = 2;
							return true;
							IL_00f3:
							<door>5__3 = null;
							goto IL_00fa;
						}
					}
					catch
					{
						//try-fault
						((IDisposable)this).Dispose();
						throw;
					}
					((IDisposable)this).Dispose();
					return true;
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				private void <>m__Finally1()
				{
					<>1__state = -1;
					((IDisposable)<>7__wrap1).Dispose();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}
			}

			public static ManualLogSource Log;

			public static List<LG_WeakDoor> doors = new List<LG_WeakDoor>();

			public static List<LG_WeakDoor> unche = new List<LG_WeakDoor>();

			public static int DropCount = 0;

			public void Initialize()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Invalid comparison between Unknown and I4
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: Invalid comparison between Unknown and I4
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: Invalid comparison between Unknown and I4
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02db: Unknown result type (might be due to invalid IL or missing references)
				pActiveExpedition activeExpeditionData = RundownManager.GetActiveExpeditionData();
				if ((int)activeExpeditionData.tier == 2 && activeExpeditionData.expeditionIndex == 0)
				{
					List<LG_Area> areas = Builder.CurrentFloor.MainDimension.Layers[0].m_zones[1].m_areas;
					foreach (int item in new List<int> { 0, 3 })
					{
						Il2CppArrayBase<EnemyRespawnerVisual> componentsInChildren = ((Component)areas[item]).GetComponentsInChildren<EnemyRespawnerVisual>();
						Log.LogInfo((object)("zone 1 area " + item + " loses " + componentsInChildren.Count));
						foreach (EnemyRespawnerVisual item2 in componentsInChildren)
						{
							Transform transform = ((Component)item2).transform;
							transform.position += new Vector3(0f, 500f, 0f);
							((Behaviour)item2).enabled = false;
							((Component)item2).gameObject.SetActive(false);
						}
					}
				}
				if ((int)activeExpeditionData.tier == 3 && activeExpeditionData.expeditionIndex == 5)
				{
					List<LG_Area> areas2 = Builder.CurrentFloor.MainDimension.Layers[0].m_zones[0].m_areas;
					for (int i = 0; i < 4; i++)
					{
						Il2CppArrayBase<EnemyRespawnerVisual> componentsInChildren2 = ((Component)areas2[i]).GetComponentsInChildren<EnemyRespawnerVisual>();
						Log.LogInfo((object)("zone 0 area " + i + " loses " + componentsInChildren2.Count));
						foreach (EnemyRespawnerVisual item3 in componentsInChildren2)
						{
							Transform transform2 = ((Component)item3).transform;
							transform2.position += new Vector3(0f, 500f, 0f);
							((Behaviour)item3).enabled = false;
							((Component)item3).gameObject.SetActive(false);
						}
					}
				}
				if ((int)activeExpeditionData.tier == 4 && activeExpeditionData.expeditionIndex == 1)
				{
					List<LG_Area> areas3 = Builder.CurrentFloor.MainDimension.Layers[0].m_zones[3].m_areas;
					for (int j = 0; j < 2; j++)
					{
						Il2CppArrayBase<EnemyRespawnerVisual> componentsInChildren3 = ((Component)areas3[j]).GetComponentsInChildren<EnemyRespawnerVisual>();
						Log.LogInfo((object)("zone 3 area " + j + " loses " + componentsInChildren3.Count));
						foreach (EnemyRespawnerVisual item4 in componentsInChildren3)
						{
							Transform transform3 = ((Component)item4).transform;
							transform3.position += new Vector3(0f, 500f, 0f);
							((Behaviour)item4).enabled = false;
							((Component)item4).gameObject.SetActive(false);
						}
					}
				}
				doors.Clear();
				unche.Clear();
				foreach (LG_WeakDoor item5 in Object.FindObjectsOfType<LG_WeakDoor>())
				{
					doors.Add(item5);
				}
				Log.LogInfo((object)("found weakdoors to monitor and anticheese: " + doors.Count()));
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(AntiCheese()), (Action)null);
			}

			public static IEnumerator AntiCheese()
			{
				try
				{
					int num = default(int);
					List<LG_WeakDoor>.Enumerator enumerator = default(List<LG_WeakDoor>.Enumerator);
					switch (num)
					{
					case 0:
					case 2:
						enumerator = doors.GetEnumerator();
						break;
					case 1:
					{
						LG_WeakDoor door = default(LG_WeakDoor);
						door.TriggerOperate(true);
						door.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
						Log.LogInfo((object)"door cheese prevented. how u like dem apples?");
						unche.Add(door);
						break;
					}
					case 3:
						goto end_IL_0000;
					default:
						yield break;
					}
					while (enumerator.MoveNext())
					{
						LG_WeakDoor door = enumerator.Current;
						if ((int)door.LastStatus == 11 && !unche.Contains(door))
						{
							new WaitForSeconds(3f);
							/*Error near IL_015c: Unexpected return in MoveNext()*/;
						}
					}
					((<AntiCheese>d__5)/*Error near IL_010a: stateMachine*/).<>m__Finally1();
					new WaitForSeconds(1f);
					/*Error near IL_015c: Unexpected return in MoveNext()*/;
					end_IL_0000:;
				}
				catch
				{
					//try-fault
					((IDisposable)/*Error near IL_014c: stateMachine*/).Dispose();
					throw;
				}
				((IDisposable)/*Error near IL_0153: stateMachine*/).Dispose();
				/*Error near IL_015c: Unexpected return in MoveNext()*/;
			}

			public static void WardenIntelFix()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				if (DropCount > 0)
				{
					GuiManager.PlayerLayer.m_wardenIntel.ResetSubObjectiveMesssagQueue();
					ManualLogSource log = Log;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("drop ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(DropCount);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" : wardenintel revival attempted");
					}
					log.LogInfo(val);
				}
				DropCount++;
			}
		}

		[HarmonyPatch(typeof(EnemyAllocator), "SpawnEnemy")]
		internal class OldTumorDamage_Patch1
		{
			[HarmonyPostfix]
			public static void Postfix(EnemyAllocator __instance, uint persistantID, AIG_CourseNode courseNode, AgentMode mode, Vector3 position, Quaternion rotation, EnemyGroup group = null, int placementIndex = -1)
			{
				Il2CppArrayBase<Dam_EnemyDamageLimb_Custom> componentsInChildren = ((Component)__instance.m_spawnedEnemyAgent).gameObject.GetComponentsInChildren<Dam_EnemyDamageLimb_Custom>();
				if (componentsInChildren == null)
				{
					return;
				}
				foreach (Dam_EnemyDamageLimb_Custom item in componentsInChildren)
				{
					Dam_EnemyDamageLimb_Custom val = ((Il2CppObjectBase)item).TryCast<Dam_EnemyDamageLimb_Custom>();
					if ((Object)(object)val != (Object)null)
					{
						Debug.Log(Object.op_Implicit("we have setup a tumor with m_clampDamageToLimbHealth=true"));
						val.m_clampDamageToLimbHealth = true;
					}
				}
			}
		}

		[HarmonyPatch(typeof(Dam_EnemyDamageBase), "ReceiveBulletDamage")]
		internal class OldTumorDamage_Patch2
		{
			[HarmonyPrefix]
			public static bool Prefix(Dam_EnemyDamageBase __instance, ref pBulletDamageData data)
			{
				Agent val = default(Agent);
				((pAgent)(ref data.source)).TryGet(ref val);
				if ((Object)(object)((Il2CppObjectBase)val).TryCast<PlayerAgent>() != (Object)null && data.limbID > 0)
				{
					Dam_EnemyDamageLimb_Custom val2 = ((Il2CppObjectBase)((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)__instance.DamageLimbs)[(int)data.limbID]).TryCast<Dam_EnemyDamageLimb_Custom>();
					if ((Object)(object)val2 != (Object)null)
					{
						float num = ((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)__instance).HealthMax);
						if (num > ((Dam_EnemyDamageLimb)val2).m_health)
						{
							if (num >= ((Dam_EnemyDamageLimb)val2).m_healthMax)
							{
								((UFloat16)(ref data.damage)).Set(((Dam_EnemyDamageLimb)val2).m_healthMax + 1.5259022E-05f * ((Dam_SyncedDamageBase)__instance).HealthMax, ((Dam_SyncedDamageBase)__instance).HealthMax);
							}
							if (num < ((Dam_EnemyDamageLimb)val2).m_healthMax)
							{
								((UFloat16)(ref data.damage)).Set(num + 1.5259022E-05f * ((Dam_SyncedDamageBase)__instance).HealthMax, ((Dam_SyncedDamageBase)__instance).HealthMax);
							}
							Debug.Log(Object.op_Implicit($"tumor damage cap was {((Dam_EnemyDamageLimb)val2).m_healthMax}, applied {((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)__instance).HealthMax)} on a tumor."));
						}
					}
				}
				return true;
			}
		}

		public override void Load()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("MadnessPatches");
			EventAPI.OnExpeditionStarted += ((BasePlugin)this).AddComponent<MadnessQOL>().Initialize;
			MadnessQOL.Log = ((BasePlugin)this).Log;
			LG_Factory.OnFactoryBuildDone += Action.op_Implicit((Action)MadnessQOL.WardenIntelFix);
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "MadnessQOL";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const bool GitIsDirty = false;
	}
}