Decompiled source of System error v8.1.14

Plugins/System Error/ExtraSettings.dll

Decompiled 3 months 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.Text.Json;
using AIGraph;
using AK;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.UnityEngine;
using BepInEx.Unity.IL2CPP.Utils;
using CellMenu;
using ChainedPuzzles;
using Enemies;
using Expedition;
using ExtraSetting.Managers;
using ExtraSettings.ConfigFiles;
using ExtraSettings.GameScripts;
using ExtraSettings.Managers;
using ExtraSettings.Patches;
using ExtraSettings.PluginInfo;
using ExtraSettings.StructFiles;
using FX_EffectSystem;
using GTFO.API;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Localization;
using MTFO.Managers;
using Player;
using ReactorLightsOff.GameScripts;
using ReactorLightsOff.Patches;
using SNetwork;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.Video;

[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 = "")]
[assembly: AssemblyCompany("ExtraSettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExtraSettings")]
[assembly: AssemblyTitle("ExtraSettings")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ExtraSetting.StructFiles
{
	public static class OpenDoorEventSync
	{
		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct OpenDoorSycnEvent
		{
			public LG_SecurityDoor TargetedSecurityDoor;
		}
	}
}
namespace ExtraSetting.Managers
{
	public static class SyncingManager
	{
		public static List<TimedUnlockDoorsListCollection> TimedDoorsCollection = new List<TimedUnlockDoorsListCollection>();

		public static List<PortalCommandTerminalCollection> PortalTerminalCollection = new List<PortalCommandTerminalCollection>();

		public static List<LG_SecurityDoor_Locks> OpenDoorOnScanCompleteCollection = new List<LG_SecurityDoor_Locks>();

		public static List<HackSecurityDoorCollection> HackDoorCollection = new List<HackSecurityDoorCollection>();

		public static List<ReactorBackDoorListCollection> ReactorBackdoorTerminalsCollection = new List<ReactorBackDoorListCollection>();

		public static List<TerminalAlarmDoorListCollection> TerminalAlarmCollection = new List<TerminalAlarmDoorListCollection>();

		public static List<LightsOffObjectiveCollection> LightsOffObjectiveCollection = new List<LightsOffObjectiveCollection>();

		public static List<CorruptedReactorTerminalCollection> CorruptedReactorTerminalCollections = new List<CorruptedReactorTerminalCollection>();

		public static List<UplinkReactorTerminalCollection> uplinkReactorTerminalCollections = new List<UplinkReactorTerminalCollection>();

		public static List<TerminalLatePaswords> TerminalsNeedingPasswords = new List<TerminalLatePaswords>();

		public static void GetSyncedRandomNumber(ulong x, int MaxNumber)
		{
		}

		public static void SyncElevator(ulong x, PublicStructClass.ElevatorSync Packet)
		{
			GetBackToElevatorController.Current.OnClientReceived(x, Packet);
		}

		public static void SyncElevatorComplete(ulong x, PublicStructClass.DummyStruct Packet)
		{
			GetBackToElevatorController.Current.CompleteExpedition(x, Packet);
		}

		public static void SynElevatorCountdownTimer(ulong x, PublicStructClass.TimeSync Packet)
		{
			GetBackToElevatorController.Current.UpdateGUIClient(x, Packet);
		}

		public static void SpawnElevator(ulong x, PublicStructClass.DummyStruct Packet)
		{
			//IL_009e: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			GetBackToElevatorController component = ((Component)ElevatorRide.Cage).gameObject.GetComponent<GetBackToElevatorController>();
			((Component)ElevatorRide.Cage).gameObject.SetActive(true);
			ElevatorRide.Cage.ActivateWinCondition();
			if (component.m_ConnectedData.IsForwardExtract)
			{
				((Component)ElevatorRide.Cage).gameObject.transform.position = component.m_ConnectedData.ElevatorPositionForForwardExtract;
				((Component)ElevatorRide.Cage).gameObject.transform.eulerAngles = component.m_ConnectedData.ElevatorRotationForForwardExtract;
			}
			else
			{
				((Component)ElevatorRide.Cage).gameObject.transform.position = new Vector3(0f, -0.3527f, 5.7345f);
			}
			ElevatorRide.Cage.m_animator.Play("ElevatorLanding_Dropoff");
			PluginSetup.logSource.LogDebug((object)"SPAWN ELEVATOR RECEIVED");
		}

		public static void ConvertAndTriggerEvent(WardenEventDataConfig ConfigSettings, WardenEventGenericWave WaveSettings)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_003a: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			//IL_01ba: Expected O, but got Unknown
			//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_01f3: Expected O, but got Unknown
			WardenObjectiveEventData val = new WardenObjectiveEventData
			{
				WorldEventObjectFilter = ConfigSettings.WorldEventObjectFilter,
				Condition = ConfigSettings.Condition,
				Trigger = ConfigSettings.Trigger,
				Type = ConfigSettings.Type,
				DimensionIndex = ConfigSettings.DimensionIndex,
				Layer = ConfigSettings.Layer,
				LocalIndex = ConfigSettings.LocalIndex,
				CustomSubObjectiveHeader = LocalizedText.op_Implicit(ConfigSettings.CustomSubObjectiveHeader),
				CustomSubObjective = LocalizedText.op_Implicit(ConfigSettings.CustomSubObjective),
				Delay = ConfigSettings.Delay,
				Duration = ConfigSettings.Duration,
				ClearDimension = ConfigSettings.ClearDimension,
				SoundID = ConfigSettings.SoundID,
				SoundSubtitle = LocalizedText.op_Implicit(ConfigSettings.SoundSubtitle),
				DialogueID = ConfigSettings.DialogueID,
				FogSetting = ConfigSettings.FogSetting,
				FogTransitionDuration = ConfigSettings.FogTransitionDuration,
				EnemyID = ConfigSettings.EnemyID,
				Position = ConfigSettings.Position,
				Count = ConfigSettings.Count,
				Enabled = ConfigSettings.Enabled,
				ChainPuzzle = ConfigSettings.ChainPuzzle,
				UseStaticBioscanPoints = ConfigSettings.UseStaticBioscanPoints,
				TerminalCommand = ConfigSettings.TerminalCommand,
				TerminalCommandRule = ConfigSettings.TerminalCommandRule,
				EnemyWaveData = new GenericEnemyWaveData
				{
					WaveSettings = WaveSettings.WaveSettings,
					WavePopulation = WaveSettings.WavePopulation,
					AreaDistance = WaveSettings.AreaDistance,
					SpawnDelay = WaveSettings.SpawnDelay,
					TriggerAlarm = WaveSettings.TriggerAlarm,
					IntelMessage = LocalizedText.op_Implicit(WaveSettings.IntelMessage)
				}
			};
			if (ConfigSettings.WardenIntel != 0)
			{
				val.WardenIntel = LocalizedText.op_Implicit(ConfigSettings.WardenIntel);
			}
			else
			{
				val.WardenIntel = new LocalizedText
				{
					UntranslatedText = ConfigSettings.WardenIntelString
				};
			}
			WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val, (eWardenObjectiveEventTrigger)0, true, 0f);
		}

		public static string GetGameObjectPath(Transform transform)
		{
			string text = ((Object)transform).name;
			while ((Object)(object)transform.parent != (Object)null)
			{
				transform = transform.parent;
				text = ((Object)transform).name + "/" + text;
			}
			return text;
		}

		public static void SyncBoostersWithOthers(int CharacterIndex, int BoosterEffectModifier, float amount)
		{
			if ((Object)(object)PlayerManager.PlayerAgentsInLevel[CharacterIndex] != (Object)(object)PlayerManager.GetLocalPlayerAgent())
			{
				AgentModifierManager.AddModifierValue((Agent)(object)PlayerManager.PlayerAgentsInLevel[CharacterIndex], (AgentModifier)BoosterEffectModifier, amount, 0f);
				PluginSetup.logSource.LogDebug((object)$"Syncing Booster Effect with player agent: {PlayerManager.PlayerAgentsInLevel[CharacterIndex].PlayerName} || With effect: {(object)(AgentModifier)BoosterEffectModifier} || Amount: {amount} || Relative Percentage {AgentModifierManager.DecimalPercantageToTraitPercentage(amount)} ");
			}
		}

		public static void ReloadModdedContentOnCheckpointLoad()
		{
			Il2CppArrayBase<CustomFogSphereHandler> val = Object.FindObjectsOfType<CustomFogSphereHandler>();
			Il2CppArrayBase<RandomTerminalUplinkScript> val2 = Object.FindObjectsOfType<RandomTerminalUplinkScript>();
			if (val.Length > 0)
			{
				foreach (CustomFogSphereHandler item in val)
				{
					item.OnCheckPointReload();
				}
			}
			if (val2.Length > 0)
			{
				foreach (RandomTerminalUplinkScript item2 in val2)
				{
					item2.OnCheckPointReset();
				}
			}
			if (Object.op_Implicit((Object)(object)((Component)ElevatorRide.Cage).gameObject.GetComponent<GetBackToElevatorController>()))
			{
				((Component)ElevatorRide.Cage).gameObject.GetComponent<GetBackToElevatorController>().OnCheckPointReset();
			}
			if (TimedDoorsCollection.Count > 0)
			{
				for (int i = 0; i < TimedDoorsCollection.Count; i++)
				{
					((Component)TimedDoorsCollection[i].TimedUnlockDoorTerminal).gameObject.GetComponent<TimedDoorUnlock>().ResetOnCheckPoint(TimedDoorsCollection[i].TimedDoorTimer);
					PluginSetup.logSource.LogDebug((object)"Detected TimedDoor: Setting it back up again!");
				}
			}
			if (PortalTerminalCollection.Count > 0)
			{
				for (int j = 0; j < PortalTerminalCollection.Count; j++)
				{
					((Component)PortalTerminalCollection[j].CommandTerminal).gameObject.GetComponent<TerminalCommandTeleporter>().OnCheckPointReload();
					PluginSetup.logSource.LogDebug((object)"Detected PortalCommand: Setting it back up again!");
				}
			}
			if (HackDoorCollection.Count > 0)
			{
				for (int k = 0; k < HackDoorCollection.Count; k++)
				{
					((Component)HackDoorCollection[k].HackSecurityDoorLock.m_door).gameObject.GetComponent<HackSecurityDoorScript>().OnCheckPointReload();
					PluginSetup.logSource.LogDebug((object)"Detected a HackSecurityDoor: Setting it up again!");
				}
			}
			if (TerminalAlarmCollection.Count > 0)
			{
				for (int l = 0; l < TerminalAlarmCollection.Count; l++)
				{
					((Component)TerminalAlarmCollection[l].TerminalAlarmMainTerminal).gameObject.GetComponent<TerminalAlarm>().OnCheckPointReload();
					PluginSetup.logSource.LogDebug((object)"Detected a TerminalAlarm: Setting it up again!");
				}
			}
			if (LightsOffObjectiveCollection.Count > 0)
			{
				for (int m = 0; m < LightsOffObjectiveCollection.Count; m++)
				{
					((Component)LightsOffObjectiveCollection[m].LightsOffTerminal).gameObject.GetComponent<LightsOnTerminalScript>().OnCheckPointReset();
					PluginSetup.logSource.LogDebug((object)"Detected a LightsOffObjeciveTerminal: Setting it up again!");
				}
			}
			if (uplinkReactorTerminalCollections.Count > 0)
			{
				for (int n = 0; n < uplinkReactorTerminalCollections.Count; n++)
				{
					((Component)uplinkReactorTerminalCollections[n].UplinkTerminal).gameObject.GetComponent<UplinkTerminalReactorScript>().OnCheckPointReload();
					PluginSetup.logSource.LogDebug((object)"Detected a UplinkReactorTerminalEvent: Setting it up again!");
				}
			}
			if (CorruptedReactorTerminalCollections.Count > 0)
			{
				for (int num = 0; num < CorruptedReactorTerminalCollections.Count; num++)
				{
					((Component)CorruptedReactorTerminalCollections[num].CorruptedTerminal).gameObject.GetComponent<CorruptedTerminalDummyScript>().OnCheckPointLoaded();
					PluginSetup.logSource.LogDebug((object)"Detected a CorruptedReactorTerminalEvent: Setting it up again!");
				}
			}
		}

		public static void UnlockDoor(LG_SecurityDoor DoorToUnlock)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0033: 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)
			if ((int)DoorToUnlock.LastStatus != 10 || (int)DoorToUnlock.LastStatus != 16)
			{
				DoorToUnlock.m_sync.AttemptDoorInteraction((eDoorInteractionType)5, 0f, 0f, default(Vector3), (Agent)null);
			}
		}

		public static void OpenDoor(LG_SecurityDoor DoorToOpen)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0033: 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)
			if ((int)DoorToOpen.LastStatus != 10 || (int)DoorToOpen.LastStatus != 16)
			{
				DoorToOpen.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
			}
		}

		public static void IncreaseEnemyObjectiveCount(ulong x, EnemyCounterSync.EnemySync Packet)
		{
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: 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)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled = Packet.CounterBeforeIncrease;
			ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled++;
			if (HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].ShowWardenIntel)
			{
				GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", $"<color=red>ENEMY KILLED: NUMBER KILLED: </color><color=orange>{ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled}</color><color=red>: NUMBER OF KILLS NEEDED: </color><color=orange>{HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].numberOfKillsNeeded}</color>", false, 200f, 5f, (Action)null);
			}
			if (HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].showCustomProgressionMessage)
			{
				GuiManager.PlayerLayer.WardenObjectives.SetCustomSubText((Func<string>)(object)Object.op_Implicit("Hunting Objective"), (Func<string>)(object)Object.op_Implicit($"{HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].ProgressionMessage}: <color=orange>{ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled}</color>/{HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].numberOfKillsNeeded}"));
			}
			if (HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].UseEventsOnKills && HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].EventsOnKills.Count > 0)
			{
				for (int i = 0; i < HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].EventsOnKills.Count; i++)
				{
					if (ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled != HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].EventsOnKills[i].KillRequirement)
					{
						continue;
					}
					foreach (WardenEventDataConfig item in HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].EventsOnKills[i].EventsInfo)
					{
						ConvertAndTriggerEvent(item, item.EnemyWaveData);
					}
				}
			}
			if (ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled >= HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].numberOfKillsNeeded && HunterEnemyObjectiveSetup.HuntedEnemiesInfo[EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic].CompleteObjective)
			{
				pWardenObjectiveInteraction val = default(pWardenObjectiveInteraction);
				val.type = (eWardenObjectiveInteractionType)2;
				val.inLayer = (LG_LayerType)(byte)Packet.LG_Layer;
				pWardenObjectiveInteraction val2 = val;
				WardenObjectiveManager.Current.AttemptInteract(val2);
			}
			PluginSetup.logSource.LogDebug((object)$"SYNCINGMANAGER: IncreaseEnemyObjectiveCount: NumberKilled: {ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled}");
		}

		public static void IncreaseTerminalPowerZoneIndex(ulong x, PublicStructClass.LightsOnTerminalObjectiveStruct Packet)
		{
			//IL_011e: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			if (CustomLightsOnObjectiveConfigSetup.LightsOnInfo[Builder_BuildDone_Postfix.LightsOffStaticIndex].IsObjective)
			{
				Builder_BuildDone_Postfix.NumberOfLightsOffObjective++;
				GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", $"<color=red>ZONE REPAIRED! NUMBER OF ZONES REPAIRED: </color><color=orange>{Builder_BuildDone_Postfix.NumberOfLightsOffObjective}</color>/<color=orange>{CustomLightsOnObjectiveConfigSetup.LightsOnInfo[Builder_BuildDone_Postfix.LightsOffStaticIndex].ObjectiveAmountNeeded}</color>", false, 200f, 5f, (Action)null);
				if (CustomLightsOnObjectiveConfigSetup.LightsOnInfo[Builder_BuildDone_Postfix.LightsOffStaticIndex].HaveCustomProgressionMessage)
				{
					GuiManager.PlayerLayer.WardenObjectives.SetCustomSubText((Func<string>)(object)Object.op_Implicit(""), (Func<string>)(object)Object.op_Implicit($"{CustomLightsOnObjectiveConfigSetup.LightsOnInfo[Builder_BuildDone_Postfix.LightsOffStaticIndex].CustomProgressionMessage} <color=orange>{Builder_BuildDone_Postfix.NumberOfLightsOffObjective}</color> / <color=orange>{CustomLightsOnObjectiveConfigSetup.LightsOnInfo[Builder_BuildDone_Postfix.LightsOffStaticIndex].ObjectiveAmountNeeded}</color>"));
				}
				if (Builder_BuildDone_Postfix.NumberOfLightsOffObjective >= CustomLightsOnObjectiveConfigSetup.LightsOnInfo[Builder_BuildDone_Postfix.LightsOffStaticIndex].ObjectiveAmountNeeded)
				{
					pWardenObjectiveInteraction val = default(pWardenObjectiveInteraction);
					val.type = (eWardenObjectiveInteractionType)2;
					val.inLayer = (LG_LayerType)(byte)Packet.TargetedLayer;
					pWardenObjectiveInteraction val2 = val;
					WardenObjectiveManager.Current.AttemptInteract(val2);
				}
				PluginSetup.logSource.LogDebug((object)"SYNCINGMANAGER: INCREASELIGHTSONTERMINALOBJECTIVE");
			}
			else
			{
				PluginSetup.logSource.LogWarning((object)"WARNING: SYNCINGMANAGER INCREASELIGHTSONTERMINALOBJECTIVE HAS BEEN CALLED BUT IS NOT COUNTED! IS THIS INTENTIONAL? IF NOT, SET 'IsObjective' TO TRUE");
			}
		}

		public static void RandomTerminalSync(ulong x, PublicStructClass.RandomTerminalAlarmSync Packet)
		{
			LG_Zone val = default(LG_Zone);
			Builder.CurrentFloor.TryGetZoneByLocalIndex((eDimensionIndex)Packet.TerminalDimension, (LG_LayerType)(byte)Packet.TerminalLayerType, (eLocalZoneIndex)Packet.TerminalZoneIndex, ref val);
			LG_Zone val2 = default(LG_Zone);
			Builder.CurrentFloor.TryGetZoneByLocalIndex((eDimensionIndex)Packet.VerificationTerminalDimension, (LG_LayerType)(byte)Packet.VerificationTerminalLayerType, (eLocalZoneIndex)Packet.TerminalZoneIndex, ref val2);
			LG_Zone val3 = default(LG_Zone);
			Builder.CurrentFloor.TryGetZoneByLocalIndex((eDimensionIndex)Packet.DoorDimension, (LG_LayerType)(byte)Packet.DoorLayerType, (eLocalZoneIndex)Packet.DoorZoneIndex, ref val3);
			PluginSetup.logSource.LogDebug((object)"SYNCINGMANAGER: Syncing TerminalAlarm Selection");
		}

		public static void SyncTerminalOutput(ulong x, PublicStructClass.OutputSyncStruct Packet)
		{
			LG_Zone val = default(LG_Zone);
			Builder.CurrentFloor.TryGetZoneByLocalIndex((eDimensionIndex)Packet.TerminalDimension, (LG_LayerType)(byte)Packet.TerminalLayer, (eLocalZoneIndex)Packet.TerminalZoneIndex, ref val);
			if (Object.op_Implicit((Object)(object)((Component)val.TerminalsSpawnedInZone[Packet.TerminalIndex]).gameObject.GetComponent<TerminalAlarm>()) && Packet.isTerminalAlarm)
			{
				((Component)val.TerminalsSpawnedInZone[Packet.TerminalIndex]).gameObject.GetComponent<TerminalAlarm>().SyncOutput();
			}
			if (Object.op_Implicit((Object)(object)((Component)val.TerminalsSpawnedInZone[Packet.TerminalIndex]).gameObject.GetComponent<TimedDoorUnlock>()) && Packet.isTimedDoorUnlock)
			{
				((Component)val.TerminalsSpawnedInZone[Packet.TerminalIndex]).gameObject.GetComponent<TimedDoorUnlock>().SyncOutput();
			}
			if (Object.op_Implicit((Object)(object)((Component)val.TerminalsSpawnedInZone[Packet.TerminalIndex]).gameObject.GetComponent<LightsOnTerminalScript>()) && Packet.isLightsOnObjective)
			{
				if (Packet.isVerificationOutput)
				{
					((Component)val.TerminalsSpawnedInZone[Packet.TerminalIndex]).gameObject.GetComponent<LightsOnTerminalScript>().SyncVerifyOutput();
				}
				else
				{
					((Component)val.TerminalsSpawnedInZone[Packet.TerminalIndex]).gameObject.GetComponent<LightsOnTerminalScript>().SyncOutput();
				}
			}
		}
	}
}
namespace ReactorLightsOff.Patches
{
	public static class GameStateManager_Update_Postfix
	{
		public static List<SNet_Player> PlayersInLobby = new List<SNet_Player>();

		[HarmonyPatch(typeof(GameStateManager), "Update")]
		public static void Postfix()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)GameStateManager.CurrentStateName == 5)
			{
				if (PlayersInLobby.Count > 0)
				{
					PlayersInLobby.Clear();
					PluginSetup.logSource.LogDebug((object)$"Removing players | Count: {PlayersInLobby.Count}");
				}
				LG_SecurityDoor_Locks_SetupForChainedPuzzle_Postfix.HackDoorOpenActive = false;
				LG_SecurityDoor_Locks_SetupForChainedPuzzle_Postfix.OpenDoorOnScanComplete = false;
				LG_DimensionPortal_Setup_Postfix.CanAddTerminal = false;
				Builder_BuildDone_Postfix.TimedUnlockActive = false;
				GS_InLevel_Enter_Postfix.IntervalActive = false;
				LG_PowerGenerator_Core_Setup_Postfix.ReactorActive = false;
				LG_WardenObjective_OnBuildDone_Postfix.ShowTimer = false;
				LG_WardenObjective_OnBuildDone_Postfix.StartMalfunction = false;
				LG_WardenObjective_OnBuildDone_Postfix.CreateLightCollection = false;
				Builder_Build_Postfix.MovableScansActive = false;
				Builder_Build_Postfix.RandomizedScansActive = false;
				Builder_Build_Postfix.TerminalAlarmActive = false;
				Builder_Build_Postfix.CustomReactorPlacementActive = false;
				Builder_BuildDone_Postfix.TemperatureZoneActive = false;
				LG_SecurityDoor_Locks_SetupForChainedPuzzle_Postfix.ChangeExtractionScan = false;
				MWS_Charge_Enter_Postfix.MeleeSlowedDown = false;
				BulletWeapon_Update_Postfix.ReloadSlowedDown = false;
				ResetManager.HasCheckpointBeenCalledGlobal = false;
				Builder_BuildDone_Postfix.LightsOffObjectiveActive = false;
				LG_PopulateFunctionMarkersInZoneJob_TriggerFunctionBuilder_Postfix.IsFirstTime = true;
				Builder_Build_Postfix.CustomPrefabsActive = false;
				Builder_Build_Postfix.CustomReactorActive = false;
				Builder_Build_Postfix.RandomTerminalUplinksActive = false;
				LG_Distribute_WardenObjective_Build_Prefix.IsFirstTime = true;
				LG_PopulateFunctionMarkersInZoneJob_TriggerFunctionBuilder_Postfix.isFirstTimeHiding = true;
				LG_WardenObjective_OnBuildDone_Postfix.BackupMalfunctionTimer = 0f;
				ES_Dead_CommonEnter_Postfix.NumberOfEnemiesKilled = 0;
				EnemyAgent_Setup_Postfix.HuntedEnemyIndexStatic = 0;
				LG_WardenObjective_OnBuildDone_Postfix.ReactorIndexStatic = 0;
				LG_WardenObjective_Reactor_Update_Postfix.NumberOfGeneratorsDone = 0;
				LG_WardenObjective_Reactor_Update_Postfix.NumberOfTerminalsDone = 0;
				LG_WardenObjective_Reactor_Update_Postfix.ReactorWaveIndexStatic = 0;
				Builder_Build_Postfix.MovableScanIndexStatic = 0;
				Builder_Build_Postfix.RandomizedScansStaticIndex = 0;
				Builder_Build_Postfix.TerminalAlarmStaticIndex = 0;
				Builder_Build_Postfix.CustomReactorStaticIndex = 0;
				Builder_BuildDone_Postfix.TemperatureZoneStaticIndex = 0;
				LG_WardenObjective_Reactor_Update_Postfix.NumberOfTerminalGathersDone = 0;
				LG_WardenObjective_Reactor_Update_Postfix.ReactorWaveTerminalGatherIndexStatic = 0;
				LG_WardenObjective_Reactor_Update_Postfix.ReactorWaveCorruptedUplinkIndexStatic = 0;
				BulletWeapon_Update_Postfix.SavedMultiplierSlowDown = 0f;
				MWS_Charge_Enter_Postfix.SlowedDownMeleeMultiplier = 0f;
				LG_WardenObjective_Reactor_Update_Postfix.NumberOfCorruptedTerminalsDone = 0;
				Builder_BuildDone_Postfix.NumberOfLightsOffObjective = 0;
				Builder_BuildDone_Postfix.LightsOffStaticIndex = 0;
				ChainedPuzzleInstance_SetupMovement_Postfix.ScanCreationIndex = 0;
				LG_WardenObjective_Reactor_Update_Postfix.NumberOfHSUInsertsDone = 0;
				LG_WardenObjective_Reactor_Update_Postfix.ReactorHSUInstertStaticIndex = 0;
				Builder_Build_Postfix.CustomPrefabStaticIndex = 0;
				Builder_Build_Postfix.CustomDisinfectStationIndex = 0;
				Builder_Build_Postfix.CustomReactorIndex = 0;
				Builder_Build_Postfix.RandomTerminalUplinkIndex = 0;
				LG_SecurityDoor_Locks_SetupForChainedPuzzle_Postfix.NewExtractionScan = null;
				LG_SecurityDoor_Locks_SetupForChainedPuzzle_Postfix.NewExtractionMarker = null;
				if (SyncingManager.TerminalsNeedingPasswords.Count > 0)
				{
					SyncingManager.TerminalsNeedingPasswords.Clear();
				}
				if (EnemyAgent_Setup_Postfix.AllEnemies.Count > 0)
				{
					EnemyAgent_Setup_Postfix.AllEnemies.Clear();
				}
				if (LG_PowerGenerator_Core_Setup_Postfix.PowerGeneratorsInLevel.Count > 0)
				{
					LG_PowerGenerator_Core_Setup_Postfix.PowerGeneratorsInLevel.Clear();
				}
				if (SyncingManager.TimedDoorsCollection.Count > 0)
				{
					SyncingManager.TimedDoorsCollection.Clear();
				}
				if (SyncingManager.PortalTerminalCollection.Count > 0)
				{
					SyncingManager.PortalTerminalCollection.Clear();
				}
				if (SyncingManager.HackDoorCollection.Count > 0)
				{
					SyncingManager.HackDoorCollection.Clear();
				}
				if (SyncingManager.TerminalAlarmCollection.Count > 0)
				{
					SyncingManager.TerminalAlarmCollection.Clear();
				}
				if (SyncingManager.LightsOffObjectiveCollection.Count > 0)
				{
					SyncingManager.LightsOffObjectiveCollection.Clear();
				}
				if (SyncingManager.ReactorBackdoorTerminalsCollection.Count > 0)
				{
					SyncingManager.ReactorBackdoorTerminalsCollection.Clear();
				}
				if (SyncingManager.uplinkReactorTerminalCollections.Count > 0)
				{
					SyncingManager.uplinkReactorTerminalCollections.Clear();
				}
				if (SyncingManager.CorruptedReactorTerminalCollections.Count > 0)
				{
					SyncingManager.CorruptedReactorTerminalCollections.Clear();
				}
			}
		}
	}
	public static class LG_DimensionPortal_Setup_Postfix
	{
		public static int TerminalPortalIndexStatic;

		public static bool CanAddTerminal;

		[HarmonyPatch(typeof(LG_DimensionPortal), "Setup")]
		public static void Postfix(LG_DimensionPortal __instance)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < TerminalPortalCommandConfigSetup.PortalInfo.Count; i++)
			{
				if (TerminalPortalCommandConfigSetup.PortalInfo[i].internalEnabled && TerminalPortalCommandConfigSetup.PortalInfo[i].LevelID == RundownManager.ActiveExpedition.LevelLayoutData)
				{
					TerminalPortalIndexStatic = i;
					CanAddTerminal = true;
				}
			}
			LG_Zone val = default(LG_Zone);
			for (int j = 0; j < TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo.Count; j++)
			{
				if (CanAddTerminal && __instance.SpawnNode.m_zone.LocalIndex == TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].PortalZoneIndex && __instance.SpawnNode.m_zone.Layer.m_type == TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].PortalLayerType && __instance.SpawnNode.m_dimension.DimensionIndex == TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].PortalDimensionIndex)
				{
					Builder.Current.m_currentFloor.TryGetZoneByLocalIndex(TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TerminalDimensionIndex, TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TerminalLayer, TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TerminalZoneIndex, ref val);
					((Component)val.TerminalsSpawnedInZone[TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TerminalIndex]).gameObject.AddComponent<TerminalCommandTeleporter>().Setup(__instance, val.TerminalsSpawnedInZone[TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TerminalIndex], TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TerminalCommand, TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TerminalDescription, TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].ChainedPuzzleID, TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].AddTerminalCommand, TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TargetedDimensionIndex, TerminalPortalCommandConfigSetup.PortalInfo[TerminalPortalIndexStatic].PortalInfo[j].TargetedDimensionZoneIndex);
				}
			}
			PluginSetup.logSource.LogDebug((object)$"Portal_{__instance.m_serialNumber} is being setup");
		}
	}
}
namespace ReactorLightsOff.GameScripts
{
	public class TerminalCommandTeleporter : MonoBehaviour
	{
		public LG_ComputerTerminal Terminal;

		public LG_DimensionPortal Portal;

		public List<WardenObjectiveEventData> WardenEvents;

		public ChainedPuzzleInstance chainedPuzzleToActivate;

		public ChainedPuzzleDataBlock ChainedPuzzleData;

		public bool IsFirstTime;

		public bool noChainedPuzzle;

		public bool HasBeenReset;

		public bool AddedTerminalCommand;

		public void Setup(LG_DimensionPortal ConnectedPortal, LG_ComputerTerminal ConnectedTerminal, string Command, string CommandDescription, uint ChainedPuzzleID, bool AddTerminalCommand, eDimensionIndex TargetedDimensionIndex = 1, eLocalZoneIndex TargetedDimensionZone = 0)
		{
			//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)
			//IL_0016: 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_0042: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			Portal = ConnectedPortal;
			Terminal = ConnectedTerminal;
			HasBeenReset = false;
			AddedTerminalCommand = AddTerminalCommand;
			Portal.m_targetDimension = TargetedDimensionIndex;
			Portal.m_targetZone = TargetedDimensionZone;
			if (!AddTerminalCommand)
			{
				return;
			}
			SyncingManager.PortalTerminalCollection.Add(new PortalCommandTerminalCollection
			{
				CommandChainedPuzzleID = ChainedPuzzleID,
				CommandPortal = ConnectedPortal,
				CommandTerminal = ConnectedTerminal,
				TerminalCommand = Command,
				TerminalCommandDescription = CommandDescription
			});
			PluginSetup.logSource.LogDebug((object)$"Adding to the PortalCommandCollection: Count: {SyncingManager.PortalTerminalCollection.Count}");
			if (ChainedPuzzleID != 0)
			{
				ChainedPuzzleData = GameDataBlockBase<ChainedPuzzleDataBlock>.GetBlock(ChainedPuzzleID);
				chainedPuzzleToActivate = ChainedPuzzleManager.CreatePuzzleInstance(ChainedPuzzleData, Terminal.SpawnNode.m_area, Terminal.m_wardenObjectiveSecurityScanAlign.position, ((Component)Terminal).transform);
				chainedPuzzleToActivate.OnPuzzleSolved += Action.op_Implicit((Action)delegate
				{
					//IL_0075: Unknown result type (might be due to invalid IL or missing references)
					//IL_007a: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
					GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", $"<color=orange>PORTAL_{Portal.m_serialNumber}</color><color=red> IS STARTING UP IN </color><color=orange>ZONE_{Portal.SpawnNode.m_zone.NavInfo.Number}</color>", false, 200f, 4.5f, (Action)null);
					pDimensionPortalState state = Portal.m_stateReplicator.State;
					state.isSequenceIncomplete = false;
					Portal.m_targetDimension = TargetedDimensionIndex;
					Portal.m_targetZone = TargetedDimensionZone;
					Portal.PortalKeyInsertSequenceDone();
					Debug.Log(Object.op_Implicit("Starting portal insert sequence"));
				});
				noChainedPuzzle = false;
			}
			else if (ChainedPuzzleID == 0)
			{
				noChainedPuzzle = true;
			}
			Terminal.m_command.AddCommand((TERM_Command)42, Command, new LocalizedText
			{
				UntranslatedText = CommandDescription
			}, (TERM_CommandRule)0);
			IsFirstTime = true;
			Terminal.AddLine($"<color=yellow>MAINTENANCE TERMINAL FOR PORTAL_{Portal.m_serialNumber}</color>", true);
			Debug.LogError(Object.op_Implicit($"Setting up Terminal_{ConnectedTerminal.m_serialNumber}: Portal - {ConnectedPortal.PublicName}_{ConnectedPortal.m_serialNumber}: Command - {Command}: Command Description - {CommandDescription}: ChainedPuzzleID - {ChainedPuzzleID}: IsFirstTime - {IsFirstTime}: noChainedPuzzle - {noChainedPuzzle}"));
		}

		public void OnCheckPointReload()
		{
			IsFirstTime = true;
			HasBeenReset = true;
			PluginSetup.logSource.LogDebug((object)"ONCHECKPOINTRELOAD: PORTAL RESET:");
		}

		public void Update()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if (HasBeenReset && (int)GameStateManager.CurrentStateName == 10 && AddedTerminalCommand)
			{
				Terminal.AddLine($"<color=yellow>PORTAL MAINTENANCE TERMINAL FOR PORTAL_{Portal.m_serialNumber}</color>", true);
				PluginSetup.logSource.LogDebug((object)"ONCHECKPOINTLOADED: PORTAL LATE SETUP");
				HasBeenReset = false;
			}
			if (!AddedTerminalCommand || !Terminal.CommandIsUsed((TERM_Command)42) || !Terminal.m_hasInteractingPlayer || !IsFirstTime)
			{
				return;
			}
			Terminal.m_command.AddOutput((TerminalLineType)4, "Processing Command...", 3.5f, (TerminalSoundType)0, (TerminalSoundType)0);
			if (!noChainedPuzzle)
			{
				Terminal.m_command.AddOutput((TerminalLineType)4, "<color=yellow>Biometric Scan Required</color>", 3.5f, (TerminalSoundType)0, (TerminalSoundType)0);
				Terminal.m_command.AddOutputEmptyLine(0f);
				Terminal.m_command.OnEndOfQueue = Action.op_Implicit((Action)delegate
				{
					chainedPuzzleToActivate.AttemptInteract((eChainedPuzzleInteraction)0);
					Debug.Log(Object.op_Implicit("Starting chainedpuzzle"));
				});
			}
			else if (noChainedPuzzle)
			{
				Terminal.m_command.AddOutput((TerminalLineType)4, "Preparing Portal For Startup", 3.5f, (TerminalSoundType)0, (TerminalSoundType)0);
				Terminal.m_command.AddOutputEmptyLine(0f);
				Terminal.m_command.OnEndOfQueue = Action.op_Implicit((Action)delegate
				{
					GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", $"<color=yellow>PORTAL_{Portal.m_serialNumber}</color><color=red> IS STARTING UP IN </color><color=yellow>ZONE_{Portal.SpawnNode.m_zone.NavInfo.Number}</color>", false, 200f, 4.5f, (Action)null);
					Portal.PortalKeyInsertSequenceDone();
					Debug.Log(Object.op_Implicit("Starting portal insert sequence"));
				});
			}
			IsFirstTime = false;
		}
	}
}
namespace ExtraSettings.StructFiles
{
	public static class EnemyCounterSync
	{
		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct EnemySync
		{
			public int CounterBeforeIncrease;

			public int LG_Layer;
		}
	}
	public static class PublicStructClass
	{
		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct DoorChangeStruct
		{
			public int ChainedPuzzleID;

			public bool CheckPointChanged;

			public int CheckPointID;

			public int DoorZoneIndex;

			public int DoorLayerType;

			public int DoorDimensionIndex;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct DummyStruct
		{
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct ElevatorSync
		{
			public bool TimerStarted;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct SecurityTokenStruct
		{
			public int DoorZoneIndex;

			public int DoorLayer;

			public int DoorDimensionIndex;

			public int CurrentCount;

			public int CurrentLayout;

			public int CollectedOrbIndex;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct CodeSyncTerminalAlarm
		{
			public string VerificationCode;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct TimeSync
		{
			public float Time;

			public bool TimerActive;

			public int Minutes;

			public int Seconds;

			public bool KillAll;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct BoosterSync
		{
			public int BoosterEffectModifierInt;

			public int CharacterIndex;

			public float BoosterEffectAmount;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct RandomTerminalSyncReactor
		{
			public int TerminalIndex;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct LightsOnTerminalObjectiveStruct
		{
			public int TargetedLayer;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct SyncingNumber
		{
			public int SyncingNumberReturned;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct OutputSyncStruct
		{
			public int TerminalZoneIndex;

			public int TerminalLayer;

			public int TerminalDimension;

			public int TerminalIndex;

			public bool isTerminalAlarm;

			public bool isTimedDoorUnlock;

			public bool isLightsOnObjective;

			public bool isVerificationOutput;
		}

		[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
		public struct RandomTerminalAlarmSync
		{
			public int TerminalIndex;

			public int TerminalZoneIndex;

			public int TerminalLayerType;

			public int TerminalDimension;

			public int VerificationTerminalZoneIndex;

			public int VerificationTerminalLayerType;

			public int VerificationTerminalDimension;

			public int VerificationTerminalIndex;

			public int DoorZoneIndex;

			public int DoorLayerType;

			public int DoorDimension;

			public int LoopFirstIndex;

			public int LoopSecondIndex;
		}
	}
}
namespace ExtraSettings.PluginInfo
{
	[BepInPlugin("com.Breezy.ExtraSettings", "ExtraSettings", "1.0.0")]
	[BepInProcess("GTFO.exe")]
	public class PluginSetup : BasePlugin
	{
		public static bool m_RepairGeomorph = true;

		public static ManualLogSource logSource;

		public override void Load()
		{
			logSource = ((BasePlugin)this).Log;
			if (!Directory.Exists(Path.Combine(ConfigManager.CustomPath, "ExtraSettings")))
			{
				Directory.CreateDirectory(Path.Combine(ConfigManager.CustomPath, "ExtraSettings"));
			}
			HackDoorConfigSetup.Load();
			OpenDoorOnScanCompleteConfigSetup.Load();
			TerminalPortalCommandConfigSetup.Load();
			CustomReactorEventsConfigSetup.Load();
			EnemyPlayerHearBeatConfigSetup.Load();
			TimedUnlockDoorsConfigSetup.Load();
			HunterEnemyObjectiveSetup.Load();
			CustomMovableScanPositions.Load();
			RandomAlarmConfigSetup.Load();
			TerminalAlarmConfigSetup.Load();
			CustomReactorPlacementConfigSetup.Load();
			TemperatureZoneConfigSetup.Load();
			CustomLightsOnObjectiveConfigSetup.Load();
			CustomEnemySpawnPositionsConfigSetup.Load();
			TimedExpeditionConfigSetup.Load();
			CustomPrefabsConfigSetup.Load();
			RandomTerminalUplinksConfigSetup.Load();
			SpecializedCharactersConfigSetup.Load();
			ReactorInAnyZoneConfigSetup.Load();
			CustomGearConfigSetup.Load();
			CustomSpawnCapSetup.Load();
			CustomSpawnPointSetup.Load();
			CustomExtractionSetup.Load();
			TokenConfigSetup.Load();
			CustomPouncerDataSetup.Load();
			GetBackToElevatorConfigSetup.Load();
			OxygenEnvironmentSetup.Load();
			AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)delegate
			{
				RepairGeomorph(ignoreSetup: true, SetupGondola: false);
			});
			Harmony.CreateAndPatchAll(typeof(StartGame_Awake_Postfix), (string)null);
		}

		public static void RepairGeomorph(bool ignoreSetup, bool SetupGondola)
		{
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			if (m_RepairGeomorph && !ignoreSetup)
			{
				AssetShardManager.LoadShardAsync((AssetBundleName)3, (AssetBundleShard)18, (Action<AsyncOperation>)null, (LoadSceneMode)1);
				GameObject val = ((Il2CppObjectBase)AssetAPI.GetLoadedAsset("Assets/MyPrefabs/Geomorphs/ServiceGeos/Gardens_Hub_MC_01_Activator.prefab")).TryCast<GameObject>();
				logSource.LogError((object)((Object)val).name);
				Transform val2 = val.transform.FindChild("AreaA/EnvProps/ActivatorPlatform/ActivatorAlign");
				logSource.LogError((object)((Object)val2).name);
				string text = "DataExtractorDevice_DataSphere";
				LG_HSUActivator_Core[] array = ((IEnumerable<Object>)Object.FindObjectsOfTypeAll(Il2CppType.From(typeof(LG_HSUActivator_Core)))).Select((Object x) => ((Il2CppObjectBase)x).Cast<LG_HSUActivator_Core>()).ToArray();
				logSource.LogError((object)array.Length);
				LG_HSUActivator_Core[] array2 = array;
				foreach (LG_HSUActivator_Core val3 in array2)
				{
					if (((Object)val3).name == text)
					{
						LG_HSUActivator_Core val4 = Object.Instantiate<LG_HSUActivator_Core>(val3);
						((Component)val4).gameObject.transform.parent = val2;
						((Component)val4).gameObject.transform.position = val2.position;
						((Component)val4).gameObject.transform.eulerAngles = val2.eulerAngles;
						logSource.LogDebug((object)"Fixing Activator Geo");
					}
				}
				m_RepairGeomorph = false;
			}
			if (ignoreSetup)
			{
				AssetShardManager.LoadShardAsync((AssetBundleName)3, (AssetBundleShard)18, (Action<AsyncOperation>)null, (LoadSceneMode)1);
				logSource.LogError((object)"Ignoring setup, just loading shard!");
			}
			if (SetupGondola)
			{
				GameObject val5 = ((Il2CppObjectBase)AssetAPI.GetLoadedAsset("Assets/MyPrefabs/Geomorphs/TechGeomorphs/Tech_I_MC_Gondola.prefab")).TryCast<GameObject>();
				((Component)val5.transform.FindChild("Anim_Gondola/Gondola/Trigger")).gameObject.AddComponent<MovingPlatformScript>();
			}
		}

		public static void OnStartupAssetsLoad()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			string text = "assets/bundledassets/testbundle/introclip.mp4";
			logSource.LogError((object)LoadBNK(File.ReadAllBytes(ConfigManager.CustomPath + "\\HopeSound.bnk"), out var bnkID));
			logSource.LogError((object)bnkID);
			ClassInjector.RegisterTypeInIl2Cpp<AudioPlayerOnStartup>();
			MainMenuGuiLayer.Current.PageIntro.m_step = (CM_IntroStep)1;
			MainMenuGuiLayer.Current.PageIntro.m_bgScare1.clip = ((Il2CppObjectBase)AssetAPI.GetLoadedAsset(text)).TryCast<VideoClip>();
			((Component)MainMenuGuiLayer.Current.PageIntro.m_bgScare1).gameObject.active = true;
			((Component)MainMenuGuiLayer.Current.PageIntro.m_bgScare1).gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
			((Component)MainMenuGuiLayer.Current.PageIntro.m_bgScare1).transform.localScale = new Vector3(1.6f, 1.35f, 1f);
			MainMenuGuiLayer.Current.PageIntro.m_bgScare1.loopPointReached = PluginSetup.AddListener<EventHandler, Action<VideoPlayer>>(MainMenuGuiLayer.Current.PageIntro.m_bgScare1.loopPointReached, (Action<VideoPlayer>)onVideoEnd);
			MainMenuGuiLayer.Current.PageIntro.m_bgScare1.Play();
			((Component)MainMenuGuiLayer.Current.PageIntro.m_bgScare1).gameObject.AddComponent<AudioPlayerOnStartup>().StartAudio();
		}

		public static bool LoadBNK(byte[] bytes, out uint bnkID)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Invalid comparison between Unknown and I4
			try
			{
				uint num = (uint)bytes.Length;
				GCHandle gCHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
				IntPtr intPtr = gCHandle.AddrOfPinnedObject();
				if ((intPtr.ToInt64() & 0xF) != 0)
				{
					byte[] array = new byte[(long)bytes.Length + 16L];
					IntPtr intPtr2 = GCHandle.Alloc(array, GCHandleType.Pinned).AddrOfPinnedObject();
					int destinationIndex = 0;
					if ((intPtr2.ToInt64() & 0xF) != 0)
					{
						long num2 = (intPtr2.ToInt64() + 15) & -16;
						destinationIndex = (int)(num2 - intPtr2.ToInt64());
						intPtr2 = new IntPtr(num2);
					}
					Array.Copy(bytes, 0, array, destinationIndex, bytes.Length);
					intPtr = intPtr2;
					gCHandle.Free();
				}
				return (int)AkSoundEngine.LoadBank(intPtr, num, ref bnkID) == 1;
			}
			catch (Exception)
			{
				bnkID = 0u;
				return false;
			}
		}

		public static void onVideoEnd(VideoPlayer player)
		{
			CM_PageBase.s_sound.Stop();
			((Component)player).gameObject.active = false;
			MainMenuGuiLayer.Current.PageIntro.OnSkip();
		}

		public static T1 AddListener<T1, T2>(T1 orig, T2 newDelegate) where T1 : Delegate where T2 : Delegate
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			return ((Delegate)(object)orig == (Delegate)null) ? DelegateSupport.ConvertDelegate<T1>((Delegate)newDelegate) : ((Il2CppObjectBase)Delegate.Combine((Delegate)(object)orig, (Delegate)DelegateSupport.ConvertDelegate<T1>((Delegate)newDelegate))).TryCast<T1>();
		}
	}
	public static class HackDoorConfigSetup
	{
		public static List<HackSecurityDoorConfig> SecurityInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				SecurityInfo = JsonSerializer.Deserialize<List<HackSecurityDoorConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				SecurityInfo = new List<HackSecurityDoorConfig>();
				SecurityInfo.Add(new HackSecurityDoorConfig());
				string contents = JsonSerializer.Serialize(SecurityInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class OpenDoorOnScanCompleteConfigSetup
	{
		public static List<OpenDoorOnScanCompleteConfig> SecurityDoorInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				SecurityDoorInfo = JsonSerializer.Deserialize<List<OpenDoorOnScanCompleteConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				SecurityDoorInfo = new List<OpenDoorOnScanCompleteConfig>();
				SecurityDoorInfo.Add(new OpenDoorOnScanCompleteConfig());
				string contents = JsonSerializer.Serialize(SecurityDoorInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class TerminalPortalCommandConfigSetup
	{
		public static List<TerminalPortalConfigMain> PortalInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				PortalInfo = JsonSerializer.Deserialize<List<TerminalPortalConfigMain>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				PortalInfo = new List<TerminalPortalConfigMain>();
				PortalInfo.Add(new TerminalPortalConfigMain());
				string contents = JsonSerializer.Serialize(PortalInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class EnemyPlayerHearBeatConfigSetup
	{
		public static List<EnemyStaminaProximityConfig> EnemyInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				EnemyInfo = JsonSerializer.Deserialize<List<EnemyStaminaProximityConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				EnemyInfo = new List<EnemyStaminaProximityConfig>();
				EnemyInfo.Add(new EnemyStaminaProximityConfig());
				string contents = JsonSerializer.Serialize(EnemyInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class TimedUnlockDoorsConfigSetup
	{
		public static List<TimedDoorUnlockConfig> TimedDoorsInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				TimedDoorsInfo = JsonSerializer.Deserialize<List<TimedDoorUnlockConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				TimedDoorsInfo = new List<TimedDoorUnlockConfig>();
				TimedDoorsInfo.Add(new TimedDoorUnlockConfig());
				string contents = JsonSerializer.Serialize(TimedDoorsInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomReactorEventsConfigSetup
	{
		public static List<CustomReactorEventsConfig> ReactorInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				ReactorInfo = JsonSerializer.Deserialize<List<CustomReactorEventsConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				ReactorInfo = new List<CustomReactorEventsConfig>();
				ReactorInfo.Add(new CustomReactorEventsConfig());
				string contents = JsonSerializer.Serialize(ReactorInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class HunterEnemyObjectiveSetup
	{
		public static List<HunterMainConfig> HuntedEnemiesInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				HuntedEnemiesInfo = JsonSerializer.Deserialize<List<HunterMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				HuntedEnemiesInfo = new List<HunterMainConfig>();
				HuntedEnemiesInfo.Add(new HunterMainConfig());
				string contents = JsonSerializer.Serialize(HuntedEnemiesInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomMovableScanPositions
	{
		public static List<CustomScanPositionsMainConfig> ChainedPuzzleInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				ChainedPuzzleInfo = JsonSerializer.Deserialize<List<CustomScanPositionsMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				ChainedPuzzleInfo = new List<CustomScanPositionsMainConfig>();
				ChainedPuzzleInfo.Add(new CustomScanPositionsMainConfig());
				string contents = JsonSerializer.Serialize(ChainedPuzzleInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomLightsOnObjectiveConfigSetup
	{
		public static List<LightsOnObjectiveMainConfig> LightsOnInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				LightsOnInfo = JsonSerializer.Deserialize<List<LightsOnObjectiveMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				LightsOnInfo = new List<LightsOnObjectiveMainConfig>();
				LightsOnInfo.Add(new LightsOnObjectiveMainConfig());
				string contents = JsonSerializer.Serialize(LightsOnInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class RandomAlarmConfigSetup
	{
		public static List<RandomAlarmMainConfig> RandomizedDoorsInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				RandomizedDoorsInfo = JsonSerializer.Deserialize<List<RandomAlarmMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				RandomizedDoorsInfo = new List<RandomAlarmMainConfig>();
				RandomizedDoorsInfo.Add(new RandomAlarmMainConfig());
				string contents = JsonSerializer.Serialize(RandomizedDoorsInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class TerminalAlarmConfigSetup
	{
		public static List<TerminalAlarmMainConfig> TerminalAlarmsInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				TerminalAlarmsInfo = JsonSerializer.Deserialize<List<TerminalAlarmMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				TerminalAlarmsInfo = new List<TerminalAlarmMainConfig>();
				TerminalAlarmsInfo.Add(new TerminalAlarmMainConfig());
				string contents = JsonSerializer.Serialize(TerminalAlarmsInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomReactorPlacementConfigSetup
	{
		public static List<CustomReactorsMainConfig> CustomReactorInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				CustomReactorInfo = JsonSerializer.Deserialize<List<CustomReactorsMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				CustomReactorInfo = new List<CustomReactorsMainConfig>();
				CustomReactorInfo.Add(new CustomReactorsMainConfig());
				string contents = JsonSerializer.Serialize(CustomReactorInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class TemperatureZoneConfigSetup
	{
		public static List<TemperatureZoneMainConfig> TemperatureInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				TemperatureInfo = JsonSerializer.Deserialize<List<TemperatureZoneMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				TemperatureInfo = new List<TemperatureZoneMainConfig>();
				TemperatureInfo.Add(new TemperatureZoneMainConfig());
				string contents = JsonSerializer.Serialize(TemperatureInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomEnemySpawnPositionsConfigSetup
	{
		public static List<CustomEnemySpawnPositionsMain> EnemySpawnPositions;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				EnemySpawnPositions = JsonSerializer.Deserialize<List<CustomEnemySpawnPositionsMain>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				EnemySpawnPositions = new List<CustomEnemySpawnPositionsMain>();
				EnemySpawnPositions.Add(new CustomEnemySpawnPositionsMain());
				string contents = JsonSerializer.Serialize(EnemySpawnPositions, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class TimedExpeditionConfigSetup
	{
		public static List<TimedExpeditionMainConfig> TimerSettingsMain;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				TimerSettingsMain = JsonSerializer.Deserialize<List<TimedExpeditionMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				TimerSettingsMain = new List<TimedExpeditionMainConfig>();
				TimerSettingsMain.Add(new TimedExpeditionMainConfig());
				string contents = JsonSerializer.Serialize(TimerSettingsMain, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomPrefabsConfigSetup
	{
		public static List<CustomPrefabConfigMain> CustomPrefabInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				CustomPrefabInfo = JsonSerializer.Deserialize<List<CustomPrefabConfigMain>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				CustomPrefabInfo = new List<CustomPrefabConfigMain>();
				CustomPrefabInfo.Add(new CustomPrefabConfigMain());
				string contents = JsonSerializer.Serialize(CustomPrefabInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class RandomTerminalUplinksConfigSetup
	{
		public static List<RandomTerminalUplinksMainConfig> TerminalUplinksInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				TerminalUplinksInfo = JsonSerializer.Deserialize<List<RandomTerminalUplinksMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				TerminalUplinksInfo = new List<RandomTerminalUplinksMainConfig>();
				TerminalUplinksInfo.Add(new RandomTerminalUplinksMainConfig());
				string contents = JsonSerializer.Serialize(TerminalUplinksInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class SpecializedCharactersConfigSetup
	{
		public static List<SpecializedCharacters> CharacterInfos;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				CharacterInfos = JsonSerializer.Deserialize<List<SpecializedCharacters>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
		}
	}
	public static class ReactorInAnyZoneConfigSetup
	{
		public static List<ReactorCustomZone> CustomReactors;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				CustomReactors = JsonSerializer.Deserialize<List<ReactorCustomZone>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				CustomReactors = new List<ReactorCustomZone>();
				CustomReactors.Add(new ReactorCustomZone());
				string contents = JsonSerializer.Serialize(CustomReactors, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomGearConfigSetup
	{
		public static List<PublicGearModifier> GearInfos;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				GearInfos = JsonSerializer.Deserialize<List<PublicGearModifier>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				GearInfos = new List<PublicGearModifier>();
				GearInfos.Add(new PublicGearModifier());
				string contents = JsonSerializer.Serialize(GearInfos, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomSpawnCapSetup
	{
		public static List<CustomEnemySpawnCap> SpawnCapInfo;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				SpawnCapInfo = JsonSerializer.Deserialize<List<CustomEnemySpawnCap>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				SpawnCapInfo = new List<CustomEnemySpawnCap>();
				SpawnCapInfo.Add(new CustomEnemySpawnCap());
				string contents = JsonSerializer.Serialize(SpawnCapInfo, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomSpawnPointSetup
	{
		public static List<CharacterSpawnPointMain> CharacterSpawnInfos;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				CharacterSpawnInfos = JsonSerializer.Deserialize<List<CharacterSpawnPointMain>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				CharacterSpawnInfos = new List<CharacterSpawnPointMain>();
				CharacterSpawnInfos.Add(new CharacterSpawnPointMain());
				string contents = JsonSerializer.Serialize(CharacterSpawnInfos, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomExtractionSetup
	{
		public static List<ExitSpawnPointOverride> ExtractionPoints;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				ExtractionPoints = JsonSerializer.Deserialize<List<ExitSpawnPointOverride>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				ExtractionPoints = new List<ExitSpawnPointOverride>();
				ExtractionPoints.Add(new ExitSpawnPointOverride());
				string contents = JsonSerializer.Serialize(ExtractionPoints, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class TokenConfigSetup
	{
		public static List<TriggersTokensMain> TokenInfos;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				TokenInfos = JsonSerializer.Deserialize<List<TriggersTokensMain>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
			else
			{
				TokenInfos = new List<TriggersTokensMain>();
				TokenInfos.Add(new TriggersTokensMain());
				string contents = JsonSerializer.Serialize(TokenInfos, new JsonSerializerOptions
				{
					IncludeFields = true,
					WriteIndented = true,
					AllowTrailingCommas = true,
					ReadCommentHandling = JsonCommentHandling.Skip
				});
				File.WriteAllText(path, contents);
				PluginSetup.logSource.LogWarning((object)(name + " Has Been Created Successfully!"));
			}
		}
	}
	public static class CustomPouncerDataSetup
	{
		public static List<PouncerConfigData> PouncerInfos;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				PouncerInfos = JsonSerializer.Deserialize<List<PouncerConfigData>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
		}
	}
	public static class GetBackToElevatorConfigSetup
	{
		public static List<BackToElevatorMainConfig> ElevatorInfos;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				ElevatorInfos = JsonSerializer.Deserialize<List<BackToElevatorMainConfig>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
		}
	}
	public static class OxygenEnvironmentSetup
	{
		public static List<OxygenConfigMain> OxygenSettings;

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


		public static void Load()
		{
			string path = Path.Combine(ConfigManager.CustomPath, "ExtraSettings", name);
			if (File.Exists(path))
			{
				OxygenSettings = JsonSerializer.Deserialize<List<OxygenConfigMain>>(File.ReadAllText(path), new JsonSerializerOptions
				{
					ReadCommentHandling = JsonCommentHandling.Skip,
					PropertyNameCaseInsensitive = true,
					IncludeFields = true
				});
				PluginSetup.logSource.LogDebug((object)(name + " Has Loaded Successfully!"));
			}
		}
	}
	public static class StartGame_Awake_Postfix
	{
		public static Dictionary<string, Shader> ShaderDictionary = new Dictionary<string, Shader>();

		public static Dictionary<uint, PouncerDataContainer> PouncerDataDictionary = new Dictionary<uint, PouncerDataContainer>();

		public static void FindPouncerData()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			foreach (EnemyDataBlock allBlock in GameDataBlockBase<EnemyDataBlock>.GetAllBlocks())
			{
				if (CustomPouncerDataSetup.PouncerInfos.Count <= 0)
				{
					continue;
				}
				foreach (PouncerConfigData pouncerInfo in CustomPouncerDataSetup.PouncerInfos)
				{
					if (pouncerInfo.EnemyId == ((GameDataBlockBase<EnemyDataBlock>)(object)allBlock).persistentID && pouncerInfo.internalEnabled && !PouncerDataDictionary.ContainsKey(pouncerInfo.EnemyId))
					{
						PouncerDataContainer val = ((Il2CppObjectBase)ScriptableObject.CreateInstance(typeof(PouncerDataContainer).ToString())).TryCast<PouncerDataContainer>();
						((Object)val).name = $"{((GameDataBlockBase<EnemyDataBlock>)(object)allBlock).name}_{pouncerInfo.EnemyId}";
						val.m_DashCooldown = new Vector2(pouncerInfo.PouncerData.DashCoolDown.Min, pouncerInfo.PouncerData.DashCoolDown.Max);
						val.DashMaxTime = pouncerInfo.PouncerData.DashMaxTime;
						val.ChargeDuration = pouncerInfo.PouncerData.ChargeDuration;
						val.ConsumeDuration = pouncerInfo.PouncerData.ConsumeDuration;
						val.DashEndPhaseDistance = 6f;
						val.DashEndAnimationLength = 1f;
						val.ChargeStaggerDamageThreshold = pouncerInfo.PouncerData.ChargeStaggerDamageThreshold;
						val.DashStaggerDamageThreshold = pouncerInfo.PouncerData.DashStaggerDamageThreshold;
						val.StaggerDuration = pouncerInfo.PouncerData.StaggerDuration;
						val.FaceToTargetDuringProwlingDistance = 16.5f;
						val.StaggerLeadsToAfterHeld = true;
						val.EnableOffMeshLinkDash = false;
						val.LOSRequiredForDash = pouncerInfo.PouncerData.LOSRequiredForDash;
						val.DashStaggerUsesHeavyHitreaction = true;
						val.Enable1PConsumeVFX = true;
						val.Enable3PConsumeVFX = true;
						DamageShapeData damageShapeData = default(DamageShapeData);
						damageShapeData.Radius = 6.6f;
						damageShapeData.Angle = 210.1f;
						val.DamageShapeData = damageShapeData;
						PouncerSoundData pouncerSoundData = default(PouncerSoundData);
						pouncerSoundData.AttackCharge = 2040824805u;
						pouncerSoundData.AttackHit = 1034385728u;
						pouncerSoundData.AttackMiss = 1149851817u;
						pouncerSoundData.DashStart = 3726964003u;
						pouncerSoundData.HeldIdle = 376939216u;
						pouncerSoundData.HeldSpitOut = 2870456237u;
						pouncerSoundData.IdleGrowl = 3799706438u;
						pouncerSoundData.TentacleLoop = 3217748688u;
						val.PouncerSoundData = pouncerSoundData;
						MovementModificationData dashMovementModifier = val.DashMovementModifier;
						dashMovementModifier.SpeedModifier = pouncerInfo.PouncerData.DashMovementModifier.SpeedModifier;
						dashMovementModifier.AccelerationModifier = pouncerInfo.PouncerData.DashMovementModifier.AccelerationModifier;
						val.DashMovementModifier = dashMovementModifier;
						HeldPathingData combatStatePathingData = val.CombatStatePathingData;
						combatStatePathingData.RecursiveReachableNodeSearch = true;
						combatStatePathingData.DstChangeRate = pouncerInfo.PouncerData.CombatPathing.DistanceChangeRate;
						combatStatePathingData.TryToKeepDistance = pouncerInfo.PouncerData.CombatPathing.TryToKeepDistance;
						combatStatePathingData.MovementModifier.AccelerationModifier = pouncerInfo.PouncerData.CombatPathing.SpeedModificationData.AccelerationModifier;
						combatStatePathingData.MovementModifier.SpeedModifier = pouncerInfo.PouncerData.CombatPathing.SpeedModificationData.SpeedModifier;
						val.CombatStatePathingData = combatStatePathingData;
						HeldStateData heldStateData = val.HeldStateData;
						heldStateData.ValidatePlayerDimension = true;
						heldStateData.PathingData.RecursiveReachableNodeSearch = true;
						heldStateData.AfterHeldRunAwayDuration = pouncerInfo.PouncerData.HeldData.AfterHeldRunAwayDuration;
						heldStateData.DamageOnStartHolding = pouncerInfo.PouncerData.HeldData.DamageOnStartHolding;
						heldStateData.DamageToPlayerPerSecond = pouncerInfo.PouncerData.HeldData.DamageToPlayerPerSecond;
						heldStateData.HeldStartAnimationDuration = pouncerInfo.PouncerData.HeldData.HeldStartAnimationDuration;
						heldStateData.MaxHeldDuration = pouncerInfo.PouncerData.HeldData.MaxHeldDuration;
						heldStateData.SpitOutStateDuration = pouncerInfo.PouncerData.HeldData.SpitOutStateDuration;
						heldStateData.PathingData.DstChangeRate = pouncerInfo.PouncerData.HeldData.PathingData.DistanceChangeRate;
						heldStateData.PathingData.TryToKeepDistance = pouncerInfo.PouncerData.HeldData.PathingData.TryToKeepDistance;
						heldStateData.PathingData.MovementModifier.AccelerationModifier = pouncerInfo.PouncerData.HeldData.PathingData.SpeedModificationData.AccelerationModifier;
						heldStateData.PathingData.MovementModifier.SpeedModifier = pouncerInfo.PouncerData.HeldData.PathingData.SpeedModificationData.SpeedModifier;
						val.HeldStateData = heldStateData;
						PouncerDataDictionary.Add(pouncerInfo.EnemyId, val);
						PluginSetup.logSource.LogDebug((object)$"Creating a data container for custom pouncer ID {pouncerInfo.EnemyId}");
					}
				}
			}
		}

		public static void AttachShadersToObject()
		{
			//IL_0bcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < CustomPrefabsConfigSetup.CustomPrefabInfo.Count; i++)
			{
				if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].ShaderPathsForDictionary.Count > 0)
				{
					foreach (ShaderDictionaryFind item in CustomPrefabsConfigSetup.CustomPrefabInfo[i].ShaderPathsForDictionary)
					{
						ShaderDictionary.Add(item.KeyWord, Shader.Find(item.ShaderPath));
						PluginSetup.logSource.LogDebug((object)("Adding Shader: " + item.ShaderPath + " With keyword: " + item.KeyWord));
					}
				}
				if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart.Count <= 0)
				{
					continue;
				}
				for (int j = 0; j < CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart.Count; j++)
				{
					GameObject val = ((Il2CppObjectBase)AssetAPI.GetLoadedAsset(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].PrefabPath)).TryCast<GameObject>();
					val.layer = CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].LayerType;
					if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].AutomateShaders)
					{
						foreach (Renderer componentsInChild in val.GetComponentsInChildren<Renderer>())
						{
							foreach (Material item2 in (Il2CppArrayBase<Material>)(object)componentsInChild.materials)
							{
								if (!CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].NamesToExludeFromAutomation.Contains(((Object)item2.shader).name))
								{
									item2.shader = Shader.Find(((Object)item2.shader).name);
									PluginSetup.logSource.LogDebug((object)("Adding shader with name: " + ((Object)item2.shader).name + " to " + ((Object)((Component)componentsInChild).gameObject).name));
								}
							}
						}
					}
					if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo.Count > 0)
					{
						for (int k = 0; k < CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo.Count; k++)
						{
							ShaderDictionary.TryGetValue(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ShaderName, out var value);
							if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ApplyToAll)
							{
								foreach (Renderer componentsInChild2 in ((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).GetComponentsInChildren<Renderer>())
								{
									if (!CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].NamesToExlude.Contains(((Object)((Component)componentsInChild2).gameObject).name))
									{
										((Il2CppArrayBase<Material>)(object)componentsInChild2.materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex].shader = value;
										PluginSetup.logSource.LogDebug((object)("Adding shader with name: " + ((Object)value).name + " to " + ((Object)((Component)componentsInChild2).gameObject).name));
									}
									else
									{
										PluginSetup.logSource.LogDebug((object)("Detecting that the object is excluded! Object Name: " + ((Object)((Component)componentsInChild2).gameObject).name));
									}
								}
							}
							else if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].UsingMeshRenderer)
							{
								((Il2CppArrayBase<Material>)(object)((Renderer)((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).gameObject.GetComponent<MeshRenderer>()).materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex].shader = value;
								PluginSetup.logSource.LogDebug((object)("Adding shader with name: " + ((Object)value).name + " To Child: " + CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath + " Attached to CreatedPrefab: " + ((Object)val).name));
							}
							if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].PropertyEdits.Count <= 0)
							{
								continue;
							}
							foreach (ShaderPropertiesEdit propertyEdit in CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].PropertyEdits)
							{
								if (propertyEdit.IsColor && ((Il2CppArrayBase<Material>)(object)((Renderer)((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).gameObject.GetComponent<MeshRenderer>()).materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex].HasProperty(propertyEdit.PropertyToEdit))
								{
									((Il2CppArrayBase<Material>)(object)((Renderer)((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).gameObject.GetComponent<MeshRenderer>()).materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex].SetColor(propertyEdit.PropertyToEdit, propertyEdit.ColorValue);
									PluginSetup.logSource.LogDebug((object)("Overriding color property: " + propertyEdit.PropertyToEdit));
								}
								if (propertyEdit.IsFloat && ((Il2CppArrayBase<Material>)(object)((Renderer)((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).gameObject.GetComponent<MeshRenderer>()).materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex].HasProperty(propertyEdit.PropertyToEdit))
								{
									((Il2CppArrayBase<Material>)(object)((Renderer)((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).gameObject.GetComponent<MeshRenderer>()).materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex].SetFloat(propertyEdit.PropertyToEdit, propertyEdit.FloatValue);
									PluginSetup.logSource.LogDebug((object)("Overriding float property: " + propertyEdit.PropertyToEdit));
								}
								if (propertyEdit.IsBool && ((Il2CppArrayBase<Material>)(object)((Renderer)((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).gameObject.GetComponent<MeshRenderer>()).materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex].HasProperty(propertyEdit.PropertyToEdit))
								{
									MaterialExtensions.SetKeywordEnabled(((Il2CppArrayBase<Material>)(object)((Renderer)((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].ChildPath)).gameObject.GetComponent<MeshRenderer>()).materials)[CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].ShaderInfo[k].MaterialIndex], propertyEdit.PropertyToEdit, propertyEdit.BoolValue);
									PluginSetup.logSource.LogDebug((object)("Overriding bool property: " + propertyEdit.PropertyToEdit));
								}
							}
						}
					}
					if (!CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].isGeomorph)
					{
						continue;
					}
					if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].AddGeomorphComponent)
					{
						LG_Geomorph val2 = val.AddComponent<LG_Geomorph>();
						val2.m_geoPrefab = val;
						val2.m_goShapeType = (LG_GeomorphShapeType)0;
						val2.m_plugs = new List<LG_Plug>();
						val2.m_prefabSpawners = new Il2CppReferenceArray<LG_PrefabSpawner>(0L);
						val2.m_areas = new Il2CppReferenceArray<LG_Area>(0L);
						val2.m_randomSelectors = new Il2CppReferenceArray<LG_RandomSelectorBase>(0L);
						PluginSetup.logSource.LogWarning((object)("Attaching geomorph and geomorphnodevolume to GameObject: " + ((Object)val).name));
					}
					for (int l = 0; l < CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas.Count; l++)
					{
						GameObject gameObject = ((Component)val.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].ChildPathForArea)).gameObject;
						if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].AddAreaComponent)
						{
							gameObject.gameObject.AddComponent<LG_Area>();
						}
						((Component)gameObject.gameObject.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].AIGraphSourcePath)).gameObject.AddComponent<LG_AreaAIGraphSource>();
						if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].GatePaths.Length != 0)
						{
							for (int m = 0; m < CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].GatePaths.Length; m++)
							{
								LG_Plug val3 = ((Component)gameObject.gameObject.transform.FindChild(CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].GatePaths[m])).gameObject.AddComponent<LG_Plug>();
								((LG_ZoneExpander)val3).m_subComplex = CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].SubComplexTypeForGates;
								PluginSetup.logSource.LogWarning((object)("Adding gate to ChildPath: " + CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].GatePaths[m]));
							}
						}
						if (CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].Markers.Count <= 0)
						{
							continue;
						}
						foreach (MarkerInfo marker in CustomPrefabsConfigSetup.CustomPrefabInfo[i].OnGameStart[j].Areas[l].Markers)
						{
							switch (marker.MarkerType)
							{
							case 1:
							{
								MiningRefineryMarkerProducer val6 = ((Component)gameObject.gameObject.transform.FindChild(marker.MarkerPath)).gameObject.AddComponent<MiningRefineryMarkerProducer>();
								val6.m_markerDataBlockID = marker.MarkerPersistentID;
								PluginSetup.logSource.LogWarning((object)"Adding MiningRefineryMarker");
								break;
							}
							case 2:
							{
								TechDataCenterMarkerProducer val5 = ((Component)gameObject.gameObject.transform.FindChild(marker.MarkerPath)).gameObject.AddComponent<TechDataCenterMarkerProducer>();
								val5.m_markerDataBlockID = marker.MarkerPersistentID;
								PluginSetup.logSource.LogWarning((object)"Adding TechDataCenterMarker");
								break;
							}
							case 3:
							{
								ServiceFloodwaysMarkerProducer val4 = ((Component)gameObject.gameObject.transform.FindChild(marker.MarkerPath)).gameObject.AddComponent<ServiceFloodwaysMarkerProducer>();
								val4.m_markerDataBlockID = marker.MarkerPersistentID;
								PluginSetup.logSource.LogWarning((object)"Adding ServiceFloodwaysMarker");
								break;
							}
							}
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(StartMainGame), "Awake")]
		public static void Postfix()
		{
			AssetAPI.OnAssetBundlesLoaded += delegate
			{
				AttachShadersToObject();
			};
			AssetShardManager.OnEnemyAssetsLoaded += Action.op_Implicit((Action)delegate
			{
				FindPouncerData();
			});
			Harmony.CreateAndPatchAll(typeof(LG_SecurityDoor_Locks_SetupForChainedPuzzle_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_DimensionPortal_Setup_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(Builder_BuildDone_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_WardenObjective_OnBuildDone_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_WardenObjective_Reactor_Update_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_PowerGenerator_Core_Setup_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_PowerGenerator_Core_SyncStatusChanged_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(ES_Dead_CommonEnter_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(PlayerAgent_Update_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(ChainedPuzzleInstance_SetupMovement_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(Builder_Build_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(EnemyAgent_Setup_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(ResetManager), (string)null);
			Harmony.CreateAndPatchAll(typeof(CP_BasicMovable_UpdateMovementRoutine_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(CP_PlayerScanner_StopScan_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(GS_InLevel_Enter_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(GameStateManager_Update_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_ComputerTerminalCommandInterpreter_ReceiveCommand_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(BulletWeapon_UnWield_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(BulletWeapon_Update_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(MWS_Charge_Exit_Postifx), (string)null);
			Harmony.CreateAndPatchAll(typeof(MWS_Charge_Enter_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(ElevatorShaftLanding_OnBuildDone_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(OnCheckPointSavedManager), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_PopulateFunctionMarkersInZoneJob_TriggerFunctionBuilder_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_Distribute_WardenObjective_Build_Prefix), (string)null);
			Harmony.CreateAndPatchAll(typeof(BioGearSetup), (string)null);
			Harmony.CreateAndPatchAll(typeof(BulletWeapon_UpdateAmmoStatus_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(BulletWeapon_Fire_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(Snet_SessionHub_OnJoin_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(Snet_SessionHub_OnLeave_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(LG_WardenObjective_Reactor_Start_Postfix), (string)null);
			Harmony.CreateAndPatchAll(typeof(PlayerAgent_Setup_Postfix), (string)null);
			Harmony.Cr

Plugins/System Error/GTFlow.Core.dll

Decompiled 3 months ago
using System;
using System.CodeDom.Compiler;
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.Text;
using AssetShards;
using BepInEx;
using BepInEx.IL2CPP;
using BepInEx.Logging;
using GTFlow.Core.Managers;
using GTFlow.Core.Utilities;
using HarmonyLib;
using Il2CppSystem;
using UnhollowerBaseLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("GTFlow.Core")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("GTFlow.Core")]
[assembly: AssemblyTitle("GTFlow.Core")]
[assembly: AssemblyVersion("0.0.1.0")]
namespace GTFlow
{
	[GeneratedCode("GTFlow.VersionInfo", "0.1")]
	[CompilerGenerated]
	public static class VersionInfo
	{
		public const string Version = "0.0.1";

		public const uint GameRevision = 21989u;
	}
}
namespace GTFlow.Utilities
{
	public static class FileUtils
	{
		public static bool TryReadAllText(string path, out string text, out Exception exception)
		{
			try
			{
				text = File.ReadAllText(path);
				exception = null;
				return true;
			}
			catch (Exception ex)
			{
				exception = ex;
				text = null;
				return false;
			}
		}
	}
}
namespace GTFlow.Core
{
	[BepInPlugin("com.lorttexwolf.GTFlow", "GTFlow", "0.0.1")]
	public class Entry : BasePlugin
	{
		public const string MODNAME = "GTFlow";

		public const string AUTHOR = "lorttexwolf";

		public const string GUID = "com.lorttexwolf.GTFlow";

		public const string VERSION = "0.0.1";

		public static ManualLogSource Log { get; private set; }

		public static uint GameRevision { get; private set; }

		public override void Load()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			if ((GameRevision = GetGameRevision()) != 21989)
			{
				Log.LogWarning((object)$"Game revision {GameRevision} does not match target revision {21989u}! Things may break!");
			}
			Harmony val = new Harmony("com.lorttexwolf.GTFlow");
			val.PatchAll(Assembly.GetExecutingAssembly());
			AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)OnStartupAssetsLoaded);
		}

		private void OnStartupAssetsLoaded()
		{
			Log.LogDebug((object)"Startup assets loaded!");
			if (Directory.Exists(Paths.AssetBundles))
			{
				Log.LogDebug((object)"Found AssetBundles Folder!");
				string[] files = Directory.GetFiles(Paths.AssetBundles);
				string[] array = files;
				foreach (string text in array)
				{
					if (!AssetBundleUtils.TryLoadFromFile(text, out var bundle))
					{
						Log.LogError((object)("Failed loading AssetBundle at " + text));
					}
					else
					{
						Log.LogDebug((object)("Loaded " + bundle.ToString()));
					}
				}
			}
			if (Directory.Exists(Paths.SoundBanks))
			{
				Log.LogDebug((object)"Found SoundBanks Folder!");
				SoundBankUtils.LoadBanksInDir(Paths.SoundBanks);
			}
		}

		private static uint GetGameRevision()
		{
			if (!File.Exists(Paths.GameRevision))
			{
				return 0u;
			}
			string s = File.ReadAllText(Paths.GameRevision);
			if (!uint.TryParse(s, out var result))
			{
				return 0u;
			}
			return result;
		}
	}
	public static class Paths
	{
		public static string GTFlow = Path.Combine(Paths.ConfigPath, "GTFlow");

		public static string AssetBundles = Path.Combine(GTFlow, "AssetBundles");

		public static string SoundBanks = Path.Combine(GTFlow, "SoundBanks");

		public static string GameRevision = Path.Combine(Paths.GameRootPath, "revision.txt");
	}
}
namespace GTFlow.Core.Utilities
{
	public static class AssetBundleUtils
	{
		public static string ToString(this AssetBundle bundle)
		{
			string[] array = Il2CppArrayBase<string>.op_Implicit((Il2CppArrayBase<string>)(object)bundle.AllAssetNames());
			StringBuilder stringBuilder = new StringBuilder($"AssetBundle {((Object)bundle).name}[{array.Length}]");
			int i = 0;
			for (int num = array.Length; i < num; i++)
			{
				stringBuilder.Append(Environment.NewLine + "| " + array[i]);
			}
			return stringBuilder.ToString();
		}

		public static bool TryLoadFromFile(string path, out AssetBundle bundle)
		{
			return (Object)(object)(bundle = AssetBundle.LoadFromFile(path)) != (Object)null;
		}

		public static bool TryLoadAsset(this AssetBundle bundle, string fullName, out Object asset)
		{
			return (asset = bundle.LoadAsset(fullName)) != (Object)null;
		}
	}
	public static class Il2CppObjectUtils
	{
		public static bool TryCast<T>(this Object obj, out T castedObject) where T : Object
		{
			try
			{
				castedObject = ((Il2CppObjectBase)obj).Cast<T>();
				return true;
			}
			catch (Exception)
			{
				castedObject = default(T);
				return false;
			}
		}
	}
	public static class MethodInfoUtils
	{
		public static string ToString(this MethodInfo methodInfo)
		{
			StringBuilder stringBuilder = new StringBuilder("| " + methodInfo.ReturnType.FullName + " " + methodInfo.Name);
			if (methodInfo.ContainsGenericParameters)
			{
				stringBuilder.Append('<');
				Type[] genericArguments = methodInfo.GetGenericArguments();
				Type[] array = genericArguments;
				foreach (Type type in array)
				{
					stringBuilder.Append(type.Name + ",");
				}
				stringBuilder.Append('>');
			}
			ParameterInfo[] parameters = methodInfo.GetParameters();
			if (parameters.Length != 0)
			{
				stringBuilder.Append('(');
				ParameterInfo[] array2 = parameters;
				foreach (ParameterInfo parameterInfo in array2)
				{
					stringBuilder.Append(parameterInfo.ParameterType.FullName ?? "");
					if (parameterInfo.IsOptional)
					{
						stringBuilder.Append('?');
					}
					stringBuilder.Append(" " + parameterInfo.Name + ", ");
				}
				stringBuilder.Append(")");
			}
			return stringBuilder.ToString();
		}
	}
	public static class SoundBankUtils
	{
		public static void LoadBanksInDir(string dirPath)
		{
			string[] array = FindBanksInDir(dirPath);
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (!LoadFromFile(text, out var _))
				{
					Entry.Log.LogError((object)("Failed to load SoundBank " + text));
				}
			}
		}

		public static string[] FindBanksInDir(string dirPath)
		{
			return Directory.GetFiles(dirPath, "*.bnk");
		}

		public static bool LoadFromFile(string path, out uint bankId)
		{
			bankId = 0u;
			if (!File.Exists(path))
			{
				return false;
			}
			byte[] bytes = File.ReadAllBytes(path);
			return LoadFromBytes(bytes, out bankId);
		}

		public static bool LoadFromBytes(byte[] bytes, out uint bankId)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			bankId = 0u;
			if (!GetMemoryPtr(bytes, out var ptr, out var size))
			{
				return false;
			}
			return (int)AkSoundEngine.LoadBank(ptr, size, ref bankId) == 1;
		}

		public static bool GetMemoryPtr(byte[] bytes, out IntPtr ptr, out uint size)
		{
			try
			{
				size = 0u;
				GCHandle gCHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
				IntPtr intPtr = gCHandle.AddrOfPinnedObject();
				size = (uint)bytes.Length;
				if ((intPtr.ToInt64() & 0xF) != 0)
				{
					byte[] array = new byte[(long)bytes.Length + 16L];
					GCHandle gCHandle2 = GCHandle.Alloc(array, GCHandleType.Pinned);
					IntPtr intPtr2 = gCHandle2.AddrOfPinnedObject();
					int destinationIndex = 0;
					if ((intPtr2.ToInt64() & 0xF) != 0)
					{
						long num = (intPtr2.ToInt64() + 15) & -16;
						destinationIndex = (int)(num - intPtr2.ToInt64());
						intPtr2 = new IntPtr(num);
					}
					Array.Copy(bytes, 0, array, destinationIndex, bytes.Length);
					intPtr = intPtr2;
					gCHandle.Free();
					gCHandle = gCHandle2;
				}
				ptr = intPtr;
				return true;
			}
			catch (Exception)
			{
				size = 0u;
				ptr = default(IntPtr);
				return false;
			}
		}
	}
}
namespace GTFlow.Core.Patches
{
	[HarmonyPatch(typeof(AssetShardManager))]
	internal static class Patch_AssetShardManager
	{
		[HarmonyPatch("Setup")]
		[HarmonyPostfix]
		internal static void SetupPostfix()
		{
			if (!Directory.Exists(Paths.AssetBundles))
			{
				return;
			}
			string[] files = Directory.GetFiles(Paths.AssetBundles);
			string[] array = files;
			foreach (string path in array)
			{
				if (!AssetBundleUtils.TryLoadFromFile(path, out var bundle))
				{
					Entry.Log.LogError((object)("Failed to load AssetBundle " + Path.GetFileNameWithoutExtension(path) + "!"));
					continue;
				}
				Entry.Log.LogDebug((object)bundle.ToString());
				CustomAssetManager.LoadAssetsFromBundle(bundle);
			}
		}
	}
	[HarmonyPatch(typeof(Resources))]
	internal static class Patch_Resources
	{
		[HarmonyPatch("Load", new Type[]
		{
			typeof(string),
			typeof(Type)
		})]
		internal static bool LoadPrefix(ref Object __result, string path, Type systemTypeInstance)
		{
			if (!CustomAssetManager.TryGetAsset(path, out var asset))
			{
				return true;
			}
			Entry.Log.LogMessage((object)("Replaced " + path + " with custom asset"));
			__result = asset;
			return false;
		}
	}
}
namespace GTFlow.Core.Managers
{
	public static class CustomAssetManager
	{
		private static readonly Dictionary<string, Object> Assets = new Dictionary<string, Object>();

		public static string[] AssetNames => Assets.Keys.ToArray();

		public static bool AddAsset(string fullName, Object asset)
		{
			if (Assets.TryAdd(fullName?.ToLower(), asset))
			{
				AssetShardManager.s_loadedAssetsLookup.TryAdd(fullName?.ToUpper(), asset);
				Entry.Log.LogDebug((object)("Added custom asset " + fullName?.ToLower()));
				return true;
			}
			return false;
		}

		public static Object GetAsset(string fullName)
		{
			if (Assets.TryGetValue(fullName.ToLower(), out var value))
			{
				return value;
			}
			return null;
		}

		public static T GetAsset<T>(string fullName) where T : Object
		{
			if (!TryGetAsset(fullName, out var asset) || !((Object)(object)asset).TryCast<T>(out T castedObject))
			{
				return default(T);
			}
			return castedObject;
		}

		public static IEnumerable<string> AssetUnion(IEnumerable<string> names)
		{
			return names.Union(AssetNames).ToArray();
		}

		public static bool TryGetAsset(string fullName, out Object asset)
		{
			return Assets.TryGetValue(fullName.ToLower(), out asset);
		}

		public static bool TryGetAsset<T>(string fullName, out T asset) where T : Object
		{
			return TryGetAsset(fullName, out asset) || !((Object)(object)asset).TryCast<T>(out asset);
		}

		public static bool HasAsset(string fullName)
		{
			return Assets.ContainsKey(fullName?.ToLower());
		}

		public static void LoadAssetsFromBundle(AssetBundle bundle)
		{
			Il2CppStringArray allAssetNames = bundle.GetAllAssetNames();
			int i = 0;
			for (int count = ((Il2CppArrayBase<string>)(object)allAssetNames).Count; i < count; i++)
			{
				string text = ((Il2CppArrayBase<string>)(object)allAssetNames)[i];
				Object asset;
				if (HasAsset(text))
				{
					Entry.Log.LogError((object)("Skipped asset " + text + " since it already exists!"));
				}
				else if (!bundle.TryLoadAsset(text, out asset))
				{
					Entry.Log.LogError((object)$"Failed to load asset {text} {bundle}");
				}
				else if (!AddAsset(text, asset))
				{
					Entry.Log.LogError((object)$"Failed to load asset {text} {bundle} ???");
				}
			}
		}
	}
}

Plugins/System Error/SystemErrorDimPatch.dll

Decompiled 3 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using AK;
using Agents;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using GameData;
using HarmonyLib;
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("SystemErrorDimPatch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SystemErrorDimPatch")]
[assembly: AssemblyTitle("SystemErrorDimPatch")]
[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 SystemErrorDimPatch
{
	[BepInPlugin("SystemErrorDimPatch", "SystemErrorDimPatch", "0.0.2")]
	public class Plugin : BasePlugin
	{
		[HarmonyPatch]
		private class SniperPatches
		{
			public static pActiveExpedition expdata;

			public static bool shouldrun;

			[HarmonyPrefix]
			[HarmonyPatch(typeof(AIG_GeomorphNodeVolume), "TryGetGeomorphVolume")]
			public static bool Prefix(AIG_GeomorphNodeVolume __instance, int floorNR, eDimensionIndex dimensionIndex, Vector3 pos)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Invalid comparison between Unknown and I4
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Invalid comparison between Unknown and I4
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Invalid comparison between Unknown and I4
				//IL_005e: 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)
				//IL_006f: Invalid comparison between Unknown and I4
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Invalid comparison between Unknown and I4
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				if ((int)GameStateManager.CurrentStateName != 10)
				{
					return true;
				}
				if (expdata == null)
				{
					expdata = RundownManager.GetActiveExpeditionData();
					if ((int)expdata.tier == 4 && expdata.expeditionIndex == 0)
					{
						shouldrun = true;
					}
				}
				if (!shouldrun)
				{
					return true;
				}
				if ((int)dimensionIndex == 0)
				{
					return true;
				}
				if (((int)dimensionIndex == 1 || (int)dimensionIndex == 2) && (pos.x < -32f || pos.x > 32f))
				{
					return false;
				}
				if ((int)dimensionIndex == 1 && pos.z > 75f)
				{
					return false;
				}
				if ((int)dimensionIndex == 2 && pos.z > 218f)
				{
					return false;
				}
				return true;
			}

			[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "AttemptInteract", new Type[] { typeof(pReactorInteraction) })]
			[HarmonyPrefix]
			public static void StatePrefix(LG_WardenObjective_Reactor __instance, pReactorInteraction interaction)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Invalid comparison between Unknown and I4
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Invalid comparison between Unknown and I4
				//IL_0045: 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_004c: Invalid comparison between Unknown and I4
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: 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_00ba: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Expected O, but got Unknown
				if (expdata == null)
				{
					expdata = RundownManager.GetActiveExpeditionData();
				}
				if ((int)expdata.tier == 4 && expdata.expeditionIndex == 0 && (int)__instance.OriginLayer == 1 && __instance.m_currentWaveCount != 10 && (int)interaction.type == 4 && __instance.m_currentWaveCount < 10)
				{
					Debug.Log(Object.op_Implicit("SystemErrorDimpatch - level ends."));
					__instance.m_sound.Post(EVENTS.STICKYMINEEXPLODE, true);
					__instance.m_sound.Post(EVENTS.REACTOR_ALARM_WARNING_3, true);
					__instance.m_sound.Post(EVENTS.SCOUT_DEATH_SCREAM, true);
					WorldEventManager.ExecuteEvent(new WardenObjectiveEventData
					{
						Type = (eWardenObjectiveEventType)6,
						FogSetting = 205u,
						FogTransitionDuration = 1f,
						DimensionIndex = (eDimensionIndex)0,
						Layer = (LG_LayerType)0
					}, 0f);
					if (SNet.IsMaster)
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(alldie()), (Action)null);
					}
				}
			}

			private static IEnumerator alldie()
			{
				yield return (object)new WaitForSeconds(1f);
				Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
				while (enumerator.MoveNext())
				{
					PlayerAgent current = enumerator.Current;
					((Dam_SyncedDamageBase)current.Damage).BulletDamage(((Dam_SyncedDamageBase)current.Damage).DamageMax, (Agent)null, Vector3.zero, Vector3.zero, Vector3.zero, false, 1f, 1f, 0u);
				}
			}
		}

		public override void Load()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("bonk").PatchAll();
			Debug.Log(Object.op_Implicit("SystemErrorDimPatch - i am alive mwahahahahah"));
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "SystemErrorDimPatch";

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

Plugins/System Error/UpdatedRundownProgression.dll

Decompiled 3 months 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
	}
}