Decompiled source of MADNESS v6.9.50

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/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;
	}
}