Decompiled source of LocalProgression v1.3.7

plugins/Inas07.LocalProgression.dll

Decompiled 2 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.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BoosterImplants;
using CellMenu;
using DropServer;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using LocalProgression.Component;
using LocalProgression.Data;
using Localization;
using MTFO.API;
using Microsoft.CodeAnalysis;
using SNetwork;
using TMPro;
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("Inas07.LocalProgression")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ab8c78f9ff6b5b5d947a46310ee1438e1340cc16")]
[assembly: AssemblyProduct("Inas07.LocalProgression")]
[assembly: AssemblyTitle("Inas07.LocalProgression")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LocalProgression
{
	internal static class Assets
	{
		internal static GameObject NoBoosterIcon { get; private set; }

		internal static void Init()
		{
			NoBoosterIcon = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/CM_ExpeditionSectorIcon.prefab");
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Inas.LocalProgression", "LocalProgression", "1.3.7")]
	public class EntryPoint : BasePlugin
	{
		private Harmony m_Harmony;

		public override void Load()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			m_Harmony = new Harmony("LocalProgression");
			m_Harmony.PatchAll();
			EventAPI.OnManagersSetup += LocalProgressionManager.Current.Init;
			AssetAPI.OnAssetBundlesLoaded += Assets.Init;
		}
	}
	internal static class JSON
	{
		private static JsonSerializerOptions _setting;

		public static T Deserialize<T>(string json)
		{
			return JsonSerializer.Deserialize<T>(json, _setting);
		}

		public static string Serialize<T>(T value)
		{
			return JsonSerializer.Serialize(value, _setting);
		}

		static JSON()
		{
			_setting = new JsonSerializerOptions
			{
				ReadCommentHandling = JsonCommentHandling.Skip,
				IncludeFields = false,
				PropertyNameCaseInsensitive = true,
				WriteIndented = true,
				IgnoreReadOnlyProperties = true
			};
			_setting.Converters.Add(new JsonStringEnumConverter());
		}
	}
	public class LocalProgressionManager
	{
		public const string CONFIG_FILE_NAME = "ProgressionConfig.json";

		public static readonly LocalProgressionManager Current;

		private CM_PageRundown_New rundownPage;

		public static readonly string DirPath;

		public string LP_CONFIG_DIR => Path.Combine(MTFOPathAPI.CustomPath, "LocalProgressionConfig");

		public string CONFIG_PATH => Path.Combine(LP_CONFIG_DIR, "ProgressionConfig.json");

		public RundownProgressonConfig RundownProgressonConfig { get; private set; } = new RundownProgressonConfig();


		private RundownProgressionData CurrentRundownPData { get; } = new RundownProgressionData();


		internal RundownProgData nativeProgData { get; private set; }

		internal void SetCurrentRundownPageInstance(CM_PageRundown_New __instance)
		{
			rundownPage = __instance;
		}

		private void UpdateRundownPageExpeditionIconProgression()
		{
			//IL_0066: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)rundownPage == (Object)null)
			{
				return;
			}
			uint rundownID = CurrentRundownPData.RundownID;
			if (rundownID == 0)
			{
				LPLogger.Warning("UpdateRundownPageExpeditionIconProgression: rundown_id == 0!");
				return;
			}
			RundownDataBlock block = GameDataBlockBase<RundownDataBlock>.GetBlock(rundownID);
			LPLogger.Log($"CM_PageRundown_New.UpdateRundownExpeditionProgression, overwrite with LocalProgression Data, RundownID {CurrentRundownPData.RundownID}");
			nativeProgData = ComputeLocalProgressionDataToRundownProgData();
			if ((Object)(object)rundownPage.m_tierMarker1 != (Object)null)
			{
				rundownPage.m_tierMarker1.SetProgression(nativeProgData, new RundownTierProgressionData());
				if (rundownPage.m_expIconsTier1 != null)
				{
					UpdateTierIconsWithProgression(rundownPage.m_expIconsTier1, rundownPage.m_tierMarker1, thisTierUnlocked: true);
				}
			}
			if ((Object)(object)rundownPage.m_tierMarker2 != (Object)null)
			{
				rundownPage.m_tierMarker2.SetProgression(nativeProgData, block.ReqToReachTierB);
				if (rundownPage.m_expIconsTier2 != null)
				{
					UpdateTierIconsWithProgression(rundownPage.m_expIconsTier2, rundownPage.m_tierMarker2, nativeProgData.tierBUnlocked && block.UseTierUnlockRequirements);
				}
			}
			if ((Object)(object)rundownPage.m_tierMarker3 != (Object)null)
			{
				rundownPage.m_tierMarker3.SetProgression(nativeProgData, block.ReqToReachTierC);
				if (rundownPage.m_expIconsTier3 != null)
				{
					UpdateTierIconsWithProgression(rundownPage.m_expIconsTier3, rundownPage.m_tierMarker3, nativeProgData.tierCUnlocked && block.UseTierUnlockRequirements);
				}
			}
			if ((Object)(object)rundownPage.m_tierMarker4 != (Object)null)
			{
				rundownPage.m_tierMarker4.SetProgression(nativeProgData, block.ReqToReachTierD);
				if (rundownPage.m_expIconsTier4 != null)
				{
					UpdateTierIconsWithProgression(rundownPage.m_expIconsTier4, rundownPage.m_tierMarker4, nativeProgData.tierDUnlocked && block.UseTierUnlockRequirements);
				}
			}
			if ((Object)(object)rundownPage.m_tierMarker5 != (Object)null)
			{
				rundownPage.m_tierMarker5.SetProgression(nativeProgData, block.ReqToReachTierE);
				if (rundownPage.m_expIconsTier5 != null)
				{
					UpdateTierIconsWithProgression(rundownPage.m_expIconsTier5, rundownPage.m_tierMarker5, nativeProgData.tierEUnlocked && block.UseTierUnlockRequirements);
				}
			}
			if (!((Object)(object)rundownPage.m_tierMarkerSectorSummary != (Object)null))
			{
				return;
			}
			rundownPage.m_tierMarkerSectorSummary.SetSectorIconTextForMain($"<color=orange>[{nativeProgData.clearedMain}/{nativeProgData.totalMain}]</color>", "#FFFFFFCC");
			rundownPage.m_tierMarkerSectorSummary.SetSectorIconTextForSecondary($"<color=orange>[{nativeProgData.clearedSecondary}/{nativeProgData.totalSecondary}]</color>", "#CCCCCCCC");
			rundownPage.m_tierMarkerSectorSummary.SetSectorIconTextForThird($"<color=orange>[{nativeProgData.clearedThird}/{nativeProgData.totalThird}]</color>", "#CCCCCCCC");
			rundownPage.m_tierMarkerSectorSummary.SetSectorIconTextForAllCleared($"<color=orange>[{nativeProgData.clearedAllClear}/{nativeProgData.totalAllClear}]</color>", "#CCCCCCCC");
			RundownTierMarker_NoBoosterIcon component = ((Component)rundownPage.m_tierMarkerSectorSummary).GetComponent<RundownTierMarker_NoBoosterIcon>();
			if (!((Object)(object)component != (Object)null) || !TryGetRundownConfig(rundownID, out var rundownConf))
			{
				return;
			}
			int value = rundownConf.ComputeNoBoosterClearPossibleCount();
			if (rundownConf.EnableNoBoosterUsedProgressionForRundown && (rundownConf.AlwaysShowIcon || CurrentRundownPData.NoBoosterAllClearCount > 0))
			{
				if (rundownConf.EnableNoBoosterUsedProgressionForRundown)
				{
					value = nativeProgData.totalMain;
				}
				component.SetVisible(visible: true);
				component.SetSectorIconText($"<color=orange>[{CurrentRundownPData.NoBoosterAllClearCount}/{value}]</color>");
			}
			else
			{
				component.SetVisible(visible: false);
			}
		}

		private void UpdateTierIconsWithProgression(List<CM_ExpeditionIcon_New> tierIcons, CM_RundownTierMarker tierMarker, bool thisTierUnlocked)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if (tierIcons == null || tierIcons.Count == 0)
			{
				if (tierMarker != null)
				{
					tierMarker.SetVisible(false, 0f);
				}
				return;
			}
			for (int i = 0; i < tierIcons.Count; i++)
			{
				CM_ExpeditionIcon_New val = tierIcons[i];
				string rundownProgressionExpeditionKey = RundownManager.GetRundownProgressionExpeditionKey(tierIcons[i].Tier, tierIcons[i].ExpIndex);
				ExpeditionProgressionData value;
				bool flag = CurrentRundownPData.LPData.TryGetValue(rundownProgressionExpeditionKey, out value);
				string text = "0";
				string text2 = (RundownManager.HasSecondaryLayer(tierIcons[i].DataBlock) ? "0" : "-");
				string text3 = (RundownManager.HasThirdLayer(tierIcons[i].DataBlock) ? "0" : "-");
				string text4 = (RundownManager.HasAllCompletetionPossibility(tierIcons[i].DataBlock) ? "0" : "-");
				if (flag)
				{
					if (value.MainCompletionCount > 0)
					{
						text = value.MainCompletionCount.ToString();
					}
					if (value.SecondaryCompletionCount > 0)
					{
						text2 = value.SecondaryCompletionCount.ToString();
					}
					if (value.ThirdCompletionCount > 0)
					{
						text3 = value.ThirdCompletionCount.ToString();
					}
					if (value.AllClearCount > 0)
					{
						text4 = value.AllClearCount.ToString();
					}
				}
				if (CheckExpeditionUnlocked(val.DataBlock, val.Tier))
				{
					if (flag)
					{
						rundownPage.SetIconStatus(val, (eExpeditionIconStatus)4, text, text2, text3, text4, 1f, false, (eExpeditionAccessibility)0);
					}
					else
					{
						rundownPage.SetIconStatus(val, (eExpeditionIconStatus)2, "-", "-", "-", "-", 1f, false, (eExpeditionAccessibility)0);
					}
				}
				else if (flag)
				{
					rundownPage.SetIconStatus(val, (eExpeditionIconStatus)1, text, text2, text3, text4, 1f, false, (eExpeditionAccessibility)0);
				}
				else if (val.DataBlock.HideOnLocked)
				{
					((RectTransformComp)val).SetVisible(false);
				}
				else
				{
					rundownPage.SetIconStatus(val, (eExpeditionIconStatus)0, "-", "-", "-", "-", 1f, false, (eExpeditionAccessibility)0);
				}
			}
			if (thisTierUnlocked)
			{
				if (tierMarker != null)
				{
					tierMarker.SetStatus((eRundownTierMarkerStatus)1);
				}
			}
			else if (tierMarker != null)
			{
				tierMarker.SetStatus((eRundownTierMarkerStatus)0);
			}
		}

		private RundownProgData ComputeLocalProgressionDataToRundownProgData()
		{
			//IL_0002: 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_00e5: 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)
			RundownProgData progressionData = default(RundownProgData);
			if (CurrentRundownPData.RundownID == 0)
			{
				LPLogger.Error("ComputeLocalProgressionDataToRundownProgData: rundown_id == 0...");
				return progressionData;
			}
			RundownDataBlock block = GameDataBlockBase<RundownDataBlock>.GetBlock(CurrentRundownPData.RundownID);
			if (block == null)
			{
				LPLogger.Error($"ComputeLocalProgressionDataToRundownProgData: cannot get rundown datablock with rundown_id: {CurrentRundownPData.RundownID}");
				return progressionData;
			}
			progressionData.clearedMain = CurrentRundownPData.MainClearCount;
			progressionData.clearedSecondary = CurrentRundownPData.SecondaryClearCount;
			progressionData.clearedThird = CurrentRundownPData.ThirdClearCount;
			progressionData.clearedAllClear = CurrentRundownPData.AllClearCount;
			AccumulateTierClearance(block, (eRundownTier)1, ref progressionData);
			AccumulateTierClearance(block, (eRundownTier)2, ref progressionData);
			AccumulateTierClearance(block, (eRundownTier)3, ref progressionData);
			AccumulateTierClearance(block, (eRundownTier)4, ref progressionData);
			AccumulateTierClearance(block, (eRundownTier)5, ref progressionData);
			return progressionData;
		}

		private void AccumulateTierClearance(RundownDataBlock rundownDB, eRundownTier tier, ref RundownProgData progressionData)
		{
			//IL_0007: 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_0023: Expected I4, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			List<ExpeditionInTierData> val = rundownDB.TierA;
			switch (tier - 1)
			{
			case 1:
				val = rundownDB.TierB;
				break;
			case 2:
				val = rundownDB.TierC;
				break;
			case 3:
				val = rundownDB.TierD;
				break;
			case 4:
				val = rundownDB.TierE;
				break;
			default:
				LPLogger.Error($"Unsupported eRundownTier {tier}");
				return;
			case 0:
				break;
			}
			int num = 0;
			Enumerator<ExpeditionInTierData> enumerator = val.GetEnumerator();
			while (enumerator.MoveNext())
			{
				ExpeditionInTierData current = enumerator.Current;
				if (current.Enabled && (!current.HideOnLocked || CheckExpeditionUnlocked(current, tier)))
				{
					progressionData.totalMain++;
					if (RundownManager.HasSecondaryLayer(current))
					{
						progressionData.totalSecondary++;
					}
					if (RundownManager.HasThirdLayer(current))
					{
						progressionData.totalThird++;
					}
					if (RundownManager.HasAllCompletetionPossibility(current))
					{
						progressionData.totalAllClear++;
					}
					if (current.Descriptive.IsExtraExpedition)
					{
						progressionData.totatlExtra++;
					}
					string uniqueExpeditionKey = RundownManager.GetUniqueExpeditionKey(rundownDB, tier, num);
					if (CurrentRundownPData.LPData.ContainsKey(uniqueExpeditionKey))
					{
						progressionData.clearedExtra++;
					}
					num++;
				}
			}
		}

		private bool CheckTierUnlocked(eRundownTier tier)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected I4, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			RundownDataBlock block = GameDataBlockBase<RundownDataBlock>.GetBlock(CurrentRundownPData.RundownID);
			RundownTierProgressionData val = null;
			switch (tier - 1)
			{
			case 0:
				return true;
			case 1:
				val = block.ReqToReachTierB;
				break;
			case 2:
				val = block.ReqToReachTierC;
				break;
			case 3:
				val = block.ReqToReachTierD;
				break;
			case 4:
				val = block.ReqToReachTierE;
				break;
			default:
				LPLogger.Error("Unsupporrted tier: {0}", tier);
				return true;
			}
			if (CurrentRundownPData.MainClearCount >= val.MainSectors && CurrentRundownPData.SecondaryClearCount >= val.SecondarySectors && CurrentRundownPData.ThirdClearCount >= val.ThirdSectors)
			{
				return CurrentRundownPData.AllClearCount >= val.AllClearedSectors;
			}
			return false;
		}

		private bool CheckExpeditionUnlocked(ExpeditionInTierData expedition, eRundownTier tier)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected I4, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected I4, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			eExpeditionAccessibility accessibility = expedition.Accessibility;
			switch ((int)accessibility)
			{
			case 1:
			case 3:
				return false;
			case 2:
				return true;
			case 0:
				return CheckTierUnlocked(tier);
			case 4:
			{
				RundownTierProgressionData customProgressionLock = expedition.CustomProgressionLock;
				if (CurrentRundownPData.MainClearCount >= customProgressionLock.MainSectors && CurrentRundownPData.SecondaryClearCount >= customProgressionLock.SecondarySectors && CurrentRundownPData.ThirdClearCount >= customProgressionLock.ThirdSectors)
				{
					return CurrentRundownPData.AllClearCount >= customProgressionLock.AllClearedSectors;
				}
				return false;
			}
			case 5:
			{
				ExpeditionIndex unlockedByExpedition = expedition.UnlockedByExpedition;
				string rundownProgressionExpeditionKey = RundownManager.GetRundownProgressionExpeditionKey(unlockedByExpedition.Tier, (int)unlockedByExpedition.Exp);
				return CurrentRundownPData.LPData.ContainsKey(rundownProgressionExpeditionKey);
			}
			default:
				LPLogger.Warning("Unsupported eExpeditionAccessibility: {0}", expedition.Accessibility);
				return true;
			}
		}

		private void SetNativeRundownProgression()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, Expedition> expeditions = RundownManager.RundownProgression.Expeditions;
			if (expeditions.Count > 0)
			{
				LPLogger.Warning($"Non-empty native rundown progression data! RundownID: {CurrentRundownPData.RundownID}");
				expeditions.Clear();
			}
			Dictionary<string, ExpeditionProgressionData> lPData = CurrentRundownPData.LPData;
			Layer val2 = default(Layer);
			Layer val3 = default(Layer);
			Layer val4 = default(Layer);
			foreach (string key in lPData.Keys)
			{
				Expedition val = new Expedition();
				ExpeditionProgressionData expeditionProgressionData = lPData[key];
				val.AllLayerCompletionCount = expeditionProgressionData.AllClearCount;
				val.Layers = new LayerSet<Layer>();
				val2.CompletionCount = expeditionProgressionData.MainCompletionCount;
				val2.State = (LayerProgressionState)((expeditionProgressionData.MainCompletionCount > 0) ? 3 : 0);
				val3.CompletionCount = expeditionProgressionData.SecondaryCompletionCount;
				val3.State = (LayerProgressionState)((expeditionProgressionData.SecondaryCompletionCount > 0) ? 3 : 0);
				val4.CompletionCount = expeditionProgressionData.ThirdCompletionCount;
				val4.State = (LayerProgressionState)((expeditionProgressionData.ThirdCompletionCount > 0) ? 3 : 0);
				val.Layers.SetLayer((ExpeditionLayers)0, val2);
				val.Layers.SetLayer((ExpeditionLayers)1, val3);
				val.Layers.SetLayer((ExpeditionLayers)2, val4);
				LPLogger.Warning($"{val2.CompletionCount}, {val3.CompletionCount}, {val4.CompletionCount}");
				expeditions[key] = val;
			}
		}

		private void InitConfig()
		{
			if (!Directory.Exists(LP_CONFIG_DIR))
			{
				Directory.CreateDirectory(LP_CONFIG_DIR);
			}
			if (!File.Exists(CONFIG_PATH))
			{
				StreamWriter streamWriter = File.CreateText(CONFIG_PATH);
				streamWriter.WriteLine(JSON.Serialize(new RundownProgressonConfig()));
				streamWriter.Flush();
				streamWriter.Close();
				RundownProgressonConfig = new RundownProgressonConfig();
			}
			ReloadConfig();
			RundownManager.OnRundownProgressionUpdated += Action.op_Implicit((Action)ReloadConfig);
		}

		private void ReloadConfig()
		{
			try
			{
				RundownProgressonConfig = JSON.Deserialize<RundownProgressonConfig>(File.ReadAllText(CONFIG_PATH));
			}
			catch
			{
				LPLogger.Error("Cannot reload RundownProgressonConfig, probably the file is invalid");
				RundownProgressonConfig = new RundownProgressonConfig();
			}
		}

		public bool TryGetRundownConfig(uint RundownID, out RundownConfig rundownConf)
		{
			rundownConf = RundownProgressonConfig.Configs.Find((RundownConfig rundownConf) => rundownConf.RundownID == RundownID);
			return rundownConf != null;
		}

		public bool TryGetExpeditionConfig(uint RundownID, eRundownTier tier, int expIndex, out ExpeditionProgressionConfig expConf)
		{
			//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)
			expConf = null;
			if (TryGetRundownConfig(RundownID, out var rundownConf))
			{
				expConf = rundownConf.Expeditions.Find((ExpeditionProgressionConfig e) => e.Tier == tier && e.ExpeditionIndex == expIndex);
			}
			return expConf != null;
		}

		public void RecordExpeditionSuccessForCurrentRundown(string expeditionKey, bool mainLayerCleared, bool secondaryLayerCleared, bool thirdLayerCleared, bool clearedWithNoBooster)
		{
			if (RundownManager.ActiveExpedition.ExcludeFromProgression)
			{
				return;
			}
			UpdateLPDataToActiveRundown();
			bool flag = mainLayerCleared && secondaryLayerCleared && thirdLayerCleared;
			Dictionary<string, ExpeditionProgressionData> lPData = CurrentRundownPData.LPData;
			if (!lPData.ContainsKey(expeditionKey))
			{
				lPData[expeditionKey] = new ExpeditionProgressionData
				{
					ExpeditionKey = expeditionKey,
					MainCompletionCount = (mainLayerCleared ? 1 : 0),
					SecondaryCompletionCount = (secondaryLayerCleared ? 1 : 0),
					ThirdCompletionCount = (thirdLayerCleared ? 1 : 0),
					AllClearCount = (flag ? 1 : 0),
					NoBoosterAllClearCount = (clearedWithNoBooster ? 1 : 0)
				};
				CurrentRundownPData.MainClearCount += (mainLayerCleared ? 1 : 0);
				CurrentRundownPData.SecondaryClearCount += (secondaryLayerCleared ? 1 : 0);
				CurrentRundownPData.ThirdClearCount += (thirdLayerCleared ? 1 : 0);
				CurrentRundownPData.AllClearCount += (flag ? 1 : 0);
				CurrentRundownPData.NoBoosterAllClearCount += (clearedWithNoBooster ? 1 : 0);
			}
			else
			{
				ExpeditionProgressionData expeditionProgressionData = lPData[expeditionKey];
				if (expeditionProgressionData.MainCompletionCount == 0 && mainLayerCleared)
				{
					CurrentRundownPData.MainClearCount++;
				}
				if (expeditionProgressionData.SecondaryCompletionCount == 0 && secondaryLayerCleared)
				{
					CurrentRundownPData.SecondaryClearCount++;
				}
				if (expeditionProgressionData.ThirdCompletionCount == 0 && thirdLayerCleared)
				{
					CurrentRundownPData.ThirdClearCount++;
				}
				if (expeditionProgressionData.AllClearCount == 0 && flag)
				{
					CurrentRundownPData.AllClearCount++;
				}
				if (expeditionProgressionData.NoBoosterAllClearCount == 0 && clearedWithNoBooster)
				{
					CurrentRundownPData.NoBoosterAllClearCount++;
				}
				expeditionProgressionData.MainCompletionCount += (mainLayerCleared ? 1 : 0);
				expeditionProgressionData.SecondaryCompletionCount += (secondaryLayerCleared ? 1 : 0);
				expeditionProgressionData.ThirdCompletionCount += (thirdLayerCleared ? 1 : 0);
				expeditionProgressionData.AllClearCount += (flag ? 1 : 0);
				expeditionProgressionData.NoBoosterAllClearCount += (clearedWithNoBooster ? 1 : 0);
			}
			SaveRundownLPDataToDisk();
		}

		public void UpdateLPDataToActiveRundown()
		{
			uint num = ActiveRundownID();
			if (num == 0)
			{
				LPLogger.Debug("UpdateLPDataToActiveRundown: cannot find any active rundown!");
				return;
			}
			LPLogger.Warning($"Update LPData to rundown_id: {num}");
			CurrentRundownPData.Reset();
			RundownDataBlock block = GameDataBlockBase<RundownDataBlock>.GetBlock(num);
			if (block == null)
			{
				LPLogger.Error($"Didn't find Rundown Datablock with rundown id {num}");
				return;
			}
			Dictionary<string, ExpeditionProgressionData> dictionary = ReadRundownLPData(((GameDataBlockBase<RundownDataBlock>)(object)block).name);
			CurrentRundownPData.RundownID = num;
			CurrentRundownPData.RundownName = ((GameDataBlockBase<RundownDataBlock>)(object)block).name;
			CurrentRundownPData.LPData = dictionary;
			foreach (ExpeditionProgressionData value in dictionary.Values)
			{
				CurrentRundownPData.MainClearCount += ((value.MainCompletionCount > 0) ? 1 : 0);
				CurrentRundownPData.SecondaryClearCount += ((value.SecondaryCompletionCount > 0) ? 1 : 0);
				CurrentRundownPData.ThirdClearCount += ((value.ThirdCompletionCount > 0) ? 1 : 0);
				CurrentRundownPData.AllClearCount += ((value.AllClearCount > 0) ? 1 : 0);
				CurrentRundownPData.NoBoosterAllClearCount += ((value.NoBoosterAllClearCount > 0) ? 1 : 0);
			}
		}

		internal void Init()
		{
			if (!Directory.Exists(DirPath))
			{
				Directory.CreateDirectory(DirPath);
			}
			RundownManager.OnRundownProgressionUpdated += Action.op_Implicit((Action)OnNativeRundownProgressionUpdated);
			InitConfig();
		}

		internal void OnNativeRundownProgressionUpdated()
		{
			UpdateLPDataToActiveRundown();
			if (!((Object)(object)rundownPage == (Object)null) && ((CM_PageBase)rundownPage).m_isActive)
			{
				UpdateRundownPageExpeditionIconProgression();
			}
		}

		public bool AllSectorCompletedWithoutBoosterAndCheckpoint()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			if (RundownManager.HasSecondaryLayer(RundownManager.ActiveExpedition) && (int)WardenObjectiveManager.CurrentState.second_status != 40)
			{
				return false;
			}
			if (RundownManager.HasThirdLayer(RundownManager.ActiveExpedition) && (int)WardenObjectiveManager.CurrentState.third_status != 40)
			{
				return false;
			}
			bool flag = CheckpointManager.CheckpointUsage == 0;
			if (flag)
			{
				foreach (PlayerBoosterImplantState item in (Il2CppArrayBase<PlayerBoosterImplantState>)(object)BoosterImplantManager.Current.m_boosterPlayers)
				{
					if (item == null)
					{
						continue;
					}
					foreach (pBoosterImplantData item2 in (Il2CppArrayBase<pBoosterImplantData>)(object)item.BoosterImplantDatas)
					{
						if (item2.BoosterImplantID != 0)
						{
							flag = false;
							break;
						}
					}
				}
			}
			return flag;
		}

		public uint ActiveRundownID()
		{
			uint num = default(uint);
			if (!RundownManager.TryGetIdFromLocalRundownKey(RundownManager.ActiveRundownKey, ref num) || num == 0)
			{
				return 0u;
			}
			return num;
		}

		public string ExpeditionKey(eRundownTier tier, int expIndex)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return RundownManager.GetRundownProgressionExpeditionKey(tier, expIndex);
		}

		public ExpeditionProgressionData GetExpeditionLP(uint RundownID, eRundownTier tier, int expIndex)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			ExpeditionProgressionData result = new ExpeditionProgressionData
			{
				ExpeditionKey = ExpeditionKey(tier, expIndex)
			};
			Dictionary<string, ExpeditionProgressionData> dictionary;
			if (CurrentRundownPData.RundownID != RundownID)
			{
				RundownDataBlock block = GameDataBlockBase<RundownDataBlock>.GetBlock(RundownID);
				if (block == null)
				{
					LPLogger.Error($"Didn't find Rundown Datablock with rundown id {RundownID}");
					return result;
				}
				dictionary = ReadRundownLPData(((GameDataBlockBase<RundownDataBlock>)(object)block).name);
			}
			else
			{
				dictionary = CurrentRundownPData.LPData;
			}
			string key = ExpeditionKey(tier, expIndex);
			if (dictionary.TryGetValue(key, out var value))
			{
				return value;
			}
			return result;
		}

		static LocalProgressionManager()
		{
			Current = new LocalProgressionManager();
			DirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "GTFO-Modding", "LocalProgression");
		}

		private LocalProgressionManager()
		{
		}

		private static string RundownLPDataPath(string rundownName)
		{
			char[] invalidPathChars = Path.GetInvalidPathChars();
			foreach (char oldChar in invalidPathChars)
			{
				rundownName = rundownName.Replace(oldChar, '_');
			}
			return Path.Combine(DirPath, rundownName);
		}

		private static string NBSClearDataPath(string rundownName)
		{
			return RundownLPDataPath(rundownName) + " - NBSClear";
		}

		private bool TryReadAggregatedFormatData(string datapath, out Dictionary<string, ExpeditionProgressionData> dataDict)
		{
			dataDict = new Dictionary<string, ExpeditionProgressionData>();
			bool result = true;
			FileStream fileStream = null;
			BinaryReader binaryReader = null;
			try
			{
				fileStream = File.Open(datapath, FileMode.Open);
				binaryReader = new BinaryReader(fileStream, Encoding.UTF8, leaveOpen: false);
				int num = binaryReader.ReadInt32();
				for (int i = 0; i < num; i++)
				{
					ExpeditionProgressionData expeditionProgressionData = new ExpeditionProgressionData();
					expeditionProgressionData.ExpeditionKey = binaryReader.ReadString();
					expeditionProgressionData.MainCompletionCount = binaryReader.ReadInt32();
					expeditionProgressionData.SecondaryCompletionCount = binaryReader.ReadInt32();
					expeditionProgressionData.ThirdCompletionCount = binaryReader.ReadInt32();
					expeditionProgressionData.AllClearCount = binaryReader.ReadInt32();
					expeditionProgressionData.NoBoosterAllClearCount = binaryReader.ReadInt32();
					dataDict[expeditionProgressionData.ExpeditionKey] = expeditionProgressionData;
				}
			}
			catch (EndOfStreamException)
			{
				dataDict.Clear();
				result = false;
			}
			finally
			{
				binaryReader?.Close();
				fileStream?.Close();
			}
			return result;
		}

		private bool TryReadOldFormatData(string datapath, out Dictionary<string, ExpeditionProgressionData> dataDict)
		{
			dataDict = new Dictionary<string, ExpeditionProgressionData>();
			bool result = true;
			FileStream fileStream = null;
			BinaryReader binaryReader = null;
			if (!File.Exists(datapath))
			{
				return true;
			}
			try
			{
				fileStream = File.Open(datapath, FileMode.Open);
				binaryReader = new BinaryReader(fileStream, Encoding.UTF8, leaveOpen: false);
				int num = binaryReader.ReadInt32();
				for (int i = 0; i < num; i++)
				{
					ExpeditionProgressionData expeditionProgressionData = new ExpeditionProgressionData();
					expeditionProgressionData.ExpeditionKey = binaryReader.ReadString();
					expeditionProgressionData.MainCompletionCount = binaryReader.ReadInt32();
					expeditionProgressionData.SecondaryCompletionCount = binaryReader.ReadInt32();
					expeditionProgressionData.ThirdCompletionCount = binaryReader.ReadInt32();
					expeditionProgressionData.AllClearCount = binaryReader.ReadInt32();
					dataDict[expeditionProgressionData.ExpeditionKey] = expeditionProgressionData;
				}
			}
			catch (EndOfStreamException)
			{
				dataDict.Clear();
				result = false;
			}
			finally
			{
				binaryReader?.Close();
				fileStream?.Close();
			}
			return result;
		}

		private bool TryReadNBSClearData(string datapath, out Dictionary<string, ExpeditionProgressionData> dataDict)
		{
			dataDict = new Dictionary<string, ExpeditionProgressionData>();
			bool result = true;
			FileStream fileStream = null;
			BinaryReader binaryReader = null;
			if (!File.Exists(datapath))
			{
				return true;
			}
			try
			{
				fileStream = File.Open(datapath, FileMode.Open);
				binaryReader = new BinaryReader(fileStream, Encoding.UTF8, leaveOpen: false);
				int num = binaryReader.ReadInt32();
				for (int i = 0; i < num; i++)
				{
					ExpeditionProgressionData expeditionProgressionData = new ExpeditionProgressionData();
					expeditionProgressionData.ExpeditionKey = binaryReader.ReadString();
					expeditionProgressionData.NoBoosterAllClearCount = binaryReader.ReadInt32();
					dataDict[expeditionProgressionData.ExpeditionKey] = expeditionProgressionData;
				}
			}
			catch (EndOfStreamException)
			{
				dataDict.Clear();
				result = false;
			}
			finally
			{
				binaryReader?.Close();
				fileStream?.Close();
			}
			return result;
		}

		private void WriteOldFormatDataToDisk(string filepath, Dictionary<string, ExpeditionProgressionData> dataDict)
		{
			using FileStream output = File.Open(filepath, FileMode.Create);
			using BinaryWriter binaryWriter = new BinaryWriter(output, Encoding.UTF8, leaveOpen: false);
			binaryWriter.Write(dataDict.Count);
			foreach (string key in dataDict.Keys)
			{
				ExpeditionProgressionData expeditionProgressionData = dataDict[key];
				binaryWriter.Write(key);
				binaryWriter.Write(expeditionProgressionData.MainCompletionCount);
				binaryWriter.Write(expeditionProgressionData.SecondaryCompletionCount);
				binaryWriter.Write(expeditionProgressionData.ThirdCompletionCount);
				binaryWriter.Write(expeditionProgressionData.AllClearCount);
			}
		}

		private void WriteNBSClearDataToDisk(string filepath, Dictionary<string, ExpeditionProgressionData> dataDict)
		{
			using FileStream output = File.Open(filepath, FileMode.Create);
			using BinaryWriter binaryWriter = new BinaryWriter(output, Encoding.UTF8, leaveOpen: false);
			binaryWriter.Write(dataDict.Count);
			foreach (string key in dataDict.Keys)
			{
				ExpeditionProgressionData expeditionProgressionData = dataDict[key];
				binaryWriter.Write(key);
				binaryWriter.Write(expeditionProgressionData.NoBoosterAllClearCount);
			}
		}

		private Dictionary<string, ExpeditionProgressionData> ReadRundownLPData(string rundownName)
		{
			string text = RundownLPDataPath(rundownName);
			string text2 = NBSClearDataPath(rundownName);
			Dictionary<string, ExpeditionProgressionData> dataDict = new Dictionary<string, ExpeditionProgressionData>();
			if (File.Exists(text))
			{
				if (TryReadAggregatedFormatData(text, out dataDict))
				{
					LPLogger.Warning(rundownName + " - aggregated format");
					WriteOldFormatDataToDisk(text, dataDict);
					WriteNBSClearDataToDisk(text2, dataDict);
					LPLogger.Warning("wrote old format and nbs data");
				}
				else if (TryReadOldFormatData(text, out dataDict))
				{
					LPLogger.Warning(rundownName + " - old format");
					if (TryReadNBSClearData(text2, out var dataDict2))
					{
						foreach (string key in dataDict.Keys)
						{
							dataDict[key].NoBoosterAllClearCount = (dataDict2.TryGetValue(key, out var value) ? value.NoBoosterAllClearCount : 0);
						}
					}
				}
				else
				{
					LPLogger.Error("Something went wrong with localprogression data, contact the plugin developer...");
				}
			}
			return dataDict;
		}

		internal RundownProgressionData GetLPDataForCurrentRundown()
		{
			return CurrentRundownPData;
		}

		private void SaveRundownLPDataToDisk()
		{
			string rundownName = CurrentRundownPData.RundownName;
			Dictionary<string, ExpeditionProgressionData> lPData = CurrentRundownPData.LPData;
			string text = RundownLPDataPath(rundownName);
			string filepath = NBSClearDataPath(rundownName);
			LPLogger.Warning($"SaveData: saving {CurrentRundownPData.RundownName} LPData to '{text}'");
			WriteOldFormatDataToDisk(text, lPData);
			WriteNBSClearDataToDisk(filepath, lPData);
		}
	}
	internal static class LPLogger
	{
		private static ManualLogSource logger = Logger.CreateLogSource("LocalProgression");

		public static void Log(string format, params object[] args)
		{
			Log(string.Format(format, args));
		}

		public static void Log(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)8, (object)str);
			}
		}

		public static void Warning(string format, params object[] args)
		{
			Warning(string.Format(format, args));
		}

		public static void Warning(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)4, (object)str);
			}
		}

		public static void Error(string format, params object[] args)
		{
			Error(string.Format(format, args));
		}

		public static void Error(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)2, (object)str);
			}
		}

		public static void Debug(string format, params object[] args)
		{
			Debug(string.Format(format, args));
		}

		public static void Debug(string str)
		{
			if (logger != null)
			{
				logger.Log((LogLevel)32, (object)str);
			}
		}
	}
	public static class Utils
	{
		public static bool TryGetComponent<T>(this GameObject obj, out T comp)
		{
			comp = obj.GetComponent<T>();
			return comp != null;
		}
	}
}
namespace LocalProgression.Patches
{
	[HarmonyPatch]
	internal static class Patches_CM_ExpeditionWindow
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_ExpeditionWindow), "Setup")]
		private static void Post_Setup(CM_ExpeditionWindow __instance)
		{
			ExpeditionWindow_NoBoosterIcon expeditionWindow_NoBoosterIcon = ((Component)__instance).gameObject.AddComponent<ExpeditionWindow_NoBoosterIcon>();
			expeditionWindow_NoBoosterIcon.m_window = __instance;
			expeditionWindow_NoBoosterIcon.InitialSetup();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_ExpeditionWindow), "SetExpeditionInfo")]
		private static void Post_SetExpeditionInfo(CM_ExpeditionWindow __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			ExpeditionWindow_NoBoosterIcon component = ((Component)__instance).gameObject.GetComponent<ExpeditionWindow_NoBoosterIcon>();
			if (!((Object)(object)component == (Object)null))
			{
				float num = 0f;
				float num2 = 410f;
				((RectTransformComp)__instance.m_sectorIconMain).SetPosition(new Vector2(num, 0f));
				num += num2;
				if (RundownManager.HasSecondaryLayer(__instance.m_data))
				{
					num += num2;
				}
				if (RundownManager.HasThirdLayer(__instance.m_data))
				{
					num += num2;
				}
				ExpeditionProgressionData expeditionLP = LocalProgressionManager.Current.GetExpeditionLP(LocalProgressionManager.Current.ActiveRundownID(), __instance.m_tier, __instance.m_expIndex);
				if (RundownManager.HasAllCompletetionPossibility(__instance.m_data) && expeditionLP.AllClearCount > 0)
				{
					num += num2;
				}
				component.SetIconPosition(new Vector2(num, 0f));
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CM_ExpeditionWindow), "SetVisible")]
		private static bool Pre_SetVisible(CM_ExpeditionWindow __instance, bool visible, bool inMenuBar)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Invalid comparison between Unknown and I4
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Invalid comparison between Unknown and I4
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			ExpeditionWindow_NoBoosterIcon component = ((Component)__instance).GetComponent<ExpeditionWindow_NoBoosterIcon>();
			if (!visible)
			{
				return true;
			}
			if (__instance.m_data == null)
			{
				return true;
			}
			uint rundownID = LocalProgressionManager.Current.ActiveRundownID();
			ExpeditionProgressionData expeditionLP = LocalProgressionManager.Current.GetExpeditionLP(rundownID, __instance.m_tier, __instance.m_expIndex);
			((Component)__instance).gameObject.SetActive(visible);
			((RectTransformComp)__instance.m_joinWindow).SetVisible(!inMenuBar && !SNet.IsInLobby);
			((RectTransformComp)__instance.m_hostButton).SetVisible(!inMenuBar && !SNet.IsInLobby && (int)__instance.m_status != 0 && (int)__instance.m_status != 5 && (int)__instance.m_status != 1);
			((RectTransformComp)__instance.m_changeExpeditionButton).SetVisible(SNet.IsMaster && !((RectTransformComp)__instance.m_hostButton).IsVisible && !inMenuBar && SNet.IsInLobby && RundownManager.ActiveExpedition != null && (int)__instance.m_status != 0 && (int)__instance.m_status != 5 && (int)__instance.m_status != 1);
			__instance.m_bottomStripes.SetActive(!((RectTransformComp)__instance.m_hostButton).IsVisible && !((RectTransformComp)__instance.m_changeExpeditionButton).IsVisible);
			((Component)__instance.m_title).gameObject.SetActive(false);
			((Component)__instance.m_wardenObjective).gameObject.SetActive(false);
			((Component)__instance.m_wardenIntel).gameObject.SetActive(false);
			((Component)__instance.m_depthTitle).gameObject.SetActive(false);
			((Component)__instance.m_artifactHeatTitle).gameObject.SetActive(false);
			CoroutineManager.BlinkIn(__instance.m_title, 0.3f, (Transform)null);
			CoroutineManager.BlinkIn(__instance.m_wardenObjective, 1.1f, (Transform)null);
			CoroutineManager.BlinkIn(__instance.m_wardenIntel, 2.5f, (Transform)null);
			CoroutineManager.BlinkIn(__instance.m_depthTitle, 3f, (Transform)null);
			CoroutineManager.BlinkIn(__instance.m_artifactHeatTitle, 3.25f, (Transform)null);
			float num = 1.8f;
			float num2 = 0.4f;
			__instance.m_sectorIconMain.Setup((LG_LayerType)0, __instance.m_root, true, expeditionLP.MainCompletionCount > 0, true, 0.5f, 0.8f);
			((RectTransformComp)__instance.m_sectorIconMain).SetVisible(false);
			((RectTransformComp)__instance.m_sectorIconSecond).SetVisible(false);
			((RectTransformComp)__instance.m_sectorIconThird).SetVisible(false);
			((RectTransformComp)__instance.m_sectorIconAllCompleted).SetVisible(false);
			component.SetVisible(visible: false);
			__instance.m_sectorIconMain.StopBlink();
			__instance.m_sectorIconSecond.StopBlink();
			__instance.m_sectorIconThird.StopBlink();
			__instance.m_sectorIconAllCompleted.StopBlink();
			__instance.m_sectorIconMain.BlinkIn(num);
			num += num2;
			if (RundownManager.HasSecondaryLayer(__instance.m_data))
			{
				__instance.m_sectorIconSecond.Setup((LG_LayerType)1, __instance.m_root, true, expeditionLP.SecondaryCompletionCount > 0, true, 0.5f, 0.8f);
				__instance.m_sectorIconSecond.BlinkIn(num);
				num += num2;
			}
			if (RundownManager.HasThirdLayer(__instance.m_data))
			{
				__instance.m_sectorIconThird.Setup((LG_LayerType)2, __instance.m_root, true, expeditionLP.ThirdCompletionCount > 0, true, 0.5f, 0.8f);
				__instance.m_sectorIconThird.BlinkIn(num);
				num += num2;
			}
			if (expeditionLP.AllClearCount > 0)
			{
				__instance.m_sectorIconAllCompleted.BlinkIn(num);
				num += num2;
			}
			bool flag = expeditionLP.NoBoosterAllClearCount > 0;
			if ((LocalProgressionManager.Current.TryGetRundownConfig(rundownID, out var rundownConf) && rundownConf.EnableNoBoosterUsedProgressionForRundown && (rundownConf.AlwaysShowIcon || flag)) || (LocalProgressionManager.Current.TryGetExpeditionConfig(rundownID, __instance.m_tier, __instance.m_expIndex, out var expConf) && expConf.EnableNoBoosterUsedProgression && (expConf.AlwaysShowIcon || flag)))
			{
				component.SetupNoBoosterUsedIcon(flag);
				component.BlinkIn(num);
			}
			return false;
		}
	}
	[HarmonyPatch]
	internal static class Patches_CM_ExpeditionIcon
	{
		private static readonly Color BORDER_COLOR = new Color(0f, 1f, 82f / 85f, 1f);

		private static readonly Color TEXT_COLOR = new Color(0f, 1f, 0.5882353f, 1f);

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_ExpeditionIcon_New), "UpdateBorderColor")]
		private static void Post_UpdateBorderColor(CM_ExpeditionIcon_New __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0033: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			if ((int)__instance.Status != 5)
			{
				uint rundownID = LocalProgressionManager.Current.ActiveRundownID();
				if (((LocalProgressionManager.Current.TryGetRundownConfig(rundownID, out var rundownConf) && rundownConf.EnableNoBoosterUsedProgressionForRundown) || (LocalProgressionManager.Current.TryGetExpeditionConfig(rundownID, __instance.Tier, __instance.ExpIndex, out var expConf) && expConf.EnableNoBoosterUsedProgression)) && LocalProgressionManager.Current.GetExpeditionLP(rundownID, __instance.Tier, __instance.ExpIndex).NoBoosterAllClearCount > 0)
				{
					__instance.SetBorderColor(BORDER_COLOR);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class Patch_CM_PageExpeditionSuccess
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_PageExpeditionSuccess), "Setup")]
		private static void Post_Setup(CM_PageExpeditionSuccess __instance)
		{
			if ((Object)(object)((Component)__instance).GetComponent<ExpeditionSuccessPage_NoBoosterIcon>() == (Object)null)
			{
				ExpeditionSuccessPage_NoBoosterIcon expeditionSuccessPage_NoBoosterIcon = ((Component)__instance).gameObject.AddComponent<ExpeditionSuccessPage_NoBoosterIcon>();
				expeditionSuccessPage_NoBoosterIcon.m_page = __instance;
				expeditionSuccessPage_NoBoosterIcon.Setup();
			}
		}
	}
	[HarmonyPatch]
	internal class Patches_CM_PageRundown_New
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_PageRundown_New), "Setup")]
		private static void Post_Setup(CM_PageRundown_New __instance)
		{
			LocalProgressionManager.Current.SetCurrentRundownPageInstance(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_PageRundown_New), "PlaceRundown")]
		private static void Post_PlaceRundown(CM_PageRundown_New __instance)
		{
			LocalProgressionManager.Current.OnNativeRundownProgressionUpdated();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_PageRundown_New), "OnEnable")]
		private static void Post_OnEnable(CM_PageRundown_New __instance)
		{
			LocalProgressionManager.Current.OnNativeRundownProgressionUpdated();
		}
	}
	[HarmonyPatch]
	internal class Patches_CM_RundownTierMarker
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CM_RundownTierMarker), "Setup")]
		private static void Post_Setup(CM_RundownTierMarker __instance)
		{
			RundownTierMarker_NoBoosterIcon rundownTierMarker_NoBoosterIcon = ((Component)__instance).gameObject.AddComponent<RundownTierMarker_NoBoosterIcon>();
			rundownTierMarker_NoBoosterIcon.m_tierMarker = __instance;
			rundownTierMarker_NoBoosterIcon.Setup();
		}
	}
	[HarmonyPatch]
	internal class FixEndScreen
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(DiscordManager), "UpdateDiscordDetails")]
		private static bool Pre_UpdateDiscordDetails()
		{
			return false;
		}
	}
	[HarmonyPatch]
	internal class Patches_GS_ExpeditionSuccess
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GS_ExpeditionSuccess), "Enter")]
		private static void DoChangeState(GS_ExpeditionSuccess __instance)
		{
			//IL_000c: 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_0029: Invalid comparison between Unknown and I4
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			pActiveExpedition activeExpeditionData = RundownManager.GetActiveExpeditionData();
			string text = LocalProgressionManager.Current.ExpeditionKey(activeExpeditionData.tier, activeExpeditionData.expeditionIndex);
			bool mainLayerCleared = (int)WardenObjectiveManager.CurrentState.main_status == 40;
			bool secondaryLayerCleared = (int)WardenObjectiveManager.CurrentState.second_status == 40;
			bool thirdLayerCleared = (int)WardenObjectiveManager.CurrentState.third_status == 40;
			bool clearedWithNoBooster = LocalProgressionManager.Current.AllSectorCompletedWithoutBoosterAndCheckpoint();
			LPLogger.Debug("Level cleared, recording - " + text);
			LocalProgressionManager.Current.RecordExpeditionSuccessForCurrentRundown(text, mainLayerCleared, secondaryLayerCleared, thirdLayerCleared, clearedWithNoBooster);
		}
	}
}
namespace LocalProgression.Data
{
	public class ExpeditionProgressionData
	{
		public string ExpeditionKey { get; set; } = string.Empty;


		public int MainCompletionCount { get; set; }

		public int SecondaryCompletionCount { get; set; }

		public int ThirdCompletionCount { get; set; }

		public int AllClearCount { get; set; }

		public int NoBoosterAllClearCount { get; set; }
	}
	public class ExpeditionProgressionConfig
	{
		public eRundownTier Tier { get; set; }

		public int ExpeditionIndex { get; set; }

		public bool EnableNoBoosterUsedProgression { get; set; }

		public bool AlwaysShowIcon { get; set; } = true;

	}
	public class RundownConfig
	{
		public uint RundownID { get; set; }

		public bool EnableNoBoosterUsedProgressionForRundown { get; set; }

		public bool AlwaysShowIcon { get; set; } = true;


		public List<ExpeditionProgressionConfig> Expeditions { get; set; } = new List<ExpeditionProgressionConfig>
		{
			new ExpeditionProgressionConfig()
		};


		internal int ComputeNoBoosterClearPossibleCount()
		{
			if (EnableNoBoosterUsedProgressionForRundown)
			{
				return int.MaxValue;
			}
			return Expeditions.TakeWhile((ExpeditionProgressionConfig conf) => conf.EnableNoBoosterUsedProgression).Count();
		}
	}
	public class RundownProgressonConfig
	{
		public List<RundownConfig> Configs { get; set; } = new List<RundownConfig>
		{
			new RundownConfig()
		};

	}
	public class RundownProgressionData
	{
		public string RundownName { get; set; } = string.Empty;


		public uint RundownID { get; set; }

		public Dictionary<string, ExpeditionProgressionData> LPData { get; set; } = new Dictionary<string, ExpeditionProgressionData>();


		public int MainClearCount { get; set; }

		public int SecondaryClearCount { get; set; }

		public int ThirdClearCount { get; set; }

		public int AllClearCount { get; set; }

		public int NoBoosterAllClearCount { get; set; }

		public void Reset()
		{
			RundownName = string.Empty;
			RundownID = 0u;
			LPData.Clear();
			int num2 = (NoBoosterAllClearCount = 0);
			int num4 = (AllClearCount = num2);
			int num6 = (ThirdClearCount = num4);
			int mainClearCount = (SecondaryClearCount = num6);
			MainClearCount = mainClearCount;
		}
	}
}
namespace LocalProgression.Component
{
	public class ExpeditionSuccessPage_NoBoosterIcon : MonoBehaviour
	{
		internal CM_PageExpeditionSuccess m_page;

		private CM_ExpeditionSectorIcon m_completeWithNoBoosterIcon;

		private SpriteRenderer m_icon;

		private SpriteRenderer m_bg;

		private TextMeshPro m_title;

		private TextMeshPro m_rightSideText;

		private NoBoosterIconGOWrapper Wrapper;

		internal void Setup()
		{
			if ((Object)(object)m_page == (Object)null)
			{
				LPLogger.Error("ExpeditionSuccess_NoBooster: Assign the page instance before setup");
			}
			else
			{
				if ((Object)(object)m_completeWithNoBoosterIcon != (Object)null)
				{
					return;
				}
				if ((Object)(object)Assets.NoBoosterIcon == (Object)null)
				{
					AssetAPI.OnAssetBundlesLoaded += delegate
					{
						LoadAsset();
						AssetAPI.OnAssetBundlesLoaded -= LoadAsset;
					};
				}
				else
				{
					LoadAsset();
				}
			}
		}

		private void LoadAsset()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Assets.NoBoosterIcon == (Object)null)
			{
				LPLogger.Error("ExpeditionSuccess_NoBooster.Setup: cannot instantiate NoBooster icon...");
				return;
			}
			m_completeWithNoBoosterIcon = ((Il2CppObjectBase)((GuiLayer)((CM_PageBase)m_page).m_guiLayer).AddRectComp(Assets.NoBoosterIcon, (GuiAnchor)1, new Vector2(1200f, 0f), m_page.m_sectorIconAlign)).Cast<CM_ExpeditionSectorIcon>();
			Wrapper = new NoBoosterIconGOWrapper(((Component)m_completeWithNoBoosterIcon).gameObject);
			m_bg = Wrapper.BGGO.GetComponent<SpriteRenderer>();
			m_icon = Wrapper.IconGO.GetComponent<SpriteRenderer>();
			m_title = Object.Instantiate<TextMeshPro>(m_page.m_sectorIconMain.m_title);
			m_title.transform.SetParent(Wrapper.ObjectiveIcon.transform, false);
			m_rightSideText = Object.Instantiate<TextMeshPro>(m_page.m_sectorIconMain.m_rightSideText);
			m_rightSideText.transform.SetParent(Wrapper.RightSideText.transform, false);
			m_completeWithNoBoosterIcon.m_title = m_title;
			m_completeWithNoBoosterIcon.m_rightSideText = m_rightSideText;
			((RectTransformComp)m_completeWithNoBoosterIcon).SetVisible(false);
		}

		private void OnEnable()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Invalid comparison between Unknown and I4
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			((RectTransformComp)m_completeWithNoBoosterIcon).SetVisible(false);
			uint rundownID = LocalProgressionManager.Current.ActiveRundownID();
			pActiveExpedition activeExpeditionData = RundownManager.GetActiveExpeditionData();
			if ((LocalProgressionManager.Current.TryGetRundownConfig(rundownID, out var rundownConf) && rundownConf.EnableNoBoosterUsedProgressionForRundown) || (LocalProgressionManager.Current.TryGetExpeditionConfig(rundownID, activeExpeditionData.tier, activeExpeditionData.expeditionIndex, out var expConf) && expConf.EnableNoBoosterUsedProgression))
			{
				bool boosterUnused = LocalProgressionManager.Current.AllSectorCompletedWithoutBoosterAndCheckpoint();
				int num = 1;
				bool flag = RundownManager.HasSecondaryLayer(RundownManager.ActiveExpedition);
				bool flag2 = RundownManager.HasThirdLayer(RundownManager.ActiveExpedition);
				num += (flag ? 1 : 0);
				num += (flag2 ? 1 : 0);
				num += ((flag && (int)WardenObjectiveManager.CurrentState.second_status == 40 && flag2 && (int)WardenObjectiveManager.CurrentState.second_status == 40) ? 1 : 0);
				float num2 = m_page.m_time_sectorIcon + (float)num * 0.7f;
				SetupNoBoosterUsedIcon(boosterUnused);
				((RectTransformComp)m_completeWithNoBoosterIcon).SetPosition(new Vector2((float)num * 400f, 0f));
				m_completeWithNoBoosterIcon.BlinkIn(num2);
			}
		}

		private void SetupNoBoosterUsedIcon(bool boosterUnused)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			CM_ExpeditionSectorIcon completeWithNoBoosterIcon = m_completeWithNoBoosterIcon;
			completeWithNoBoosterIcon.m_isFinishedAll = true;
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconMainSkull, completeWithNoBoosterIcon.m_iconMainBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconSecondarySkull, completeWithNoBoosterIcon.m_iconSecondaryBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconThirdSkull, completeWithNoBoosterIcon.m_iconThirdBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconFinishedAllSkull, completeWithNoBoosterIcon.m_iconFinishedAllBG, false, false, 0.5f, 0.7f);
			Color color = m_icon.color;
			Color color2 = m_bg.color;
			m_icon.color = new Color(color.r, color.g, color.b, boosterUnused ? 1f : 0.4f);
			m_bg.color = new Color(color2.r, color2.g, color2.b, boosterUnused ? 1f : 0.3f);
			((TMP_Text)m_title).alpha = (boosterUnused ? 1f : 0.2f);
			completeWithNoBoosterIcon.m_titleVisible = true;
			completeWithNoBoosterIcon.m_isCleared = boosterUnused;
			if (boosterUnused)
			{
				completeWithNoBoosterIcon.m_isFinishedAll = true;
			}
			else
			{
				completeWithNoBoosterIcon.m_isFinishedAll = false;
				completeWithNoBoosterIcon.m_type = (LG_LayerType)0;
			}
			((Component)completeWithNoBoosterIcon.m_rightSideText).gameObject.SetActive(false);
			TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.ExpeditionSuccessPage.AllClearWithNoBoosterUsed");
			if (block != null)
			{
				((TMP_Text)completeWithNoBoosterIcon.m_title).SetText(Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID), true);
			}
			else
			{
				((TMP_Text)completeWithNoBoosterIcon.m_title).SetText("<color=orange>OMNIPOTENT</color>", true);
			}
			((Component)completeWithNoBoosterIcon.m_title).gameObject.SetActive(true);
		}

		private void OnDestroy()
		{
			m_icon = (m_bg = null);
			m_completeWithNoBoosterIcon = null;
			Wrapper.Destory();
		}

		static ExpeditionSuccessPage_NoBoosterIcon()
		{
			ClassInjector.RegisterTypeInIl2Cpp<ExpeditionSuccessPage_NoBoosterIcon>();
		}
	}
	internal class ExpeditionWindow_NoBoosterIcon : MonoBehaviour
	{
		internal CM_ExpeditionWindow m_window;

		private CM_ExpeditionSectorIcon m_completeWithNoBoosterIcon;

		private NoBoosterIconGOWrapper Wrapper;

		private SpriteRenderer m_icon;

		private SpriteRenderer m_bg;

		private TextMeshPro m_title;

		private TextMeshPro m_rightSideText;

		internal void InitialSetup()
		{
			if ((Object)(object)m_window == (Object)null)
			{
				LPLogger.Error("ExpeditionSuccess_NoBooster: Assign the page instance before setup");
			}
			else
			{
				if ((Object)(object)m_completeWithNoBoosterIcon != (Object)null)
				{
					return;
				}
				if ((Object)(object)Assets.NoBoosterIcon == (Object)null)
				{
					AssetAPI.OnAssetBundlesLoaded += delegate
					{
						LoadAsset();
						AssetAPI.OnAssetBundlesLoaded -= LoadAsset;
					};
				}
				else
				{
					LoadAsset();
				}
			}
		}

		private void LoadAsset()
		{
			if ((Object)(object)Assets.NoBoosterIcon == (Object)null)
			{
				LPLogger.Error("ExpeditionSuccess_NoBooster.Setup: cannot instantiate NoBooster icon...");
				return;
			}
			m_completeWithNoBoosterIcon = GOUtil.SpawnChildAndGetComp<CM_ExpeditionSectorIcon>(Assets.NoBoosterIcon, m_window.m_sectorIconAlign);
			Wrapper = new NoBoosterIconGOWrapper(((Component)m_completeWithNoBoosterIcon).gameObject);
			m_bg = Wrapper.BGGO.GetComponent<SpriteRenderer>();
			m_icon = Wrapper.IconGO.GetComponent<SpriteRenderer>();
			m_title = Object.Instantiate<TextMeshPro>(m_window.m_sectorIconMain.m_title);
			m_title.transform.SetParent(Wrapper.ObjectiveIcon.transform, false);
			m_rightSideText = Object.Instantiate<TextMeshPro>(m_window.m_sectorIconMain.m_rightSideText);
			m_rightSideText.transform.SetParent(Wrapper.RightSideText.transform, false);
			m_completeWithNoBoosterIcon.m_title = m_title;
			m_completeWithNoBoosterIcon.m_rightSideText = m_rightSideText;
			((RectTransformComp)m_completeWithNoBoosterIcon).SetAnchor((GuiAnchor)1, true);
			((RectTransformComp)m_completeWithNoBoosterIcon).SetVisible(false);
			m_completeWithNoBoosterIcon.SortAsPopupLayer();
			m_completeWithNoBoosterIcon.m_root = m_window.m_root;
		}

		internal void SetVisible(bool visible)
		{
			((RectTransformComp)m_completeWithNoBoosterIcon).SetVisible(visible);
		}

		internal void SetIconPosition(Vector2 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((RectTransformComp)m_completeWithNoBoosterIcon).SetPosition(position);
		}

		internal void BlinkIn(float delay)
		{
			m_completeWithNoBoosterIcon.BlinkIn(delay);
		}

		internal void SetupNoBoosterUsedIcon(bool boosterUnused)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			CM_ExpeditionSectorIcon completeWithNoBoosterIcon = m_completeWithNoBoosterIcon;
			completeWithNoBoosterIcon.m_isFinishedAll = true;
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconMainSkull, completeWithNoBoosterIcon.m_iconMainBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconSecondarySkull, completeWithNoBoosterIcon.m_iconSecondaryBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconThirdSkull, completeWithNoBoosterIcon.m_iconThirdBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconFinishedAllSkull, completeWithNoBoosterIcon.m_iconFinishedAllBG, false, false, 0.5f, 0.7f);
			Color color = m_icon.color;
			Color color2 = m_bg.color;
			m_icon.color = new Color(color.r, color.g, color.b, boosterUnused ? 1f : 0.4f);
			m_bg.color = new Color(color2.r, color2.g, color2.b, boosterUnused ? 1f : 0.3f);
			((TMP_Text)m_title).alpha = (boosterUnused ? 1f : 0.2f);
			completeWithNoBoosterIcon.m_titleVisible = true;
			completeWithNoBoosterIcon.m_isCleared = boosterUnused;
			if (boosterUnused)
			{
				completeWithNoBoosterIcon.m_isFinishedAll = true;
			}
			else
			{
				completeWithNoBoosterIcon.m_isFinishedAll = false;
				completeWithNoBoosterIcon.m_type = (LG_LayerType)0;
			}
			((Component)completeWithNoBoosterIcon.m_rightSideText).gameObject.SetActive(false);
			TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.ExpeditionSuccessPage.AllClearWithNoBoosterUsed");
			if (block != null)
			{
				((TMP_Text)completeWithNoBoosterIcon.m_title).SetText(Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID), true);
			}
			else
			{
				((TMP_Text)completeWithNoBoosterIcon.m_title).SetText("<color=orange>OMNIPOTENT</color>", true);
			}
			((Component)completeWithNoBoosterIcon.m_title).gameObject.SetActive(true);
		}

		private void OnDestroy()
		{
			m_icon = (m_bg = null);
			m_completeWithNoBoosterIcon = null;
			Wrapper.Destory();
		}

		static ExpeditionWindow_NoBoosterIcon()
		{
			ClassInjector.RegisterTypeInIl2Cpp<ExpeditionWindow_NoBoosterIcon>();
		}
	}
	public class NoBoosterIconGOWrapper
	{
		public GameObject GameObject { get; private set; }

		public GameObject ObjectiveIcon
		{
			get
			{
				GameObject gameObject = GameObject;
				if (gameObject == null)
				{
					return null;
				}
				return ((Component)gameObject.transform.GetChild(0)).gameObject;
			}
		}

		public GameObject BGHolder
		{
			get
			{
				GameObject objectiveIcon = ObjectiveIcon;
				if (objectiveIcon == null)
				{
					return null;
				}
				return ((Component)objectiveIcon.transform.GetChild(2)).gameObject;
			}
		}

		public GameObject SkullHolder
		{
			get
			{
				GameObject objectiveIcon = ObjectiveIcon;
				if (objectiveIcon == null)
				{
					return null;
				}
				return ((Component)objectiveIcon.transform.GetChild(3)).gameObject;
			}
		}

		public GameObject BGGO
		{
			get
			{
				GameObject bGHolder = BGHolder;
				if (bGHolder == null)
				{
					return null;
				}
				return ((Component)bGHolder.transform.GetChild(4)).gameObject;
			}
		}

		public GameObject IconGO
		{
			get
			{
				GameObject skullHolder = SkullHolder;
				if (skullHolder == null)
				{
					return null;
				}
				return ((Component)skullHolder.transform.GetChild(4)).gameObject;
			}
		}

		public GameObject TitleGO
		{
			get
			{
				GameObject objectiveIcon = ObjectiveIcon;
				if (objectiveIcon == null)
				{
					return null;
				}
				return ((Component)objectiveIcon.transform.GetChild(1)).gameObject;
			}
		}

		public GameObject RightSideText
		{
			get
			{
				GameObject gameObject = GameObject;
				if (gameObject == null)
				{
					return null;
				}
				return ((Component)gameObject.transform.GetChild(2)).gameObject;
			}
		}

		public NoBoosterIconGOWrapper(GameObject iconGO)
		{
			GameObject = iconGO;
		}

		public void Destory()
		{
			if ((Object)(object)GameObject != (Object)null)
			{
				Object.Destroy((Object)(object)GameObject);
			}
			GameObject = null;
		}
	}
	internal class RundownTierMarker_NoBoosterIcon : MonoBehaviour
	{
		internal CM_RundownTierMarker m_tierMarker;

		private CM_ExpeditionSectorIcon m_completeWithNoBoosterIcon;

		private SpriteRenderer m_icon;

		private SpriteRenderer m_bg;

		private TextMeshPro m_title;

		private TextMeshPro m_rightSideText;

		private NoBoosterIconGOWrapper Wrapper;

		internal void Setup()
		{
			if ((Object)(object)m_tierMarker == (Object)null)
			{
				LPLogger.Error("ExpeditionSuccess_NoBooster: Assign the page instance before setup");
			}
			else
			{
				if ((Object)(object)m_completeWithNoBoosterIcon != (Object)null)
				{
					return;
				}
				if ((Object)(object)Assets.NoBoosterIcon == (Object)null)
				{
					AssetAPI.OnAssetBundlesLoaded += delegate
					{
						LoadAsset();
						AssetAPI.OnAssetBundlesLoaded -= LoadAsset;
					};
				}
				else
				{
					LoadAsset();
				}
			}
		}

		private void LoadAsset()
		{
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Assets.NoBoosterIcon == (Object)null)
			{
				LPLogger.Error("ExpeditionSuccess_NoBooster.Setup: cannot instantiate NoBooster icon...");
				return;
			}
			m_completeWithNoBoosterIcon = GOUtil.SpawnChildAndGetComp<CM_ExpeditionSectorIcon>(Assets.NoBoosterIcon, m_tierMarker.m_sectorIconAlign_main);
			Wrapper = new NoBoosterIconGOWrapper(((Component)m_completeWithNoBoosterIcon).gameObject);
			m_bg = Wrapper.BGGO.GetComponent<SpriteRenderer>();
			m_icon = Wrapper.IconGO.GetComponent<SpriteRenderer>();
			m_title = Object.Instantiate<TextMeshPro>(m_tierMarker.m_sectorIconSummaryMain.m_title);
			m_title.transform.SetParent(Wrapper.ObjectiveIcon.transform, false);
			m_rightSideText = Object.Instantiate<TextMeshPro>(m_tierMarker.m_sectorIconSummaryMain.m_rightSideText);
			m_rightSideText.transform.SetParent(Wrapper.RightSideText.transform, false);
			m_completeWithNoBoosterIcon.m_title = m_title;
			m_completeWithNoBoosterIcon.m_rightSideText = m_rightSideText;
			SetupNoBoosterUsedIcon(boosterUnused: true);
			float num = 0.16f;
			Vector3 localScale = default(Vector3);
			((Vector3)(ref localScale))..ctor(num, num, num);
			_ = num / 0.16f;
			((Component)m_completeWithNoBoosterIcon).transform.localScale = localScale;
			Vector2 val = ((RectTransformComp)m_tierMarker.m_sectorIconSummarySecondary).GetPosition() - ((RectTransformComp)m_tierMarker.m_sectorIconSummaryMain).GetPosition();
			((RectTransformComp)m_completeWithNoBoosterIcon).SetPosition(val * 4f);
			((RectTransformComp)m_completeWithNoBoosterIcon).SetVisible(false);
		}

		internal void SetVisible(bool visible)
		{
			((RectTransformComp)m_completeWithNoBoosterIcon).SetVisible(visible);
		}

		internal void SetSectorIconText(string text)
		{
			((RectTransformComp)m_completeWithNoBoosterIcon).SetVisible(true);
			m_completeWithNoBoosterIcon.SetRightSideText(text);
		}

		private void SetupNoBoosterUsedIcon(bool boosterUnused)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			CM_ExpeditionSectorIcon completeWithNoBoosterIcon = m_completeWithNoBoosterIcon;
			completeWithNoBoosterIcon.m_isFinishedAll = true;
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconMainSkull, completeWithNoBoosterIcon.m_iconMainBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconSecondarySkull, completeWithNoBoosterIcon.m_iconSecondaryBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconThirdSkull, completeWithNoBoosterIcon.m_iconThirdBG, false, false, 0.5f, 0.7f);
			completeWithNoBoosterIcon.SetupIcon(completeWithNoBoosterIcon.m_iconFinishedAllSkull, completeWithNoBoosterIcon.m_iconFinishedAllBG, false, false, 0.5f, 0.7f);
			Color color = m_icon.color;
			Color color2 = m_bg.color;
			m_icon.color = new Color(color.r, color.g, color.b, boosterUnused ? 1f : 0.4f);
			m_bg.color = new Color(color2.r, color2.g, color2.b, boosterUnused ? 1f : 0.3f);
			((TMP_Text)m_title).alpha = (boosterUnused ? 1f : 0.2f);
			completeWithNoBoosterIcon.m_titleVisible = true;
			completeWithNoBoosterIcon.m_isCleared = boosterUnused;
			if (boosterUnused)
			{
				completeWithNoBoosterIcon.m_isFinishedAll = true;
			}
			else
			{
				completeWithNoBoosterIcon.m_isFinishedAll = false;
				completeWithNoBoosterIcon.m_type = (LG_LayerType)0;
			}
			((Component)completeWithNoBoosterIcon.m_rightSideText).gameObject.SetActive(false);
			TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.ExpeditionSuccessPage.AllClearWithNoBoosterUsed");
			if (block != null)
			{
				((TMP_Text)completeWithNoBoosterIcon.m_title).SetText(Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID), true);
			}
			else
			{
				((TMP_Text)completeWithNoBoosterIcon.m_title).SetText("<color=orange>OMNIPOTENT</color>", true);
			}
			((Component)completeWithNoBoosterIcon.m_title).gameObject.SetActive(true);
		}

		static RundownTierMarker_NoBoosterIcon()
		{
			ClassInjector.RegisterTypeInIl2Cpp<RundownTierMarker_NoBoosterIcon>();
		}
	}
}