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