Decompiled source of Vega v0.6.16
plugins/Vega/Custom/_crisplugins/Inas07.ExtraObjectiveSetup.dll
Decompiled 18 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; 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.Nodes; using System.Text.Json.Serialization; using AIGraph; using AK; using Agents; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using ChainedPuzzles; using Enemies; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.BaseClasses.CustomTerminalDefinition; using ExtraObjectiveSetup.Expedition; using ExtraObjectiveSetup.Expedition.Gears; using ExtraObjectiveSetup.Expedition.IndividualGeneratorGroup; using ExtraObjectiveSetup.ExtendedWardenEvents; using ExtraObjectiveSetup.Instances; using ExtraObjectiveSetup.Instances.ChainedPuzzle; using ExtraObjectiveSetup.JSON; using ExtraObjectiveSetup.JSON.Extensions; using ExtraObjectiveSetup.JSON.MTFOPartialData; using ExtraObjectiveSetup.JSON.PData; using ExtraObjectiveSetup.Objectives.ActivateSmallHSU; using ExtraObjectiveSetup.Objectives.GeneratorCluster; using ExtraObjectiveSetup.Objectives.IndividualGenerator; using ExtraObjectiveSetup.Objectives.ObjectiveCounter; using ExtraObjectiveSetup.Objectives.TerminalUplink; using ExtraObjectiveSetup.Tweaks.BossEvents; using ExtraObjectiveSetup.Tweaks.Scout; using ExtraObjectiveSetup.Tweaks.TerminalPosition; using ExtraObjectiveSetup.Tweaks.TerminalTweak; using ExtraObjectiveSetup.Utils; using FloLib.Networks.Replications; using GTFO.API; using GTFO.API.Extensions; using GTFO.API.JSON.Converters; using GTFO.API.Utilities; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Localization; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using StateMachines; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Inas07.ExtraObjectiveSetup")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Inas07.ExtraObjectiveSetup")] [assembly: AssemblyTitle("Inas07.ExtraObjectiveSetup")] [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.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; } } [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 ExtraObjectiveSetup { public static class EOSNetworking { public const uint INVALID_ID = 0u; public const uint FOREVER_REPLICATOR_ID_START = 1000u; public const uint REPLICATOR_ID_START = 10000u; private static uint currentForeverID; private static uint currentID; private static HashSet<uint> foreverUsedIDs; private static HashSet<uint> usedIDs; public static uint AllotReplicatorID() { while (currentID >= 10000 && usedIDs.Contains(currentID)) { currentID++; } if (currentID < 10000) { EOSLogger.Error("Replicator ID depleted. How?"); return 0u; } uint num = currentID; usedIDs.Add(num); currentID++; return num; } public static bool TryAllotID(uint id) { return usedIDs.Add(id); } public static uint AllotForeverReplicatorID() { while (currentForeverID < 10000 && foreverUsedIDs.Contains(currentForeverID)) { currentForeverID++; } if (currentForeverID >= 10000) { EOSLogger.Error("Forever Replicator ID depleted."); return 0u; } uint num = currentForeverID; foreverUsedIDs.Add(num); currentForeverID++; return num; } private static void Clear() { usedIDs.Clear(); currentID = 10000u; } public static void ClearForever() { foreverUsedIDs.Clear(); currentForeverID = 1000u; } static EOSNetworking() { currentForeverID = 1000u; currentID = 10000u; foreverUsedIDs = new HashSet<uint>(); usedIDs = new HashSet<uint>(); LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } } public sealed class BatchBuildManager { private Dictionary<BatchName, Action> OnBatchStart = new Dictionary<BatchName, Action>(); private Dictionary<BatchName, Action> OnBatchDone = new Dictionary<BatchName, Action>(); public static BatchBuildManager Current { get; private set; } public void Init() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (OnBatchStart.Count < 1) { foreach (object value in Enum.GetValues(typeof(BatchName))) { OnBatchStart[(BatchName)value] = null; } } if (OnBatchDone.Count >= 1) { return; } foreach (object value2 in Enum.GetValues(typeof(BatchName))) { OnBatchDone[(BatchName)value2] = null; } } public void Add_OnBatchDone(BatchName batchName, Action action) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Dictionary<BatchName, Action> onBatchDone = OnBatchDone; onBatchDone[batchName] = (Action)Delegate.Combine(onBatchDone[batchName], action); } public void Remove_OnBatchDone(BatchName batchName, Action action) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Dictionary<BatchName, Action> onBatchDone = OnBatchDone; onBatchDone[batchName] = (Action)Delegate.Remove(onBatchDone[batchName], action); } public Action Get_OnBatchDone(BatchName batchName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return OnBatchDone[batchName]; } public void Add_OnBatchStart(BatchName batchName, Action action) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Dictionary<BatchName, Action> onBatchStart = OnBatchStart; onBatchStart[batchName] = (Action)Delegate.Combine(onBatchStart[batchName], action); } public void Remove_OnBatchStart(BatchName batchName, Action action) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Dictionary<BatchName, Action> onBatchStart = OnBatchStart; onBatchStart[batchName] = (Action)Delegate.Remove(onBatchStart[batchName], action); } public Action Get_OnBatchStart(BatchName batchName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return OnBatchStart[batchName]; } private BatchBuildManager() { } static BatchBuildManager() { Current = new BatchBuildManager(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Inas.ExtraObjectiveSetup", "ExtraObjectiveSetup", "100.0.0")] [BepInIncompatibility("Amor.ExcellentObjectiveSetup")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string PLUGIN_NAME = "ExtraObjectiveSetup"; public const string VERSION = "100.0.0"; private Harmony m_Harmony; public override void Load() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown m_Harmony = new Harmony("ExtraObjectiveSetup"); m_Harmony.PatchAll(); SetupManagers(); } private void SetupManagers() { BatchBuildManager.Current.Init(); IndividualGeneratorObjectiveManager.Current.Init(); GeneratorClusterObjectiveManager.Current.Init(); HSUActivatorObjectiveManager.Current.Init(); UplinkObjectiveManager.Current.Init(); TerminalPositionOverrideManager.Current.Init(); ScoutScreamEventManager.Current.Init(); BossDeathEventManager.Current.Init(); ExpeditionDefinitionManager.Current.Init(); ExpeditionGearManager.Current.Init(); ExpeditionIGGroupManager.Current.Init(); GeneratorClusterInstanceManager.Current.Init(); HSUActivatorInstanceManager.Current.Init(); PowerGeneratorInstanceManager.Current.Init(); TerminalInstanceManager.Current.Init(); ObjectiveCounterManager.Current.Init(); } } } namespace ExtraObjectiveSetup.Utils { public static class EOSTerminalUtils { public static List<LG_ComputerTerminal> FindTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, Predicate<LG_ComputerTerminal> predicate) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0090: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val) || (Object)(object)val == (Object)null) { EOSLogger.Error($"SelectTerminal: Could NOT find zone {(dimensionIndex, layerType, localIndex)}"); return null; } if (val.TerminalsSpawnedInZone.Count <= 0) { EOSLogger.Error($"SelectTerminal: Could not find any terminals in zone {(dimensionIndex, layerType, localIndex)}"); return null; } List<LG_ComputerTerminal> list = new List<LG_ComputerTerminal>(); Enumerator<LG_ComputerTerminal> enumerator = val.TerminalsSpawnedInZone.GetEnumerator(); while (enumerator.MoveNext()) { LG_ComputerTerminal current = enumerator.Current; if (predicate != null) { if (predicate(current)) { list.Add(current); } } else { list.Add(current); } } return list; } public static TerminalLogFileData GetLocalLog(this LG_ComputerTerminal terminal, string logName) { Dictionary<string, TerminalLogFileData> localLogs = terminal.GetLocalLogs(); logName = logName.ToUpperInvariant(); return localLogs.ContainsKey(logName) ? localLogs[logName] : null; } public static void ResetInitialOutput(this LG_ComputerTerminal terminal) { terminal.m_command.ClearOutputQueueAndScreenBuffer(); terminal.m_command.AddInitialTerminalOutput(); if (terminal.IsPasswordProtected) { terminal.m_command.AddPasswordProtectedOutput((Il2CppStringArray)null); } } public static List<WardenObjectiveEventData> GetUniqueCommandEvents(this LG_ComputerTerminal terminal, string command) { List<WardenObjectiveEventData> result = new List<WardenObjectiveEventData>(); if ((Object)(object)terminal.ConnectedReactor != (Object)null) { return result; } List<LG_ComputerTerminal> terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone; int num = terminalsSpawnedInZone.IndexOf(terminal); AIG_CourseNode spawnNode = terminal.SpawnNode; ExpeditionZoneData val = ((spawnNode != null) ? spawnNode.m_zone.m_settings.m_zoneData : null) ?? null; if (val == null) { EOSLogger.Error("GetCommandEvents: Cannot find target zone data."); return result; } if (num < 0 || num >= val.TerminalPlacements.Count) { EOSLogger.Debug($"GetCommandEvents: TerminalDataIndex({num}), TargetZoneData.TerminalPlacements.Count == ({val.TerminalPlacements.Count}) - maybe a custom terminal, skipped"); return result; } List<CustomTerminalCommand> uniqueCommands = val.TerminalPlacements[num].UniqueCommands; Enumerator<CustomTerminalCommand> enumerator = uniqueCommands.GetEnumerator(); while (enumerator.MoveNext()) { CustomTerminalCommand current = enumerator.Current; if (current.Command.ToLower().Equals(command.ToLower())) { return current.CommandEvents.ToManaged<WardenObjectiveEventData>(); } } EOSLogger.Error("GetCommandEvents: command '" + command + "' not found on " + terminal.ItemKey); return result; } public static LG_ComputerTerminal SelectPasswordTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, eSeedType seedType, int staticSeed = 1) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected I4, but got Unknown //IL_00eb: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_011a: Unknown result type (might be due to invalid IL or missing references) if ((int)seedType == 0) { EOSLogger.Error($"SelectTerminal: unsupported seed type {seedType}"); return null; } List<LG_ComputerTerminal> list = FindTerminal(dimensionIndex, layerType, localIndex, (LG_ComputerTerminal x) => !x.HasPasswordPart); if (list == null) { EOSLogger.Error($"SelectTerminal: Could not find zone {(dimensionIndex, layerType, localIndex)}!"); return null; } if (list.Count <= 0) { EOSLogger.Error($"SelectTerminal: Could not find any terminals without a password part in zone {(dimensionIndex, layerType, localIndex)}, putting the password on random (session) already used terminal."); LG_Zone val = default(LG_Zone); Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val); return val.TerminalsSpawnedInZone[Builder.SessionSeedRandom.Range(0, val.TerminalsSpawnedInZone.Count, "NO_TAG")]; } switch (seedType - 1) { case 0: return list[Builder.SessionSeedRandom.Range(0, list.Count, "NO_TAG")]; case 1: return list[Builder.BuildSeedRandom.Range(0, list.Count, "NO_TAG")]; case 2: Random.InitState(staticSeed); return list[Random.Range(0, list.Count)]; default: EOSLogger.Error("SelectTerminal: did not have a valid SeedType!!"); return null; } } public static void BuildPassword(LG_ComputerTerminal terminal, TerminalPasswordData data) { //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Invalid comparison between Unknown and I4 //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Expected O, but got Unknown //IL_0586: Expected O, but got Unknown if (!data.PasswordProtected) { return; } if (terminal.IsPasswordProtected) { EOSLogger.Error("EOSTerminalUtils.BuildPassword: " + terminal.PublicName + " is already password-protected!"); return; } if (!data.GeneratePassword) { terminal.LockWithPassword(data.Password, new string[1] { data.PasswordHintText }); return; } if (data.TerminalZoneSelectionDatas.Count <= 0) { EOSLogger.Error($"Tried to generate a password for terminal {terminal.PublicName} with no {typeof(TerminalZoneSelectionData).Name}!! This is not allowed."); return; } string codeWord = SerialGenerator.GetCodeWord(); string passwordHintText = data.PasswordHintText; string text = "<b>[Forgot your password?]</b> Backup security key(s) located in logs on "; int num = data.PasswordPartCount; if (codeWord.Length % num != 0) { EOSLogger.Error($"Build() password.Length ({codeWord.Length}) not divisible by passwordParts ({num}). Defaulting to 1."); num = 1; } string[] array = ((num > 1) ? Il2CppArrayBase<string>.op_Implicit((Il2CppArrayBase<string>)(object)StringUtils.SplitIntoChunksArray(codeWord, codeWord.Length / num)) : new string[1] { codeWord }); string text2 = ""; if (data.ShowPasswordPartPositions) { for (int i = 0; i < array[0].Length; i++) { text2 += "-"; } } HashSet<LG_ComputerTerminal> hashSet = new HashSet<LG_ComputerTerminal>(); LG_Zone val = default(LG_Zone); for (int j = 0; j < num; j++) { int index = j % data.TerminalZoneSelectionDatas.Count; List<CustomTerminalZoneSelectionData> list = data.TerminalZoneSelectionDatas[index]; int index2 = Builder.SessionSeedRandom.Range(0, list.Count, "NO_TAG"); CustomTerminalZoneSelectionData customTerminalZoneSelectionData = list[index2]; LG_ComputerTerminal val2; if ((int)customTerminalZoneSelectionData.SeedType == 0) { if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(customTerminalZoneSelectionData.DimensionIndex, customTerminalZoneSelectionData.LayerType, customTerminalZoneSelectionData.LocalIndex, ref val) || (Object)(object)val == (Object)null) { EOSLogger.Error($"BuildPassword: seedType {0} specified but cannot find zone {customTerminalZoneSelectionData.GlobalZoneIndexTuple()}"); } if (val.TerminalsSpawnedInZone.Count <= 0) { EOSLogger.Error($"BuildPassword: seedType {0} specified but cannot find terminal zone {customTerminalZoneSelectionData.GlobalZoneIndexTuple()}"); } val2 = val.TerminalsSpawnedInZone[customTerminalZoneSelectionData.TerminalIndex]; } else { val2 = SelectPasswordTerminal(customTerminalZoneSelectionData.DimensionIndex, customTerminalZoneSelectionData.LayerType, customTerminalZoneSelectionData.LocalIndex, customTerminalZoneSelectionData.SeedType); } if ((Object)(object)val2 == (Object)null) { EOSLogger.Error($"BuildPassword: CRITICAL ERROR, could not get a LG_ComputerTerminal for password part ({j + 1}/{num}) for {terminal.PublicName} backup log."); continue; } string text3 = ""; string text4; if (data.ShowPasswordPartPositions) { for (int k = 0; k < j; k++) { text3 += text2; } text4 = text3 + array[j]; for (int l = j; l < num - 1; l++) { text4 += text2; } } else { text4 = array[j]; } string value = (data.ShowPasswordPartPositions ? $"0{j + 1}" : $"0{Builder.SessionSeedRandom.Range(0, 9, "NO_TAG")}"); TerminalLogFileData val3 = new TerminalLogFileData { FileName = $"key{value}_{LG_TerminalPasswordLinkerJob.GetTerminalNumber(terminal)}{(val2.HasPasswordPart ? "_1" : "")}.LOG", FileContent = new LocalizedText { UntranslatedText = string.Format(Text.Get((num > 1) ? 1431221909u : 2260297836u), text4), Id = 0u } }; val2.AddLocalLog(val3, true); if (!hashSet.Contains(val2)) { if (j > 0) { text += ", "; } text = text + val2.PublicName + " in " + val2.SpawnNode.m_zone.AliasName; } hashSet.Add(val2); val2.HasPasswordPart = true; } string text5 = text + "."; if (data.ShowPasswordLength) { terminal.LockWithPassword(codeWord, new string[3] { passwordHintText, text5, "Char[" + codeWord.Length + "]" }); } else { terminal.LockWithPassword(codeWord, new string[2] { passwordHintText, text5 }); } } public static void AddUniqueCommand(LG_ComputerTerminal terminal, CustomCommand cmd) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) if (terminal.m_command.m_commandsPerString.ContainsKey(cmd.Command)) { EOSLogger.Error("Duplicate command name: '" + cmd.Command + "', cannot add command"); return; } TERM_Command val = default(TERM_Command); if (!terminal.m_command.TryGetUniqueCommandSlot(ref val)) { EOSLogger.Error("Cannot get more unique command slot, max: 5"); return; } terminal.m_command.AddCommand(val, cmd.Command, cmd.CommandDesc, cmd.SpecialCommandRule, ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(cmd.CommandEvents), ListExtensions.ToIl2Cpp<TerminalOutput>(cmd.PostCommandOutputs)); for (int i = 0; i < cmd.CommandEvents.Count; i++) { WardenObjectiveEventData val2 = cmd.CommandEvents[i]; if (val2.ChainPuzzle == 0) { continue; } ChainedPuzzleDataBlock block = GameDataBlockBase<ChainedPuzzleDataBlock>.GetBlock(val2.ChainPuzzle); if (block == null) { continue; } LG_Area val3; Transform val4; if (terminal.SpawnNode != null) { val3 = terminal.SpawnNode.m_area; val4 = terminal.m_wardenObjectiveSecurityScanAlign; } else { LG_WardenObjective_Reactor connectedReactor = terminal.ConnectedReactor; object obj; if (connectedReactor == null) { obj = null; } else { AIG_CourseNode spawnNode = connectedReactor.SpawnNode; obj = ((spawnNode != null) ? spawnNode.m_area : null); } if (obj == null) { obj = null; } val3 = (LG_Area)obj; LG_WardenObjective_Reactor connectedReactor2 = terminal.ConnectedReactor; val4 = ((connectedReactor2 != null) ? connectedReactor2.m_chainedPuzzleAlign : null) ?? null; } if ((Object)(object)val3 == (Object)null) { EOSLogger.Error("Terminal Source Area is not found! Cannot create chained puzzle for command " + cmd.Command + "!"); continue; } ChainedPuzzleInstance val5 = ChainedPuzzleManager.CreatePuzzleInstance(block, val3, val4.position, val4, val2.UseStaticBioscanPoints); List<WardenObjectiveEventData> events = ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(cmd.CommandEvents.GetRange(i, cmd.CommandEvents.Count - i)); val5.OnPuzzleSolved += Action.op_Implicit((Action)delegate { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(events, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); }); terminal.SetChainPuzzleForCommand(val, i, val5); } } } public static class EOSUtils { public static List<T> ToManaged<T>(this List<T> il2cppList) { List<T> list = new List<T>(); Enumerator<T> enumerator = il2cppList.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list.Add(current); } return list; } public static void ResetProgress(this ChainedPuzzleInstance chainedPuzzle) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (chainedPuzzle.Data.DisableSurvivalWaveOnComplete) { chainedPuzzle.m_sound = new CellSoundPlayer(chainedPuzzle.m_parent.position); } foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)chainedPuzzle.m_chainedPuzzleCores) { ResetChild(item); } if (SNet.IsMaster) { pChainedPuzzleState state = chainedPuzzle.m_stateReplicator.State; pChainedPuzzleState val = default(pChainedPuzzleState); val.status = (eChainedPuzzleStatus)0; val.currentSurvivalWave_EventID = state.currentSurvivalWave_EventID; val.isSolved = false; val.isActive = false; pChainedPuzzleState val2 = val; chainedPuzzle.m_stateReplicator.InteractWithState(val2, new pChainedPuzzleInteraction { type = (eChainedPuzzleInteraction)2 }); } static void ResetChild(iChainedPuzzleCore ICore) { CP_Bioscan_Core val3 = ((Il2CppObjectBase)ICore).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val3 != (Object)null) { CP_Holopath_Spline val4 = ((Il2CppObjectBase)val3.m_spline).Cast<CP_Holopath_Spline>(); CP_PlayerScanner val5 = ((Il2CppObjectBase)val3.PlayerScanner).Cast<CP_PlayerScanner>(); val5.ResetScanProgression(0f); val3.Deactivate(); } else { CP_Cluster_Core val6 = ((Il2CppObjectBase)ICore).TryCast<CP_Cluster_Core>(); if ((Object)(object)val6 == (Object)null) { EOSLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core..."); } else { CP_Holopath_Spline val7 = ((Il2CppObjectBase)val6.m_spline).Cast<CP_Holopath_Spline>(); foreach (iChainedPuzzleCore item2 in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val6.m_childCores) { ResetChild(item2); } val6.Deactivate(); } } } } } public class EOSColor { public float r { get; set; } public float g { get; set; } public float b { get; set; } public float a { get; set; } = 1f; public Color ToUnityColor() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Color(r, g, b, a); } } public static class VanillaTMPPros { public const string VANILLA_CP_PREFAB_PATH = "Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_sustained_RequireAll.prefab"; public static GameObject Instantiate(GameObject parent = null) { GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_sustained_RequireAll.prefab"); if ((Object)(object)loadedAsset == (Object)null) { EOSLogger.Error("VanillaTMPPros.Instantiate: Cannot find TMPPro from vanilla CP!"); return null; } GameObject gameObject = ((Component)loadedAsset.transform.GetChild(0).GetChild(1).GetChild(0)).gameObject; return ((Object)(object)parent != (Object)null) ? Object.Instantiate<GameObject>(gameObject.gameObject, parent.transform) : Object.Instantiate<GameObject>(gameObject.gameObject); } } public class Vec4 : Vec3 { [JsonPropertyOrder(-9)] public float w { get; set; } = 0f; public Vector4 ToVector4() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Vector4(base.x, base.y, base.z, w); } } public class Vec3 { [JsonPropertyOrder(-10)] public float x { get; set; } [JsonPropertyOrder(-10)] public float y { get; set; } [JsonPropertyOrder(-10)] public float z { get; set; } public Vector3 ToVector3() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, z); } public Quaternion ToQuaternion() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(x, y, z); } } public static class EOSLogger { private static ManualLogSource logger = Logger.CreateLogSource("ExtraObjectiveSetup"); 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); } } } } namespace ExtraObjectiveSetup.Tweaks.TerminalTweak { public struct TerminalState { public bool Enabled; public TerminalState() { Enabled = true; } public TerminalState(bool Enabled) { this.Enabled = true; this.Enabled = Enabled; } public TerminalState(TerminalState o) { Enabled = true; Enabled = o.Enabled; } } public class TerminalWrapper { public LG_ComputerTerminal lgTerminal { get; private set; } public StateReplicator<TerminalState> stateReplicator { get; private set; } private void ChangeStateUnsynced(bool enabled) { EOSLogger.Debug($"{lgTerminal.ItemKey} state, enabled: {enabled}"); lgTerminal.OnProximityExit(); Interact_ComputerTerminal componentInChildren = ((Component)lgTerminal).GetComponentInChildren<Interact_ComputerTerminal>(true); bool flag = enabled; if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = flag; ((Interact_Base)componentInChildren).SetActive(flag); } lgTerminal.m_interfaceScreen.SetActive(flag); lgTerminal.m_loginScreen.SetActive(flag); if ((Object)(object)lgTerminal.m_text != (Object)null) { ((Behaviour)lgTerminal.m_text).enabled = flag; } if (!flag) { PlayerAgent localInteractionSource = lgTerminal.m_localInteractionSource; if ((Object)(object)localInteractionSource != (Object)null && localInteractionSource.FPItemHolder.InTerminalTrigger) { lgTerminal.ExitFPSView(); } } } public void ChangeState(bool enabled) { ChangeStateUnsynced(enabled); if (SNet.IsMaster) { stateReplicator.SetState(new TerminalState { Enabled = enabled }); } } private void OnStateChanged(TerminalState oldState, TerminalState newState, bool isRecall) { if (isRecall) { ChangeStateUnsynced(newState.Enabled); } } public static TerminalWrapper Instantiate(LG_ComputerTerminal lgTerminal, uint replicatorID) { if ((Object)(object)lgTerminal == (Object)null || replicatorID == 0) { return null; } TerminalWrapper terminalWrapper = new TerminalWrapper(); terminalWrapper.lgTerminal = lgTerminal; terminalWrapper.stateReplicator = StateReplicator<TerminalState>.Create(replicatorID, new TerminalState { Enabled = true }, (LifeTimeType)1, (IStateReplicatorHolder<TerminalState>)null); terminalWrapper.stateReplicator.OnStateChanged += terminalWrapper.OnStateChanged; return terminalWrapper; } private TerminalWrapper() { } } } namespace ExtraObjectiveSetup.Tweaks.TerminalPosition { public class TerminalPosition : BaseInstanceDefinition { public Vec3 Position { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); } internal class TerminalPositionOverrideManager : InstanceDefinitionManager<TerminalPosition> { public static TerminalPositionOverrideManager Current; protected override string DEFINITION_NAME => "TerminalPosition"; private TerminalPositionOverrideManager() { } static TerminalPositionOverrideManager() { Current = new TerminalPositionOverrideManager(); } } } namespace ExtraObjectiveSetup.Tweaks.Scout { public class EventsOnZoneScoutScream : GlobalZoneIndex { public bool SuppressVanillaScoutWave { get; set; } = false; public List<WardenObjectiveEventData> EventsOnScoutScream { get; set; } = new List<WardenObjectiveEventData>(); } internal class ScoutScreamEventManager : ZoneDefinitionManager<EventsOnZoneScoutScream> { public static ScoutScreamEventManager Current; protected override string DEFINITION_NAME => "EventsOnScoutScream"; private ScoutScreamEventManager() { } static ScoutScreamEventManager() { Current = new ScoutScreamEventManager(); } } } namespace ExtraObjectiveSetup.Tweaks.BossEvents { public struct FiniteBDEState { public int ApplyToHibernateCount; public int ApplyToWaveCount; public FiniteBDEState() { ApplyToHibernateCount = int.MaxValue; ApplyToWaveCount = int.MaxValue; } public FiniteBDEState(FiniteBDEState other) { ApplyToHibernateCount = int.MaxValue; ApplyToWaveCount = int.MaxValue; ApplyToHibernateCount = other.ApplyToHibernateCount; ApplyToHibernateCount = other.ApplyToWaveCount; } public FiniteBDEState(int ApplyToHibernateCount, int ApplyToWaveCount) { this.ApplyToHibernateCount = int.MaxValue; this.ApplyToWaveCount = int.MaxValue; this.ApplyToHibernateCount = ApplyToHibernateCount; this.ApplyToWaveCount = ApplyToWaveCount; } } public class EventsOnZoneBossDeath : GlobalZoneIndex { public bool ApplyToHibernate { get; set; } = true; public int ApplyToHibernateCount { get; set; } = int.MaxValue; public bool ApplyToWave { get; set; } = false; public int ApplyToWaveCount { get; set; } = int.MaxValue; public List<uint> BossIDs { get; set; } = new List<uint> { 29u, 36u, 37u }; public List<WardenObjectiveEventData> EventsOnBossDeath { get; set; } = new List<WardenObjectiveEventData>(); [JsonIgnore] public StateReplicator<FiniteBDEState> FiniteBDEStateReplicator { get; private set; } = null; [JsonIgnore] public int RemainingWaveBDE => (FiniteBDEStateReplicator != null) ? FiniteBDEStateReplicator.State.ApplyToWaveCount : ApplyToWaveCount; [JsonIgnore] public int RemainingHibernateBDE => (FiniteBDEStateReplicator != null) ? FiniteBDEStateReplicator.State.ApplyToHibernateCount : ApplyToHibernateCount; public void SetupReplicator(uint replicatorID) { if (ApplyToHibernateCount != int.MaxValue || ApplyToWaveCount != int.MaxValue) { FiniteBDEStateReplicator = StateReplicator<FiniteBDEState>.Create(replicatorID, new FiniteBDEState { ApplyToHibernateCount = ApplyToHibernateCount, ApplyToWaveCount = ApplyToWaveCount }, (LifeTimeType)1, (IStateReplicatorHolder<FiniteBDEState>)null); FiniteBDEStateReplicator.OnStateChanged += OnStateChanged; } } private void OnStateChanged(FiniteBDEState oldState, FiniteBDEState newState, bool isRecall) { } internal void Destroy() { FiniteBDEStateReplicator = null; } } internal class BossDeathEventManager : ZoneDefinitionManager<EventsOnZoneBossDeath> { public enum Mode { HIBERNATE, WAVE } public static BossDeathEventManager Current; public const int UNLIMITED_COUNT = int.MaxValue; private ConcurrentDictionary<(eDimensionIndex, LG_LayerType, eLocalZoneIndex), EventsOnZoneBossDeath> LevelBDEs { get; } = new ConcurrentDictionary<(eDimensionIndex, LG_LayerType, eLocalZoneIndex), EventsOnZoneBossDeath>(); protected override string DEFINITION_NAME => "EventsOnBossDeath"; public bool TryConsumeBDEventsExecutionTimes(EventsOnZoneBossDeath def, Mode mode) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return TryConsumeBDEventsExecutionTimes(def.DimensionIndex, def.LayerType, def.LocalIndex, mode); } public bool TryConsumeBDEventsExecutionTimes(eDimensionIndex dimensionIndex, LG_LayerType layer, eLocalZoneIndex localIndex, Mode mode) { //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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!LevelBDEs.ContainsKey((dimensionIndex, layer, localIndex))) { EOSLogger.Error($"BossDeathEventManager: got an unregistered entry: {(dimensionIndex, layer, localIndex, mode)}"); return false; } EventsOnZoneBossDeath eventsOnZoneBossDeath = LevelBDEs[(dimensionIndex, layer, localIndex)]; int num = ((mode == Mode.HIBERNATE) ? eventsOnZoneBossDeath.RemainingHibernateBDE : eventsOnZoneBossDeath.RemainingWaveBDE); if (num == int.MaxValue) { return true; } if (num > 0) { FiniteBDEState state = eventsOnZoneBossDeath.FiniteBDEStateReplicator.State; if (SNet.IsMaster) { eventsOnZoneBossDeath.FiniteBDEStateReplicator.SetState(new FiniteBDEState { ApplyToHibernateCount = ((mode == Mode.HIBERNATE) ? (num - 1) : state.ApplyToHibernateCount), ApplyToWaveCount = ((mode == Mode.WAVE) ? (num - 1) : state.ApplyToWaveCount) }); } return true; } return false; } private void Clear() { foreach (EventsOnZoneBossDeath value in LevelBDEs.Values) { value.Destroy(); } LevelBDEs.Clear(); } private void SetupForCurrentExpedition() { if (!definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { return; } foreach (EventsOnZoneBossDeath definition in definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions) { if (LevelBDEs.ContainsKey(definition.GlobalZoneIndexTuple())) { EOSLogger.Error($"BossDeathEvent: found duplicate setup for zone {definition.GlobalZoneIndexTuple()}, will overwrite!"); } if (definition.ApplyToHibernateCount != int.MaxValue || definition.ApplyToWaveCount != int.MaxValue) { uint num = EOSNetworking.AllotReplicatorID(); if (num != 0) { definition.SetupReplicator(num); } else { EOSLogger.Error("BossDeathEvent: replicator ID depleted, cannot setup replicator!"); } } LevelBDEs[definition.GlobalZoneIndexTuple()] = definition; } } private BossDeathEventManager() { LevelAPI.OnBuildStart += delegate { Clear(); SetupForCurrentExpedition(); }; LevelAPI.OnLevelCleanup += Clear; } static BossDeathEventManager() { Current = new BossDeathEventManager(); } } } namespace ExtraObjectiveSetup.Patches { [HarmonyPatch] internal class Patch_CheckAndExecuteEventsOnTrigger { [HarmonyPrefix] [HarmonyPatch(typeof(WardenObjectiveManager), "CheckAndExecuteEventsOnTrigger", new Type[] { typeof(WardenObjectiveEventData), typeof(eWardenObjectiveEventTrigger), typeof(bool), typeof(float) })] private static bool Pre_CheckAndExecuteEventsOnTrigger(WardenObjectiveEventData eventToTrigger, eWardenObjectiveEventTrigger trigger, bool ignoreTrigger, float currentDuration) { //IL_0008: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected I4, but got Unknown if (eventToTrigger == null || (!ignoreTrigger && eventToTrigger.Trigger != trigger) || ((double)currentDuration != 0.0 && eventToTrigger.Delay <= currentDuration)) { return true; } uint num = (uint)(int)eventToTrigger.Type; if (!EOSWardenEventManager.Current.HasEventDefinition(num)) { return true; } string value = (EOSWardenEventManager.Current.IsVanillaEventID(num) ? "overriding vanilla event implementation..." : "executing..."); EOSLogger.Debug($"WardenEvent: found definition for event ID {num}, {value}"); EOSWardenEventManager.Current.ExecuteEvent(eventToTrigger, currentDuration); return false; } } [HarmonyPatch] internal class Patch_EventsOnBossDeath { private static HashSet<ushort> ExecutedForInstances; [HarmonyPostfix] [HarmonyPatch(typeof(EnemySync), "OnSpawn")] private static void Post_SpawnEnemy(EnemySync __instance, pEnemySpawnData spawnData) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b6: Invalid comparison between Unknown and I4 //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Invalid comparison between Unknown and I4 //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Invalid comparison between Unknown and I4 //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) AIG_CourseNode val = default(AIG_CourseNode); if (!((pCourseNode)(ref spawnData.courseNode)).TryGet(ref val) || val == null) { EOSLogger.Error("Failed to get spawnnode for a boss! Skipped EventsOnBossDeath for it"); return; } LG_Zone zone = val.m_zone; EventsOnZoneBossDeath def = BossDeathEventManager.Current.GetDefinition(zone.DimensionIndex, zone.Layer.m_type, zone.LocalIndex); if (def == null) { return; } EnemyAgent enemy = __instance.m_agent; if (!def.BossIDs.Contains(((GameDataBlockBase<EnemyDataBlock>)(object)enemy.EnemyData).persistentID) || ((((int)spawnData.mode != 4 && (int)spawnData.mode != 3) || !def.ApplyToHibernate) && ((int)spawnData.mode != 1 || !def.ApplyToWave))) { return; } BossDeathEventManager.Mode mode = (((int)spawnData.mode != 4) ? BossDeathEventManager.Mode.WAVE : BossDeathEventManager.Mode.HIBERNATE); enemy.OnDeadCallback += Action.op_Implicit((Action)delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName == 10) { if (!BossDeathEventManager.Current.TryConsumeBDEventsExecutionTimes(def, mode)) { EOSLogger.Debug($"EventsOnBossDeath: execution times depleted for {def.GlobalZoneIndexTuple()}, {mode}"); } else { ushort globalID = ((Agent)enemy).GlobalID; if (ExecutedForInstances.Contains(globalID)) { ExecutedForInstances.Remove(globalID); } else { def.EventsOnBossDeath.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); ExecutedForInstances.Add(globalID); } } } }); EOSLogger.Debug($"EventsOnBossDeath: added for enemy with id {((GameDataBlockBase<EnemyDataBlock>)(object)enemy.EnemyData).persistentID}, mode: {spawnData.mode}"); } static Patch_EventsOnBossDeath() { ExecutedForInstances = new HashSet<ushort>(); LevelAPI.OnLevelCleanup += ExecutedForInstances.Clear; } } [HarmonyPatch] internal class Patch_EventsOnZoneScoutScream { [HarmonyPrefix] [HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")] private static bool Pre_ES_ScoutScream_CommonUpdate(ES_ScoutScream __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) EnemyAgent enemyAgent = ((ES_Base)__instance).m_enemyAgent; AIG_CourseNode courseNode = ((Agent)enemyAgent).CourseNode; EventsOnZoneScoutScream definition = ScoutScreamEventManager.Current.GetDefinition(courseNode.m_dimension.DimensionIndex, courseNode.LayerType, courseNode.m_zone.LocalIndex); if (definition == null) { return true; } if ((int)__instance.m_state != 3 || __instance.m_stateDoneTimer >= Clock.Time) { return true; } if (definition.EventsOnScoutScream != null && definition.EventsOnScoutScream.Count > 0) { EOSLogger.Debug($"EventsOnZoneScoutScream: found config for {definition.GlobalZoneIndexTuple()}, executing events."); definition.EventsOnScoutScream.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); } if (!definition.SuppressVanillaScoutWave) { if (SNet.IsMaster && ((Agent)((ES_Base)__instance).m_enemyAgent).CourseNode != null) { if (RundownManager.ActiveExpedition.Expedition.ScoutWaveSettings != 0 && RundownManager.ActiveExpedition.Expedition.ScoutWavePopulation != 0) { ushort num = default(ushort); Mastermind.Current.TriggerSurvivalWave(((Agent)((ES_Base)__instance).m_enemyAgent).CourseNode, RundownManager.ActiveExpedition.Expedition.ScoutWaveSettings, RundownManager.ActiveExpedition.Expedition.ScoutWavePopulation, ref num, (SurvivalWaveSpawnType)0, 0f, 2f, true, false, default(Vector3), ""); } else { Debug.LogError(Object.op_Implicit("ES_ScoutScream, a scout is screaming but we can't spawn a wave because the the scout settings are not set for this expedition! ScoutWaveSettings: " + RundownManager.ActiveExpedition.Expedition.ScoutWaveSettings + " ScoutWavePopulation: " + RundownManager.ActiveExpedition.Expedition.ScoutWavePopulation)); } } } else { EOSLogger.Debug("Vanilla scout wave suppressed."); } if (SNet.IsMaster) { ((ES_Base)__instance).m_enemyAgent.AI.m_behaviour.ChangeState((EB_States)5); } ((MachineState<ES_Base>)(object)__instance).m_machine.ChangeState(2); __instance.m_state = (ScoutScreamState)4; return false; } } } namespace ExtraObjectiveSetup.Patches.Uplink { [HarmonyPatch] internal static class CorruptedUplinkConfirm { [HarmonyPrefix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalCorruptedUplinkConfirm")] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalCorruptedUplinkConfirm(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2, ref bool __result) { LG_ComputerTerminal receiver = __instance.m_terminal; LG_ComputerTerminal sender = __instance.m_terminal.CorruptedUplinkReceiver; if ((Object)(object)sender == (Object)null) { EOSLogger.Error("TerminalCorruptedUplinkConfirm() critical failure because terminal does not have a CorruptedUplinkReceiver (sender)."); __result = false; return false; } if (sender.m_isWardenObjective) { return true; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(sender); uint zoneInstanceIndex = TerminalInstanceManager.Current.GetZoneInstanceIndex(sender); UplinkDefinition definition = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); receiver.m_command.AddOutput((TerminalLineType)0, string.Format(Text.Get(2816126705u), sender.PublicName), 0f, (TerminalSoundType)0, (TerminalSoundType)0); if ((Object)(object)sender.ChainedPuzzleForWardenObjective != (Object)null) { ChainedPuzzleInstance chainedPuzzleForWardenObjective = sender.ChainedPuzzleForWardenObjective; chainedPuzzleForWardenObjective.OnPuzzleSolved += Action.op_Implicit((Action)delegate { receiver.m_command.StartTerminalUplinkSequence(string.Empty, true); UplinkObjectiveManager.Current.ChangeState(sender, new UplinkState { Status = UplinkStatus.InProgress, CurrentRoundIndex = 0 }); }); sender.m_command.AddOutput("", true); sender.m_command.AddOutput(Text.Get(3268596368u), true); sender.m_command.AddOutput(Text.Get(2277987284u), true); receiver.m_command.AddOutput("", true); receiver.m_command.AddOutput(Text.Get(3268596368u), true); receiver.m_command.AddOutput(Text.Get(2277987284u), true); if (SNet.IsMaster) { sender.ChainedPuzzleForWardenObjective.AttemptInteract((eChainedPuzzleInteraction)0); } } else { receiver.m_command.StartTerminalUplinkSequence(string.Empty, true); UplinkObjectiveManager.Current.ChangeState(sender, new UplinkState { Status = UplinkStatus.InProgress, CurrentRoundIndex = 0 }); } __result = true; return false; } } [HarmonyPatch] internal static class CorruptedUplinkConnect { [HarmonyPrefix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalCorruptedUplinkConnect")] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalCorruptedUplinkConnect(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2, ref bool __result) { //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown LG_ComputerTerminal terminal = __instance.m_terminal; if (terminal.m_isWardenObjective) { return true; } __result = false; LG_ComputerTerminal corruptedUplinkReceiver = terminal.CorruptedUplinkReceiver; if ((Object)(object)corruptedUplinkReceiver == (Object)null) { EOSLogger.Error("TerminalCorruptedUplinkConnect() critical failure because terminal does not have a CorruptedUplinkReceiver."); return false; } if (LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != 0 && LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != terminal.SyncID) { __instance.AddOngoingUplinkOutput(); __result = false; return false; } LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId = terminal.SyncID; (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(terminal); uint zoneInstanceIndex = TerminalInstanceManager.Current.GetZoneInstanceIndex(terminal); UplinkDefinition definition = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); if (definition.UseUplinkAddress) { param1 = param1.ToUpper(); EOSLogger.Debug("TerminalCorruptedUplinkConnect, param1: " + param1 + ", TerminalUplink: " + ((Object)terminal.UplinkPuzzle).ToString()); } else { param1 = terminal.UplinkPuzzle.TerminalUplinkIP.ToUpper(); EOSLogger.Debug("TerminalCorruptedUplinkConnect, not using uplink address, TerminalUplink: " + ((Object)terminal.UplinkPuzzle).ToString()); } if (!definition.UseUplinkAddress || param1 == terminal.UplinkPuzzle.TerminalUplinkIP) { if (corruptedUplinkReceiver.m_command.HasRegisteredCommand((TERM_Command)27)) { terminal.m_command.AddUplinkCorruptedOutput(); } else { terminal.m_command.AddUplinkCorruptedOutput(); terminal.m_command.AddOutput("", true); terminal.m_command.AddOutput((TerminalLineType)4, string.Format(Text.Get(3492863045u), corruptedUplinkReceiver.PublicName), 3f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput((TerminalLineType)0, Text.Get(2761366063u), 0.6f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput("", true); terminal.m_command.AddOutput((TerminalLineType)0, Text.Get(3435969025u), 0.8f, (TerminalSoundType)0, (TerminalSoundType)0); corruptedUplinkReceiver.m_command.AddCommand((TERM_Command)27, "UPLINK_CONFIRM", new LocalizedText { UntranslatedText = Text.Get(112719254u), Id = 0u }, (TERM_CommandRule)2); corruptedUplinkReceiver.m_command.AddOutput((TerminalLineType)0, string.Format(Text.Get(1173595354u), terminal.PublicName), 0f, (TerminalSoundType)0, (TerminalSoundType)0); } } else { terminal.m_command.AddUplinkWrongAddressError(param1); } return false; } } [HarmonyPatch] internal static class StartTerminalUplinkSequence { [HarmonyPrefix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "StartTerminalUplinkSequence")] private static bool Pre_LG_ComputerTerminalCommandInterpreter_StartTerminalUplinkSequence(LG_ComputerTerminalCommandInterpreter __instance, string uplinkIp, bool corrupted) { if (!corrupted) { LG_ComputerTerminal uplinkTerminal = __instance.m_terminal; if (uplinkTerminal.m_isWardenObjective) { return true; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(uplinkTerminal); uint zoneInstanceIndex = TerminalInstanceManager.Current.GetZoneInstanceIndex(uplinkTerminal); UplinkDefinition uplinkConfig2 = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); uplinkTerminal.m_command.AddOutput((TerminalLineType)4, string.Format(Text.Get(2583360288u), uplinkIp), 3f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.TerminalUplinkSequenceOutputs(uplinkTerminal, false); uplinkTerminal.m_command.OnEndOfQueue = Action.op_Implicit((Action)delegate { EOSLogger.Debug("UPLINK CONNECTION DONE!"); uplinkTerminal.UplinkPuzzle.Connected = true; uplinkTerminal.UplinkPuzzle.CurrentRound.ShowGui = true; uplinkTerminal.UplinkPuzzle.OnStartSequence(); uplinkConfig2.EventsOnCommence.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); int num2 = uplinkConfig2.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == 0); ((num2 != -1) ? uplinkConfig2.RoundOverrides[num2] : null)?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)1, false, 0f); }); }); } else { LG_ComputerTerminal terminal = __instance.m_terminal; LG_ComputerTerminal sender = __instance.m_terminal.CorruptedUplinkReceiver; if (sender.m_isWardenObjective) { return true; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex2 = TerminalInstanceManager.Current.GetGlobalZoneIndex(sender); uint zoneInstanceIndex2 = TerminalInstanceManager.Current.GetZoneInstanceIndex(sender); UplinkDefinition uplinkConfig = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex2, zoneInstanceIndex2); sender.m_command.AddOutput((TerminalLineType)4, string.Format(Text.Get(2056072887u), sender.PublicName), 3f, (TerminalSoundType)0, (TerminalSoundType)0); sender.m_command.AddOutput("", true); terminal.m_command.AddOutput((TerminalLineType)4, string.Format(Text.Get(2056072887u), sender.PublicName), 3f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput("", true); terminal.m_command.TerminalUplinkSequenceOutputs(sender, false); terminal.m_command.TerminalUplinkSequenceOutputs(terminal, true); terminal.m_command.OnEndOfQueue = Action.op_Implicit((Action)delegate { EOSLogger.Debug("UPLINK CONNECTION DONE!"); sender.UplinkPuzzle.Connected = true; sender.UplinkPuzzle.CurrentRound.ShowGui = true; sender.UplinkPuzzle.OnStartSequence(); uplinkConfig.EventsOnCommence.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); int num = uplinkConfig.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == 0); ((num != -1) ? uplinkConfig.RoundOverrides[num] : null)?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)1, false, 0f); }); }); } return false; } [HarmonyPostfix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "StartTerminalUplinkSequence")] private static void Post_LG_ComputerTerminalCommandInterpreter_StartTerminalUplinkSequence(LG_ComputerTerminalCommandInterpreter __instance, bool corrupted) { if (!corrupted) { LG_ComputerTerminal terminal = __instance.m_terminal; if (!terminal.m_isWardenObjective) { return; } UplinkDefinition uplinkConfig = UplinkObjectiveManager.Current.GetWardenDefinition(__instance.m_terminal); if (uplinkConfig == null) { return; } LG_ComputerTerminalCommandInterpreter command = terminal.m_command; command.OnEndOfQueue += Action.op_Implicit((Action)delegate { uplinkConfig.EventsOnCommence.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); int num2 = uplinkConfig.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == 0); ((num2 != -1) ? uplinkConfig.RoundOverrides[num2] : null)?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)1, false, 0f); }); }); return; } LG_ComputerTerminal terminal2 = __instance.m_terminal; LG_ComputerTerminal corruptedUplinkReceiver = __instance.m_terminal.CorruptedUplinkReceiver; if (!corruptedUplinkReceiver.m_isWardenObjective) { return; } UplinkDefinition uplinkConfig2 = UplinkObjectiveManager.Current.GetWardenDefinition(corruptedUplinkReceiver); if (uplinkConfig2 == null) { return; } LG_ComputerTerminalCommandInterpreter command2 = terminal2.m_command; command2.OnEndOfQueue += Action.op_Implicit((Action)delegate { uplinkConfig2.EventsOnCommence.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); int num = uplinkConfig2.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == 0); ((num != -1) ? uplinkConfig2.RoundOverrides[num] : null)?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)1, false, 0f); }); }); } } [HarmonyPatch] internal static class TerminalUplinkConnect { [HarmonyPrefix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalUplinkConnect")] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalUplinkConnect(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2, ref bool __result) { LG_ComputerTerminal terminal = __instance.m_terminal; if (terminal.m_isWardenObjective) { return true; } if (LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != 0 && LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != terminal.SyncID) { __instance.AddOngoingUplinkOutput(); return false; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(__instance.m_terminal); uint zoneInstanceIndex = TerminalInstanceManager.Current.GetZoneInstanceIndex(terminal); UplinkDefinition definition = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); if (!definition.UseUplinkAddress) { param1 = __instance.m_terminal.UplinkPuzzle.TerminalUplinkIP; } if (!definition.UseUplinkAddress || param1 == __instance.m_terminal.UplinkPuzzle.TerminalUplinkIP) { __instance.m_terminal.TrySyncSetCommandRule((TERM_Command)25, (TERM_CommandRule)1); if ((Object)(object)__instance.m_terminal.ChainedPuzzleForWardenObjective != (Object)null) { ChainedPuzzleInstance chainedPuzzleForWardenObjective = __instance.m_terminal.ChainedPuzzleForWardenObjective; chainedPuzzleForWardenObjective.OnPuzzleSolved += Action.op_Implicit((Action)delegate { __instance.StartTerminalUplinkSequence(param1, false); }); __instance.AddOutput("", true); __instance.AddOutput(Text.Get(3268596368u), true); __instance.AddOutput(Text.Get(3041541194u), true); if (SNet.IsMaster) { __instance.m_terminal.ChainedPuzzleForWardenObjective.AttemptInteract((eChainedPuzzleInteraction)0); } } else { __instance.StartTerminalUplinkSequence(param1, false); } __result = true; } else { __instance.AddUplinkWrongAddressError(param1); __result = false; } return false; } } [HarmonyPatch] internal static class TerminalUplinkSequenceOutput { [HarmonyPrefix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalUplinkSequenceOutputs")] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalUplinkSequenceOutputs(LG_ComputerTerminal terminal, bool corrupted) { if (terminal.m_isWardenObjective) { return true; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(terminal); uint zoneInstanceIndex = TerminalInstanceManager.Current.GetZoneInstanceIndex(terminal); UplinkDefinition definition = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); if (definition == null) { if (!((Object)(object)terminal.CorruptedUplinkReceiver != (Object)null)) { return true; } LG_ComputerTerminal corruptedUplinkReceiver = terminal.CorruptedUplinkReceiver; globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(corruptedUplinkReceiver); zoneInstanceIndex = TerminalInstanceManager.Current.GetZoneInstanceIndex(corruptedUplinkReceiver); definition = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); if (definition == null || definition.DisplayUplinkWarning) { return true; } } terminal.m_command.AddOutput((TerminalLineType)3, Text.Get(3418104670u), 3f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput("", true); if (!corrupted) { terminal.m_command.AddOutput(string.Format(Text.Get(947485599u), terminal.UplinkPuzzle.CurrentRound.CorrectPrefix), true); } return false; } } [HarmonyPatch] internal static class TerminalUplinkVerify { [HarmonyPrefix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalUplinkVerify")] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalUplinkVerify(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2, ref bool __result, out List<WardenObjectiveEventData> __state) { __state = null; if (__instance.m_terminal.m_isWardenObjective) { UplinkDefinition wardenDefinition = UplinkObjectiveManager.Current.GetWardenDefinition(__instance.m_terminal); if (wardenDefinition == null) { return true; } TerminalUplinkPuzzle puzzle = __instance.m_terminal.UplinkPuzzle; if (puzzle.Connected && !puzzle.Solved && puzzle.CurrentRound.CorrectCode.ToUpper() == param1.ToUpper()) { __state = wardenDefinition.RoundOverrides.Find((UplinkRound round) => round.RoundIndex == puzzle.m_roundIndex + 1)?.EventsOnRound; wardenDefinition.RoundOverrides.Find((UplinkRound round) => round.RoundIndex == puzzle.m_roundIndex)?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)2, false, 0f); }); } return true; } TerminalUplinkPuzzle uplinkPuzzle = __instance.m_terminal.UplinkPuzzle; (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(__instance.m_terminal); uint zoneInstanceIndex = TerminalInstanceManager.Current.GetZoneInstanceIndex(__instance.m_terminal); UplinkDefinition definition = UplinkObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); int CurrentRoundIndex = uplinkPuzzle.m_roundIndex; int num = definition.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == CurrentRoundIndex); UplinkRound roundOverride = ((num != -1) ? definition.RoundOverrides[num] : null); TimeSettings timeSettings = ((num != -1) ? roundOverride.OverrideTimeSettings : definition.DefaultTimeSettings); float num2 = ((timeSettings.TimeToStartVerify >= 0f) ? timeSettings.TimeToStartVerify : definition.DefaultTimeSettings.TimeToStartVerify); float timeToCompleteVerify = ((timeSettings.TimeToCompleteVerify >= 0f) ? timeSettings.TimeToCompleteVerify : definition.DefaultTimeSettings.TimeToCompleteVerify); float num3 = ((timeSettings.TimeToRestoreFromFail >= 0f) ? timeSettings.TimeToRestoreFromFail : definition.DefaultTimeSettings.TimeToRestoreFromFail); if (uplinkPuzzle.Connected) { __instance.AddOutput((TerminalLineType)3, Text.Get(2734004688u), num2, (TerminalSoundType)0, (TerminalSoundType)0); if (!uplinkPuzzle.Solved && uplinkPuzzle.CurrentRound.CorrectCode.ToUpper() == param1.ToUpper()) { __instance.AddOutput(string.Format(Text.Get(1221800228u), uplinkPuzzle.CurrentProgress), true); if (uplinkPuzzle.TryGoToNextRound()) { int newRoundIndex = uplinkPuzzle.m_roundIndex; int num4 = definition.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == newRoundIndex); UplinkRound newRoundOverride = ((num4 != -1) ? definition.RoundOverrides[num4] : null); roundOverride?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)2, false, 0f); }); if (roundOverride != null && (Object)(object)roundOverride.ChainedPuzzleToEndRoundInstance != (Object)null) { TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.UplinkTerminal.ScanRequiredToProgress"); if (block != null) { __instance.AddOutput((TerminalLineType)4, Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID), 0f, (TerminalSoundType)0, (TerminalSoundType)0); } ChainedPuzzleInstance chainedPuzzleToEndRoundInstance = roundOverride.ChainedPuzzleToEndRoundInstance; chainedPuzzleToEndRoundInstance.OnPuzzleSolved += Action.op_Implicit((Action)delegate { __instance.AddOutput((TerminalLineType)4, Text.Get(27959760u), timeToCompleteVerify, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); __instance.AddOutput(string.Format(Text.Get(4269617288u), uplinkPuzzle.CurrentProgress, uplinkPuzzle.CurrentRound.CorrectPrefix), true); __instance.OnEndOfQueue = Action.op_Implicit((Action)delegate { EOSLogger.Log("UPLINK VERIFICATION GO TO NEXT ROUND!"); uplinkPuzzle.CurrentRound.ShowGui = true; newRoundOverride?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)1, false, 0f); }); UplinkObjectiveManager.Current.ChangeState(__instance.m_terminal, new UplinkState { Status = UplinkStatus.InProgress, CurrentRoundIndex = uplinkPuzzle.m_roundIndex }); }); }); if (SNet.IsMaster) { roundOverride.ChainedPuzzleToEndRoundInstance.AttemptInteract((eChainedPuzzleInteraction)0); } } else { __instance.AddOutput((TerminalLineType)4, Text.Get(27959760u), timeToCompleteVerify, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); __instance.AddOutput(string.Format(Text.Get(4269617288u), uplinkPuzzle.CurrentProgress, uplinkPuzzle.CurrentRound.CorrectPrefix), true); __instance.OnEndOfQueue = Action.op_Implicit((Action)delegate { EOSLogger.Log("UPLINK VERIFICATION GO TO NEXT ROUND!"); uplinkPuzzle.CurrentRound.ShowGui = true; newRoundOverride?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)1, false, 0f); }); UplinkObjectiveManager.Current.ChangeState(__instance.m_terminal, new UplinkState { Status = UplinkStatus.InProgress, CurrentRoundIndex = uplinkPuzzle.m_roundIndex }); }); } } else { __instance.AddOutput((TerminalLineType)3, Text.Get(1780488547u), 3f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); __instance.OnEndOfQueue = Action.op_Implicit((Action)delegate { roundOverride?.EventsOnRound.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)2, false, 0f); }); uplinkPuzzle.CurrentRound.ShowGui = false; if (roundOverride != null && (Object)(object)roundOverride.ChainedPuzzleToEndRoundInstance != (Object)null) { ChainedPuzzleInstance chainedPuzzleToEndRoundInstance2 = roundOverride.ChainedPuzzleToEndRoundInstance; chainedPuzzleToEndRoundInstance2.OnPuzzleSolved += Action.op_Implicit((Action)delegate { __instance.AddOutput((TerminalLineType)0, string.Format(Text.Get(3928683780u), uplinkPuzzle.TerminalUplinkIP), 2f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); __instance.OnEndOfQueue = Action.op_Implicit((Action)delegate { EOSLogger.Error("UPLINK VERIFICATION SEQUENCE DONE!"); LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId = 0u; uplinkPuzzle.Solved = true; Action onPuzzleSolved2 = uplinkPuzzle.OnPuzzleSolved; if (onPuzzleSolved2 != null) { onPuzzleSolved2.Invoke(); } UplinkObjectiveManager.Current.ChangeState(__instance.m_terminal, new UplinkState { Status = UplinkStatus.Finished, CurrentRoundIndex = uplinkPuzzle.m_roundIndex }); }); }); if (SNet.IsMaster) { roundOverride.ChainedPuzzleToEndRoundInstance.AttemptInteract((eChainedPuzzleInteraction)0); } } else { __instance.AddOutput((TerminalLineType)0, string.Format(Text.Get(3928683780u), uplinkPuzzle.TerminalUplinkIP), 2f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); EOSLogger.Error("UPLINK VERIFICATION SEQUENCE DONE!"); LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId = 0u; uplinkPuzzle.Solved = true; Action onPuzzleSolved = uplinkPuzzle.OnPuzzleSolved; if (onPuzzleSolved != null) { onPuzzleSolved.Invoke(); } UplinkObjectiveManager.Current.ChangeState(__instance.m_terminal, new UplinkState { Status = UplinkStatus.Finished, CurrentRoundIndex = uplinkPuzzle.m_roundIndex }); } }); } } else if (uplinkPuzzle.Solved) { __instance.AddOutput("", true); __instance.AddOutput((TerminalLineType)1, Text.Get(4080876165u), 0f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput((TerminalLineType)0, Text.Get(4104839742u), 6f, (TerminalSoundType)0, (TerminalSoundType)0); } else { __instance.AddOutput("", true); __instance.AddOutput((TerminalLineType)1, string.Format(Text.Get(507647514u), uplinkPuzzle.CurrentRound.CorrectPrefix), 0f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput((TerminalLineType)0, Text.Get(4104839742u), num3, (TerminalSoundType)0, (TerminalSoundType)0); } } else { __instance.AddOutput("", true); __instance.AddOutput(Text.Get(403360908u), true); } __result = false; return false; } [HarmonyPostfix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalUplinkVerify")] private static void Post_LG_ComputerTerminalCommandInterpreter_TerminalUplinkVerify(LG_ComputerTerminalCommandInterpreter __instance, List<WardenObjectiveEventData> __state) { if (__state == null) { return; } __instance.OnEndOfQueue += Action.op_Implicit((Action)delegate { __state.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)1, false, 0f); }); }); } } [HarmonyPatch] internal static class UplinkGUI_Update { [HarmonyPostfix] [HarmonyPatch(typeof(LG_ComputerTerminal), "Update")] private static void Post_LG_ComputerTerminal_Update(LG_ComputerTerminal __instance) { if (!__instance.m_isWardenObjective && __instance.UplinkPuzzle != null) { __instance.UplinkPuzzle.UpdateGUI(false); } } } } namespace ExtraObjectiveSetup.Patches.PowerGenerator { [HarmonyPatch] internal static class Patch_LG_PowerGeneratorCluster { [HarmonyPostfix] [HarmonyPatch(typeof(LG_PowerGeneratorCluster), "Setup")] private static void Post_PowerGeneratorCluster_Setup(LG_PowerGeneratorCluster __instance) { uint instanceIndex = GeneratorClusterInstanceManager.Current.Register(__instance); (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = GeneratorClusterInstanceManager.Current.GetGlobalZoneIndex(__instance); GeneratorClusterDefinition definition = GeneratorClusterObjectiveManager.Current.GetDefinition(globalZoneIndex, instanceIndex); if (definition == null) { return; } EOSLogger.Debug("Found LG_PowerGeneratorCluster and its definition! Building this Generator cluster..."); __instance.m_serialNumber = SerialGenerator.GetUniqueSerialNo(); __instance.m_itemKey = "GENERATOR_CLUSTER_" + __instance.m_serialNumber; __instance.m_terminalItem = GOUtil.GetInterfaceFromComp<iTerminalItem>(__instance.m_terminalItemComp); __instance.m_terminalItem.Setup(__instance.m_itemKey, (AIG_CourseNode)null); __instance.m_terminalItem.FloorItemStatus = (eFloorInventoryObjectStatus)4; if (__instance.SpawnNode != null) { __instance.m_terminalItem.FloorItemLocation = __instance.SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7); } List<Transform> list = new List<Transform>((IEnumerable<Transform>)__instance.m_generatorAligns); uint numberOfGenerators = definition.NumberOfGenerators; __instance.m_generators = Il2CppReferenceArray<LG_PowerGenerator_Core>.op_Implicit((LG_PowerGenerator_Core[])(object)new LG_PowerGenerator_Core[numberOfGenerators]); if (list.Count >= numberOfGenerators) { for (int i = 0; i < numberOfGenerators; i++) { int index = Builder.BuildSeedRandom.Range(0, list.Count, "NO_TAG"); LG_PowerGenerator_Core val = GOUtil.SpawnChildAndGetComp<LG_PowerGenerator_Core>(__instance.m_generatorPrefab, list[index]); ((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)__instance.m_generators)[i] = val; val.SpawnNode = __instance.SpawnNode; PowerGeneratorInstanceManager.Current.MarkAsGCGenerator(__instance, val); val.Setup(); val.SetCanTakePowerCell(true); Debug.Log(Object.op_Implicit("Spawning generator at alignIndex: " + index)); list.RemoveAt(index); } } else { Debug.LogError(Object.op_Implicit("LG_PowerGeneratorCluster does NOT have enough generator aligns to support the warden objective! Has " + list.Count + " needs " + numberOfGenerators)); } __instance.ObjectiveItemSolved = true; if (definition.EndSequenceChainedPuzzle != 0) { GeneratorClusterObjectiveManager.Current.RegisterForChainedPuzzleBuild(__instance, definition); } } } [HarmonyPatch] internal static class Patch_LG_PowerGenerator_Core_SyncStatusChanged { [HarmonyPostfix] [HarmonyPatch(typeof(LG_PowerGenerator_Core), "SyncStatusChanged")] private static void Post_SyncStatusChanged(LG_PowerGenerator_Core __instance, pPowerGeneratorState state, bool isDropinState) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Invalid comparison between Unknown and I4 //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Invalid comparison between Unknown and I4 uint zoneInstanceIndex = PowerGeneratorInstanceManager.Current.GetZoneInstanceIndex(__instance); (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = PowerGeneratorInstanceManager.Current.GetGlobalZoneIndex(__instance); LG_PowerGeneratorCluster parentGeneratorCluster = PowerGeneratorInstanceManager.Current.GetParentGeneratorCluster(__instance); GeneratorClusterDefinition generatorClusterDefinition = null; if ((Object)(object)parentGeneratorCluster != (Object)null) { uint zoneInstanceIndex2 = GeneratorClusterInstanceManager.Current.GetZoneInstanceIndex(parentGeneratorCluster); (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex2 = GeneratorClusterInstanceManager.Current.GetGlobalZoneIndex(parentGeneratorCluster); generatorClusterDefinition = GeneratorClusterObjectiveManager.Current.GetDefinition(globalZoneIndex2, zoneInstanceIndex2); } ePowerGeneratorStatus status = state.status; if (generatorClusterDefinition != null) { EOSLogger.Log($"LG_PowerGeneratorCluster.powerGenerator.OnSyncStatusChanged! status: {status}, isDropinState: {isDropinState}"); if ((int)status == 0) { uint num = 0u; for (int i = 0; i < ((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)parentGeneratorCluster.m_generators).Length; i++) { if ((int)((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)parentGeneratorCluster.m_generators)[i].m_stateReplicator.State.status == 0) { num++; } } EOSLogger.Log($"Generator Cluster PowerCell inserted ({num} / {((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)parentGeneratorCluster.m_generators).Count})"); List<List<WardenObjectiveEventData>> eventsOnInsertCell = generatorClusterDefinition.EventsOnInsertCell; int num2 = (int)(num - 1); if (!isDropinState) { if (num2 >= 0 && num2 < eventsOnInsertCell.Count) { EOSLogger.Log($"Executing events ({num} / {((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)parentGeneratorCluster.m_generators).Count}). Event count: {eventsOnInsertCell[num2].Count}"); eventsOnInsertCell[num2].ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); } if (num == ((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)parentGeneratorCluster.m_generators).Count && !parentGeneratorCluster.m_endSequenceTriggered) { EOSLogger.Log("All generators powered, executing end sequence"); ((MonoBehaviour)__instance).StartCoroutine(parentGeneratorCluster.ObjectiveEndSequence()); parentGeneratorCluster.m_endSequenceTriggered = true; } } else if (num != ((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)parentGeneratorCluster.m_generators).Count) { parentGeneratorCluster.m_endSequenceTriggered = false; } } else if (isDropinState) { parentGeneratorCluster.m_endSequenceTriggered = false; } } IndividualGeneratorDefinition definition = IndividualGeneratorObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); if (definition != null && definition.EventsOnInsertCell != null && (int)status == 0 && !isDropinState) { definition.EventsOnInsertCell.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); } ExpeditionIGGroup expeditionIGGroup = ExpeditionIGGroupManager.Current.FindGroupDefOf(__instance); if (expeditionIGGroup == null) { return; } int num3 = 0; foreach (LG_PowerGenerator_Core generatorInstance in expeditionIGGroup.GeneratorInstances) { if ((int)generatorInstance.m_stateReplicator.State.status == 0) { num3++; } } if (isDropinState) { return; } if (num3 == expeditionIGGroup.GeneratorInstances.Count && expeditionIGGroup.PlayEndSequenceOnGroupComplete) { Coroutine val = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ExpeditionIGGroupManager.PlayGroupEndSequence(expeditionIGGroup)), (Action)null); WorldEventManager.m_worldEventEventCoroutines.Add(val); return; } int num4 = num3 - 1; if (num4 >= 0 && num4 < expeditionIGGroup.EventsOnInsertCell.Count) { expeditionIGGroup.EventsOnInsertCell[num4].ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); } } } [HarmonyPatch] internal static class Patch_LG_PowerGenerator_Core_Setup { [HarmonyPostfix] [HarmonyPatch(typeof(LG_PowerGenerator_Core), "Setup")] private static void Post_PowerGenerator_Setup(LG_PowerGenerator_Core __instance) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) iCarryItemInteractionTarget powerCellInteraction = __instance.m_powerCellInteraction; powerCellInteraction.AttemptCarryItemInsert += Action<SNet_Player, Item>.op_Implicit((Action<SNet_Player, Item>)delegate(SNet_Player p, Item item) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Item val2 = default(Item); if (PlayerBackpackManager.TryGetItemInLevelFromItemData(item.Get_pItemData(), ref val2)) { ItemInLevel val3 = ((Il2CppObjectBase)val2).Cast<ItemInLevel>(); val3.CanWarp = false; } else { EOSLogger.Error($"Inserting sth other than PowerCell ({item.PublicName}) into {__instance.m_itemKey}, how?"); } }); if (PowerGeneratorInstanceManager.Current.IsGCGenerator(__instance)) { return; } uint num = PowerGeneratorInstanceManager.Current.Register(__instance); (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = PowerGeneratorInstanceManager.Current.GetGlobalZoneIndex(__instance); IndividualGeneratorDefinition definition = IndividualGeneratorObjectiveManager.Current.GetDefinition(globalZoneIndex, num); if (definition != null) { Vector3 val = definition.Position.ToVector3(); Quaternion rotation = definition.Rotation.ToQuaternion(); if (val != Vector3.zero) { ((Component)__instance).transform.position = val; ((Component)__instance).transform.rotation = rotation; __instance.m_sound.UpdatePosition(val); EOSLogger.Debug("LG_PowerGenerator_Core: modified position / rotation"); } if (definition.ForceAllowPowerCellInsertion) { __instance.SetCanTakePowerCell(true); } EOSLogger.Debug($"LG_PowerGenerator_Core: overriden, instance {num} in {globalZoneIndex}"); } } [HarmonyPostfix] [HarmonyPatch(typeof(LG_PowerGenerator_Core), "SyncStatusChanged")] private static void Post_SyncStatusChanged(LG_PowerGenerator_Core __instance, pPowerGeneratorState state, bool isDropinState) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 uint zoneInstanceIndex = PowerGeneratorInstanceManager.Current.GetZoneInstanceIndex(__instance); (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = PowerGeneratorInstanceManager.Current.GetGlobalZoneIndex(__instance); IndividualGeneratorDefinition definition = IndividualGeneratorObjectiveManager.Current.GetDefinition(globalZoneIndex, zoneInstanceIndex); if (!(definition == null || definition.EventsOnInsertCell == null || (int)state.status > 0 || isDropinState) && definition.EventsOnInsertCell.Count > 0) { definition.EventsOnInsertCell.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); } } } } namespace ExtraObjectiveSetup.Patches.Terminal { [HarmonyPatch] internal static class Patch_FixHiddenCommandExecution { [HarmonyPrefix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")] private static void Pre_TerminalInterpreter_ReceiveCommand(LG_ComputerTerminalCommandInterpreter __instance, ref TERM_Command cmd) { //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_0006: 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_00ba: Expected I4, but got Unknown TERM_Command val = cmd; TERM_Command val2 = val; switch (val2 - 1) { case 0: case 1: case 2: case 3: case 11: case 13: case 14: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 31: case 32: case 33: case 42: if (__instance.m_terminal.CommandIsHidden(cmd)) { cmd = (TERM_Command)10; } break; case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 12: case 15: case 16: case 29: case 30: case 34: case 35: case 36: case 37: case 38: case 39: case 40: case 41: break; } } } [HarmonyPatch] internal static class Patch_FixReactorTerminalNullSpawnNode { [HarmonyPrefix] [HarmonyWrapSafe] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static bool Pre(LG_ComputerTerminal __instance, ref AIG_CourseNode __result) { if ((Object)(object)__instance.ConnectedReactor != (Object)null && __instance.m_terminalItem.SpawnNode == null) { __result = __instance.ConnectedReactor.SpawnNode; return false; } return true; } } [HarmonyPatch] internal static class Patch_FixRepeatablePuzzleBugs { [HarmonyPrefix] [HarmonyPatch(typeof(CP_Cluster_Core), "OnSyncStateChange")] private static bool Pre_CheckEventsOnPuzzleSolved(CP_Cluster_Core __instance, eClusterStatus newStatus, bool isDropinState) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 pClusterState currentState = __instance.m_sync.GetCurrentState(); if (isDropinState && (int)newStatus == 3) { __instance.m_spline.SetVisible(false); for (int i = 0; i < ((Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores).Length; i++) { ((Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores)[i].Deactivate(); } return false; } if (!isDropinState && (int)currentState.status == 3 && (int)newStatus == 1) { __instance.m_spline.Reveal(0f); return false; } return true; } } [HarmonyPatch] internal static class Patch_LG_ComputerTerminal_Setup { [HarmonyPostfix] [HarmonyPatch(typeof(LG_ComputerTerminal), "Setup")] private static void Post_LG_ComputerTerminal_Setup(LG_ComputerTerminal __instance) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) uint instanceIndex = TerminalInstanceManager.Current.Register(__instance); TerminalInstanceManager.Current.SetupTerminalWrapper(__instance); if (__instance.SpawnNode == null) { return; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = TerminalInstanceManager.Current.GetGlobalZoneIndex(__instance); TerminalPosition definition = TerminalPositionOverrideManager.Current.GetDefinition(globalZoneIndex, instanceIndex); if (definition != null) { if (definition.Position.ToVector3() != Vector3.zeroVector) { ((Component)__instance).transform.position = definition.Position.ToVector3(); ((Component)__instance).transform.rotation = definition.Rotation.ToQuaternion(); } EOSLogger.Debug($"TerminalPositionOverride: {definition.LocalIndex}, {definition.LayerType}, {definition.DimensionIndex}, TerminalIndex {definition.InstanceIndex}"); } } [HarmonyPostfix] [HarmonyPatch(typeof(LG_ComputerTerminal), "SetupAsWardenObjectiveTerminalUplink")] [HarmonyPatch(typeof(LG_ComputerTerminal), "SetupAsWardenObjectiveCorruptedTerminalUplink")] private static void Post_LG_ComputerTerminal_UplinkSetup(LG_ComputerTerminal __instance) { TerminalInstanceManager.Current.RegisterWardenUplink(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(TerminalUplinkPuzzle), "Setup")] private static void Post_LG_ComputerTerminal_SyncedPuzzle(TerminalUplinkPuzzle __instance, LG_ComputerTerminal terminal) { if (!terminal.m_isWardenObjective) { return; } UplinkDefinition def = UplinkObjectiveManager.Current.GetWardenDefinition(terminal); if (def == null) { return; } __instance.OnPuzzleSolved += Action.op_Implicit((Action)delegate { def.EventsOnComplete?.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); }); } } [HarmonyPatch] internal static class Patch_RepeatableCommandEventFix { [HarmonyPostfix] [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "SetupCommandEvents")] private static void Post_ResetRepeatableUniqueCommandChainedPuzzle(LG_ComputerTerminalCommandInterpreter __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) LG_ComputerTerminal terminal = __instance.m_terminal; ChainedPuzzleInstance val = default(ChainedPuzzleInstance); foreach (TERM_Command uNIQUE_CMD in TerminalInstanceManager.UNIQUE_CMDS) { if (!__instance.m_commandsPerEnum.ContainsKey(uNIQUE_CMD)) { continue; } string text = __instance.m_commandsPerEnum[uNIQUE_CMD]; if ((int)__instance.m_terminal.GetCommandRule(uNIQUE_CMD) > 0) { continue; } List<WardenObjectiveEventData> uniqueCommandEvents = __instance.m_terminal.GetUniqueCommandEvents(text); for (int i = 0; i < uniqueCommandEvents.Count; i++) { if (uniqueCommandEvents[i].ChainPuzzle != 0) { if (__instance.m_terminal.TryGetChainPuzzleForCommand(uNIQUE_CMD, i, ref val) && (Object)(object)val != (Object)null) { ChainedPuzzleInstance obj = val; obj.OnPuzzleSolved += Action.op_Implicit((Action)val.ResetProgress); } EOSLogger.Debug($"TerminalTweak: {terminal.ItemKey}, command {text} set to be repeatable!"); } } } } } } namespace ExtraObjectiveSetup.Patches.LGFactory { [HarmonyPatch] internal class Patch_LG_Factory_NextBatch { [HarmonyPrefix] [HarmonyWrapSafe] [HarmonyPatch(typeof(LG_Factory), "NextBatch")] private static void Prefix(LG_Factory __instance) { //IL_0010: 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_001b: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_batchStep > -1) { BatchName currentBatchName = __instance.m_currentBatchName; BatchBuildManager.Current.Get_OnBatchDone(currentBatchName)?.Invoke(); } } [HarmonyPostfix] [HarmonyWrapSafe] [HarmonyPatch(typeof(LG_Factory), "NextBatch")] private static void Postfix(LG_Factory __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) BatchBuildManager.Current.Get_OnBatchStart(__instance.m_currentBatchName)?.Invoke(); } } } namespace ExtraObjectiveSetup.Patches.HSUActivator { [HarmonyPatch] internal class SetupFromCustomGeomorph { [HarmonyPostfi
plugins/Vega/Custom/_crisplugins/ScanPosOverride.dll
Decompiled 18 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; using System.Threading; using AIGraph; using Agents; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using ChainedPuzzles; using GTFO.API; using GTFO.API.Extensions; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Text; using LevelGeneration; using Localization; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using ScanPosOverride.Component; using ScanPosOverride.JSON; using ScanPosOverride.JSON.Extensions; using ScanPosOverride.JSON.PData; using ScanPosOverride.Managers; using ScanPosOverride.PuzzleOverrideData; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ScanPosOverride")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ScanPosOverride")] [assembly: AssemblyTitle("ScanPosOverride")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } [CompilerGenerated] [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 ScanPosOverride { internal static class SPOLogger { private static readonly ManualLogSource logger = Logger.CreateLogSource("ScanPosOverride"); 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 void Log(BepInExDebugLogInterpolatedStringHandler logHandler) { logger.LogDebug(logHandler); } } [BepInPlugin("ScanPositionOverride", "ScanPositionOverride", "1.6.10")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal sealed class Plugin : BasePlugin { [CompilerGenerated] private static class <>O { public static LiveEditEventHandler <0>__LiveEdit_FileChanged; } private static Dictionary<uint, Dictionary<uint, PuzzleOverride>> PuzzleOverrides = new Dictionary<uint, Dictionary<uint, PuzzleOverride>>(); public static readonly string OVERRIDE_SCAN_POS_PATH = Path.Combine(MTFOPathAPI.CustomPath, "ScanPositionOverrides"); private static LiveEditListener listener = null; private static Harmony m_Harmony = null; public override void Load() { //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Expected O, but got Unknown //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown SPOLogger.Error(OVERRIDE_SCAN_POS_PATH); if (!Directory.Exists(OVERRIDE_SCAN_POS_PATH)) { Directory.CreateDirectory(OVERRIDE_SCAN_POS_PATH); StreamWriter streamWriter = File.CreateText(Path.Combine(OVERRIDE_SCAN_POS_PATH, "Template.json")); streamWriter.WriteLine(Json.Serialize(new PuzzleOverrideJsonFile())); streamWriter.Flush(); streamWriter.Close(); return; } foreach (string item in Directory.EnumerateFiles(OVERRIDE_SCAN_POS_PATH, "*.json", SearchOption.AllDirectories)) { Json.Load<PuzzleOverrideJsonFile>(item, out var config); if (PuzzleOverrides.ContainsKey(config.MainLevelLayout)) { SPOLogger.Warning("Duplicate MainLevelLayout {0}, won't load.", config.MainLevelLayout); continue; } Dictionary<uint, PuzzleOverride> dictionary = new Dictionary<uint, PuzzleOverride>(); foreach (PuzzleOverride puzzle in config.Puzzles) { if (dictionary.ContainsKey(puzzle.Index)) { SPOLogger.Error("Duplicate Puzzle Override found. MainLevelLayout {0}, Index {1}.", config.MainLevelLayout, puzzle.Index); continue; } puzzle.EventsOnBioscanProgress.RemoveAll((BioscanProgressEvent e) => e.Progress <= 0f); puzzle.EventsOnBioscanProgress.Sort((BioscanProgressEvent e1, BioscanProgressEvent e2) => Mathf.RoundToInt(e1.Progress - e2.Progress)); dictionary.Add(puzzle.Index, puzzle); } PuzzleOverrides.Add(config.MainLevelLayout, dictionary); } listener = LiveEdit.CreateListener(OVERRIDE_SCAN_POS_PATH, "*.json", true); LiveEditListener obj = listener; object obj2 = <>O.<0>__LiveEdit_FileChanged; if (obj2 == null) { LiveEditEventHandler val = LiveEdit_FileChanged; <>O.<0>__LiveEdit_FileChanged = val; obj2 = (object)val; } obj.FileChanged += (LiveEditEventHandler)obj2; m_Harmony = new Harmony("ScanPosOverride.Patches"); m_Harmony.PatchAll(); } private static void LiveEdit_FileChanged(LiveEditEventArgs e) { SPOLogger.Warning("LiveEdit File Changed: " + e.FullPath + "."); LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content) { PuzzleOverrideJsonFile puzzleOverrideJsonFile = Json.Deserialize<PuzzleOverrideJsonFile>(content); if (!PuzzleOverrides.ContainsKey(puzzleOverrideJsonFile.MainLevelLayout)) { SPOLogger.Warning("MainLevelLayout not found, which is now not supported. Will not replace."); } else { Dictionary<uint, PuzzleOverride> dictionary = PuzzleOverrides[puzzleOverrideJsonFile.MainLevelLayout]; dictionary.Clear(); foreach (PuzzleOverride puzzle in puzzleOverrideJsonFile.Puzzles) { if (dictionary.ContainsKey(puzzle.Index)) { SPOLogger.Error("Duplicate Puzzle Override found. MainLevelLayout {0}, Index {1}.", puzzleOverrideJsonFile.MainLevelLayout, puzzle.Index); } else { puzzle.EventsOnBioscanProgress.Sort((BioscanProgressEvent bioscanProgressEvent, BioscanProgressEvent bioscanProgressEvent2) => Mathf.RoundToInt(bioscanProgressEvent.Progress - bioscanProgressEvent2.Progress)); dictionary.Add(puzzle.Index, puzzle); } } SPOLogger.Warning("Replaced Override Puzzle with MainLevelLayout {0}", puzzleOverrideJsonFile.MainLevelLayout); } }); } internal static PuzzleOverride GetOverride(uint mainLevelLayout, uint puzzleIndex) { if (!PuzzleOverrides.ContainsKey(mainLevelLayout)) { return null; } Dictionary<uint, PuzzleOverride> dictionary = PuzzleOverrides[mainLevelLayout]; if (!dictionary.ContainsKey(puzzleIndex)) { return null; } return dictionary[puzzleIndex]; } } public static class Utils { } } namespace ScanPosOverride.PuzzleOverrideData { internal sealed class PuzzleOverrideJsonFile { public uint MainLevelLayout { get; set; } public List<PuzzleOverride> Puzzles { get; set; } = new List<PuzzleOverride> { new PuzzleOverride() }; } public class BioscanProgressEvent { public float Progress { get; set; } = -1f; public List<WardenObjectiveEventData> Events { get; set; } = new List<WardenObjectiveEventData>(); } public class ClusterProgressEvent { public int Count { get; set; } = -1; public List<WardenObjectiveEventData> Events { get; set; } = new List<WardenObjectiveEventData>(); } public class PuzzleOverride { public uint Index { get; set; } public Vec3 Position { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); public bool HideSpline { get; set; } = false; public Vec3 PrevPosOverride { get; set; } = new Vec3(); public uint PrevPosOverrideIndex { get; set; } = 0u; public bool ConcurrentCluster { get; set; } = false; public HashSet<uint> PrerequiredScanIndices { get; set; } = new HashSet<uint>(); public float TMoveSpeedMulti { get; set; } = -1f; public List<BioscanProgressEvent> EventsOnBioscanProgress { get; set; } = new List<BioscanProgressEvent> { new BioscanProgressEvent() }; public List<ClusterProgressEvent> EventsOnClusterProgress { get; set; } = new List<ClusterProgressEvent> { new ClusterProgressEvent() }; public List<Vec3> TPositions { get; set; } = new List<Vec3> { new Vec3() }; public List<int> RequiredItemsIndices { get; set; } = new List<int> { 0 }; public List<WardenObjectiveEventData> EventsOnPuzzleSolved { get; set; } = new List<WardenObjectiveEventData>(); } public class Vec3 { public float x { get; set; } public float y { get; set; } public float z { get; set; } public Vector3 ToVector3() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, z); } public Quaternion ToQuaternion() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(x, y, z); } } } namespace ScanPosOverride.Patches { [HarmonyPatch] internal static class Patch_CP_BasicMovable_TryGetNextIndex { } [HarmonyPatch] internal static class Patch_CP_Bioscan_Core_OnSyncStateChange { private static Dictionary<IntPtr, int> EOPIndex; private static Dictionary<IntPtr, List<PlayerAgent>> LastPlayersInScan; private static Dictionary<uint, List<uint>> DependentScansByPrereq; private static int DependentIndexRegisteredScanCount; static Patch_CP_Bioscan_Core_OnSyncStateChange() { EOPIndex = new Dictionary<IntPtr, int>(); LastPlayersInScan = new Dictionary<IntPtr, List<PlayerAgent>>(); DependentScansByPrereq = new Dictionary<uint, List<uint>>(); DependentIndexRegisteredScanCount = -1; LevelAPI.OnBuildStart += ClearCaches; LevelAPI.OnLevelCleanup += ClearCaches; } private static void ClearCaches() { EOPIndex.Clear(); LastPlayersInScan.Clear(); DependentScansByPrereq.Clear(); DependentIndexRegisteredScanCount = -1; } [HarmonyPostfix] [HarmonyPatch(typeof(CP_Bioscan_Core), "OnSyncStateChange")] private static void Post_OnSyncStateChanged_CheckEOPAndEventsOnPuzzleSolved(CP_Bioscan_Core __instance, float progress, eBioscanStatus status, List<PlayerAgent> playersInScan, bool isDropinState) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 if ((int)status == 4 && !isDropinState) { uint bioscanCoreOverrideIndex = PuzzleOverrideManager.Current.GetBioscanCoreOverrideIndex(__instance); if (PuzzleOverrideManager.CompletedScans.Add(bioscanCoreOverrideIndex)) { RefreshScansWaitingForPrereq(bioscanCoreOverrideIndex); } } uint bioscanCoreOverrideIndex2 = PuzzleOverrideManager.Current.GetBioscanCoreOverrideIndex(__instance); PuzzleOverride def = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, bioscanCoreOverrideIndex2); if (def != null) { if (def.EventsOnBioscanProgress.Count > 0) { CheckBioscanEventsOnProgress(); } if ((int)status == 4 && !isDropinState && def.EventsOnPuzzleSolved.Count > 0) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(def.EventsOnPuzzleSolved), (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } void CheckBioscanEventsOnProgress() { if (!EOPIndex.ContainsKey(((Il2CppObjectBase)__instance).Pointer)) { EOPIndex[((Il2CppObjectBase)__instance).Pointer] = 0; } int num = EOPIndex[((Il2CppObjectBase)__instance).Pointer]; if (isDropinState) { for (num = 0; num < def.EventsOnBioscanProgress.Count; num++) { BioscanProgressEvent bioscanProgressEvent = def.EventsOnBioscanProgress[num]; if (bioscanProgressEvent.Progress > progress) { break; } } EOPIndex[((Il2CppObjectBase)__instance).Pointer] = num; } else if (num < def.EventsOnBioscanProgress.Count) { BioscanProgressEvent bioscanProgressEvent2 = def.EventsOnBioscanProgress[num]; if (bioscanProgressEvent2.Progress < progress) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(def.EventsOnBioscanProgress[num].Events), (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); EOPIndex[((Il2CppObjectBase)__instance).Pointer] = num + 1; } } } } [HarmonyPostfix] [HarmonyPatch(typeof(CP_Bioscan_Core), "OnSyncStateChange")] private static void Post_OnSyncStateChanged_CheckPrereqsAndConcurrentCluster(CP_Bioscan_Core __instance, float progress, eBioscanStatus status, List<PlayerAgent> playersInScan, bool isDropinState) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Invalid comparison between Unknown and I4 //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Invalid comparison between Unknown and I4 //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Invalid comparison between Unknown and I4 //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Invalid comparison between Unknown and I4 //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Invalid comparison between Unknown and I4 //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Invalid comparison between Unknown and I4 //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Invalid comparison between Unknown and I4 //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Invalid comparison between Unknown and I4 //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Invalid comparison between Unknown and I4 //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) if (playersInScan != null) { LastPlayersInScan[((Il2CppObjectBase)__instance).Pointer] = playersInScan; } bool flag = PlayerScannerManager.Current.IsConcurrentCluster(__instance); uint bioscanCoreOverrideIndex = PuzzleOverrideManager.Current.GetBioscanCoreOverrideIndex(__instance); PuzzleOverride puzzleOverride = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, bioscanCoreOverrideIndex); if (puzzleOverride == null) { return; } bool flag2 = false; if (puzzleOverride != null && puzzleOverride.PrerequiredScanIndices.Count > 0) { foreach (uint prerequiredScanIndex in puzzleOverride.PrerequiredScanIndices) { if (!PuzzleOverrideManager.CompletedScans.Contains(prerequiredScanIndex)) { flag2 = true; break; } } } if (flag && __instance.m_reqItemsEnabled) { SPOLogger.Warning($"OnSyncStateChange: status - {status}, playersInScan - {playersInScan.Count}, progress: {progress}"); } if (flag2) { } if ((int)status != 3) { if (flag) { if ((int)status == 4) { CP_Cluster_Core val = ((Il2CppObjectBase)__instance.Owner).TryCast<CP_Cluster_Core>(); if ((Object)(object)val == (Object)null) { SPOLogger.Error("Cannot find parent cluster core! The concurrent cluster may fail!"); } else { PlayerScannerManager.Current.CompleteConcurrentCluster(val, __instance); } } else { PlayerScannerManager.Current.CCShouldProgress(__instance, IsThisScanShouldProgress: false); } } if (__instance.m_reqItemsEnabled) { __instance.m_graphics.SetColorMode((eChainedPuzzleGraphicsColorMode)((!__instance.m_hasAlarm) ? 1 : 4)); } } else { if (!__instance.IsMovable && !flag && !__instance.m_reqItemsEnabled && puzzleOverride.PrerequiredScanIndices.Count <= 0) { return; } CP_PlayerScanner cacheScanner = PlayerScannerManager.Current.GetCacheScanner(__instance); if ((Object)(object)cacheScanner == (Object)null) { return; } int count = playersInScan.Count; List<PlayerAgent> playerAgentsInLevel = PlayerManager.PlayerAgentsInLevel; float num = 0f; float[] cacheOriginalScanSpeed = PlayerScannerManager.Current.GetCacheOriginalScanSpeed(__instance); if ((int)__instance.m_playerScanner.ScanPlayersRequired == 0) { num = ((count <= 0) ? 0f : cacheOriginalScanSpeed[count - 1]); } else if (((int)cacheScanner.m_playerRequirement == 1 && count == playerAgentsInLevel.Count) || ((int)cacheScanner.m_playerRequirement == 2 && count == 1)) { num = cacheOriginalScanSpeed[0]; } bool flag3 = num > 0f; if (flag3) { if (cacheScanner.m_reqItemsEnabled) { for (int i = 0; i < ((Il2CppArrayBase<iWardenObjectiveItem>)(object)cacheScanner.m_reqItems).Length; i++) { Vector3 val2 = Vector3.zero; if ((int)((Il2CppArrayBase<iWardenObjectiveItem>)(object)cacheScanner.m_reqItems)[i].PickupItemStatus == 0) { val2 = ((Il2CppArrayBase<iWardenObjectiveItem>)(object)cacheScanner.m_reqItems)[i].transform.position; } else if ((int)((Il2CppArrayBase<iWardenObjectiveItem>)(object)cacheScanner.m_reqItems)[i].PickupItemStatus == 1) { if ((Object)(object)((Il2CppArrayBase<iWardenObjectiveItem>)(object)cacheScanner.m_reqItems)[i].PickedUpByPlayer != (Object)null) { val2 = ((Agent)((Il2CppArrayBase<iWardenObjectiveItem>)(object)cacheScanner.m_reqItems)[i].PickedUpByPlayer).Position; } else { Debug.LogError(Object.op_Implicit("Playerscanner is looking for an item that has ePickupItemStatus.PickedUp but null player, how come!?")); } } Vector3 val3 = ((Component)cacheScanner).transform.position - val2; if (((Vector3)(ref val3)).sqrMagnitude >= cacheScanner.m_scanRadiusSqr) { flag3 = false; break; } } } if (flag2) { flag3 = false; } } if (flag) { if (flag3) { flag3 = PlayerScannerManager.Current.CCShouldProgress(__instance, IsThisScanShouldProgress: true); } else { PlayerScannerManager.Current.CCShouldProgress(__instance, IsThisScanShouldProgress: false); } } if (flag3) { if (flag) { CP_Cluster_Core parent = ((Il2CppObjectBase)__instance.Owner).Cast<CP_Cluster_Core>(); PlayerScannerManager.Current.RestoreCCScanSpeed(parent); } if (__instance.IsMovable) { __instance.m_movingComp.ResumeMovement(); } if (cacheScanner.m_reqItemsEnabled) { if ((int)cacheScanner.m_playerRequirement == 0) { ((Il2CppArrayBase<float>)(object)cacheScanner.m_scanSpeeds)[0] = ((count > 0) ? cacheOriginalScanSpeed[count - 1] : 0f); } __instance.m_graphics.SetColorMode((eChainedPuzzleGraphicsColorMode)(__instance.m_hasAlarm ? 5 : 2)); } if (puzzleOverride.PrerequiredScanIndices.Count > 0) { for (int j = 0; j < ((Il2CppArrayBase<float>)(object)cacheScanner.m_scanSpeeds).Length; j++) { ((Il2CppArrayBase<float>)(object)cacheScanner.m_scanSpeeds)[j] = cacheOriginalScanSpeed[j]; } __instance.m_graphics.SetColorMode((eChainedPuzzleGraphicsColorMode)(__instance.m_hasAlarm ? 5 : 2)); } return; } if (flag) { CP_Cluster_Core parent2 = ((Il2CppObjectBase)__instance.Owner).Cast<CP_Cluster_Core>(); PlayerScannerManager.Current.ZeroCCScanSpeed(parent2); } if (__instance.IsMovable) { __instance.m_movingComp.PauseMovement(); } if (cacheScanner.m_reqItemsEnabled) { if ((int)cacheScanner.m_playerRequirement == 0) { PlayerScannerManager.Current.GetCacheOriginalScanSpeed(__instance); ((Il2CppArrayBase<float>)(object)cacheScanner.m_scanSpeeds)[0] = 0f; } __instance.m_graphics.SetColorMode((eChainedPuzzleGraphicsColorMode)((!__instance.m_hasAlarm) ? 1 : 4)); } if (flag2) { for (int k = 0; k < ((Il2CppArrayBase<float>)(object)cacheScanner.m_scanSpeeds).Length; k++) { ((Il2CppArrayBase<float>)(object)cacheScanner.m_scanSpeeds)[k] = 0f; } __instance.m_graphics.SetColorMode((eChainedPuzzleGraphicsColorMode)((!__instance.m_hasAlarm) ? 1 : 4)); } } } private static void RefreshScansWaitingForPrereq(uint completedScanIndex) { RebuildDependentScanIndexIfNeeded(); if (!DependentScansByPrereq.TryGetValue(completedScanIndex, out var value)) { return; } foreach (uint item in value) { if (item != completedScanIndex && !PuzzleOverrideManager.CompletedScans.Contains(item)) { CP_Bioscan_Core bioscanCore = PuzzleOverrideManager.Current.GetBioscanCore(item); if (!((Object)(object)bioscanCore == (Object)null) && LastPlayersInScan.TryGetValue(((Il2CppObjectBase)bioscanCore).Pointer, out var value2) && value2 != null && value2.Count > 0) { Post_OnSyncStateChanged_CheckPrereqsAndConcurrentCluster(bioscanCore, 0f, (eBioscanStatus)3, value2, isDropinState: false); } } } } private static void RebuildDependentScanIndexIfNeeded() { int registeredBioscanCoreCount = PuzzleOverrideManager.Current.GetRegisteredBioscanCoreCount(); if (DependentIndexRegisteredScanCount == registeredBioscanCoreCount) { return; } DependentScansByPrereq.Clear(); DependentIndexRegisteredScanCount = registeredBioscanCoreCount; foreach (KeyValuePair<uint, CP_Bioscan_Core> registeredBioscanCore in PuzzleOverrideManager.Current.GetRegisteredBioscanCores()) { uint key = registeredBioscanCore.Key; PuzzleOverride puzzleOverride = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, key); if (puzzleOverride == null || puzzleOverride.PrerequiredScanIndices == null || puzzleOverride.PrerequiredScanIndices.Count <= 0) { continue; } foreach (uint prerequiredScanIndex in puzzleOverride.PrerequiredScanIndices) { if (!DependentScansByPrereq.TryGetValue(prerequiredScanIndex, out var value)) { value = new List<uint>(); DependentScansByPrereq.Add(prerequiredScanIndex, value); } value.Add(key); } } } } [HarmonyPatch] internal class Patch_CP_Bioscan_Core_Setup { [HarmonyPrefix] [HarmonyPatch(typeof(CP_Bioscan_Core), "Setup")] private static void Pre_CP_Bioscan_Core_Setup(CP_Bioscan_Core __instance, int puzzleIndex, iChainedPuzzleOwner owner, ref Vector3 prevPuzzlePos, ref bool revealWithHoloPath, ref bool onlyShowHUDWhenPlayerIsClose) { //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) ChainedPuzzleInstance val = ((Il2CppObjectBase)owner).TryCast<ChainedPuzzleInstance>(); uint num = PuzzleOverrideManager.Current.Register(__instance); PuzzleOverride puzzleOverride = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, num); if ((Object)(object)val != (Object)null) { bool flag = false; if (puzzleOverride != null) { if (puzzleOverride.PrevPosOverride.ToVector3() != Vector3.zero) { prevPuzzlePos = puzzleOverride.PrevPosOverride.ToVector3(); flag = true; } else if (puzzleOverride.PrevPosOverrideIndex != 0) { CP_Bioscan_Core bioscanCore = PuzzleOverrideManager.Current.GetBioscanCore(puzzleOverride.PrevPosOverrideIndex); ? val2; if (bioscanCore == null) { CP_Cluster_Core clusterCore = PuzzleOverrideManager.Current.GetClusterCore(puzzleOverride.PrevPosOverrideIndex); val2 = ((clusterCore != null) ? ((Component)clusterCore).transform.position : Vector3.zero); } else { val2 = bioscanCore.m_position; } Vector3 val3 = (Vector3)val2; if (val3 == Vector3.zero) { SPOLogger.Error($"PuzzleOverrideIndex: {num} - trying to use 'PrevPosOverrideIndex' ({puzzleOverride.PrevPosOverrideIndex}) but the puzzle is not found."); SPOLogger.Error($"The puzzle is probably yet registered. NOTE: 'PrevPosOverrideIndex' could only be a integer that is less than PuzzleOverrideIndex({num})"); flag = false; } else { prevPuzzlePos = val3; flag = true; } } } if (!flag && puzzleIndex != 0) { CP_Bioscan_Core val4 = ((Il2CppObjectBase)((Il2CppArrayBase<iChainedPuzzleCore>)(object)val.m_chainedPuzzleCores)[puzzleIndex - 1]).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val4 != (Object)null) { prevPuzzlePos = ((Component)val4).transform.position; } else { CP_Cluster_Core val5 = ((Il2CppObjectBase)((Il2CppArrayBase<iChainedPuzzleCore>)(object)val.m_chainedPuzzleCores)[puzzleIndex - 1]).TryCast<CP_Cluster_Core>(); if ((Object)(object)val5 == (Object)null) { SPOLogger.Error($"Cannot cast m_chainedPuzzleCores[{puzzleIndex - 1}] to neither CP_Bioscan_Core or CP_Cluster_Core! WTF???"); } else { prevPuzzlePos = ((Component)val5).transform.position; } } } } else { CP_Cluster_Core val6 = ((Il2CppObjectBase)owner).Cast<CP_Cluster_Core>(); if (puzzleOverride != null && puzzleOverride.PrevPosOverride.ToVector3() != Vector3.zero) { prevPuzzlePos = puzzleOverride.PrevPosOverride.ToVector3(); } else if (puzzleOverride != null && puzzleOverride.PrevPosOverrideIndex != 0) { CP_Bioscan_Core bioscanCore2 = PuzzleOverrideManager.Current.GetBioscanCore(puzzleOverride.PrevPosOverrideIndex); ? val7; if (bioscanCore2 == null) { CP_Cluster_Core clusterCore2 = PuzzleOverrideManager.Current.GetClusterCore(puzzleOverride.PrevPosOverrideIndex); val7 = ((clusterCore2 != null) ? ((Component)clusterCore2).transform.position : Vector3.zero); } else { val7 = bioscanCore2.m_position; } Vector3 val8 = (Vector3)val7; if (val8 == Vector3.zero) { SPOLogger.Error($"PuzzleOverrideIndex: {num} - trying to use 'PrevPosOverrideIndex' ({puzzleOverride.PrevPosOverrideIndex}) but the puzzle is not found."); SPOLogger.Error($"The puzzle is probably yet registered. NOTE: 'PrevPosOverrideIndex' could only be a integer that is less than PuzzleOverrideIndex({num})"); prevPuzzlePos = ((Component)val6).transform.position; } else { prevPuzzlePos = val8; } } else { prevPuzzlePos = ((Component)val6).transform.position; } val = ((Il2CppObjectBase)val6.m_owner).Cast<ChainedPuzzleInstance>(); if (val.Data.OnlyShowHUDWhenPlayerIsClose) { onlyShowHUDWhenPlayerIsClose = true; } } if (puzzleOverride != null) { if (puzzleOverride.Position.ToVector3() != Vector3.zero || puzzleOverride.Rotation.ToVector3() != Vector3.zero) { ((Component)__instance).transform.SetPositionAndRotation(puzzleOverride.Position.ToVector3(), puzzleOverride.Rotation.ToQuaternion()); } if (puzzleOverride.HideSpline || ((Object)(object)__instance.m_movingComp != (Object)null && __instance.m_movingComp.IsMoveConfigured)) { revealWithHoloPath = false; } if (puzzleOverride.RequiredItemsIndices != null && puzzleOverride.RequiredItemsIndices.Count > 0) { PuzzleReqItemManager.Current.QueueForAddingReqItems(__instance, puzzleOverride.RequiredItemsIndices); } SPOLogger.Warning("Overriding CP_Bioscan_Core." + (((Object)(object)val == (Object)null) ? "" : $"Zone {val.m_sourceArea.m_zone.Alias}, Layer {val.m_sourceArea.m_zone.Layer.m_type}, Dim {val.m_sourceArea.m_zone.DimensionIndex}")); } } } [HarmonyPatch] internal class Patch_ChainedPuzzleInstance_SetupMovement { [HarmonyPrefix] [HarmonyPatch(typeof(ChainedPuzzleInstance), "SetupMovement")] private static bool Pre_SetupMovement(ChainedPuzzleInstance __instance, GameObject gameObject) { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) iChainedPuzzleMovable movingComp = gameObject.GetComponent<iChainedPuzzleMovable>(); if (movingComp == null || !movingComp.UsingStaticBioscanPoints) { return true; } CP_BasicMovable val = ((Il2CppObjectBase)movingComp).Cast<CP_BasicMovable>(); iChainedPuzzleCore component = gameObject.GetComponent<iChainedPuzzleCore>(); CP_Bioscan_Core core = ((Il2CppObjectBase)component).Cast<CP_Bioscan_Core>(); uint bioscanCoreOverrideIndex = PuzzleOverrideManager.Current.GetBioscanCoreOverrideIndex(core); if (bioscanCoreOverrideIndex == 0) { SPOLogger.Error("Did not find registered movable override for this movable scan."); return true; } PuzzleOverride puzzleOverride = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, bioscanCoreOverrideIndex); if (puzzleOverride == null || puzzleOverride.TPositions.Count < 1) { SPOLogger.Error("No Override for this T-Scan, falling back to vanilla impl."); return true; } puzzleOverride.TPositions.ForEach(delegate(Vec3 pos) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) movingComp.ScanPositions.Add(pos.ToVector3()); }); gameObject.transform.position = puzzleOverride.TPositions[0].ToVector3(); val.m_amountOfPositions = puzzleOverride.TPositions.Count; if (puzzleOverride.TMoveSpeedMulti > 0f) { val.m_movementSpeed *= puzzleOverride.TMoveSpeedMulti; } SPOLogger.Warning("Overriding T-Scan pos!"); return false; } } [HarmonyPatch] internal class Patch_CarryItemPickup_Core_Setup { [HarmonyPostfix] [HarmonyPatch(typeof(CarryItemPickup_Core), "Setup")] private static void Post_CarryItemPickup_Core_Setup(CarryItemPickup_Core __instance) { PuzzleReqItemManager.Current.Register(__instance); } } [HarmonyPatch] internal static class Patch_CP_Cluster_Core_OnSyncStateChange { [HarmonyPostfix] [HarmonyPatch(typeof(CP_Cluster_Core), "OnSyncStateChange")] private static void Post_CheckEventsOnPuzzleSolved(CP_Cluster_Core __instance, eClusterStatus newStatus, bool isDropinState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)newStatus == 3) { if (!isDropinState) { uint clusterCoreOverrideIndex = PuzzleOverrideManager.Current.GetClusterCoreOverrideIndex(__instance); PuzzleOverrideManager.CompletedScans.Add(clusterCoreOverrideIndex); } uint clusterCoreOverrideIndex2 = PuzzleOverrideManager.Current.GetClusterCoreOverrideIndex(__instance); PuzzleOverride puzzleOverride = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, clusterCoreOverrideIndex2); if (puzzleOverride != null && puzzleOverride.EventsOnPuzzleSolved.Count > 0 && !isDropinState) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(puzzleOverride.EventsOnPuzzleSolved), (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } } } [HarmonyPatch] internal class Patch_CP_Cluster_Core_Setup { [HarmonyPrefix] [HarmonyPatch(typeof(CP_Cluster_Core), "Setup")] private static void Pre_CP_Cluster_Core_Setup(CP_Cluster_Core __instance, int puzzleIndex, iChainedPuzzleOwner owner, ref Vector3 prevPuzzlePos, ref bool revealWithHoloPath) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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) uint num = PuzzleOverrideManager.Current.Register(__instance); PuzzleOverride puzzleOverride = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, num); ChainedPuzzleInstance val = ((Il2CppObjectBase)owner).Cast<ChainedPuzzleInstance>(); bool flag = false; if (puzzleOverride != null) { if (puzzleOverride.PrevPosOverride.ToVector3() != Vector3.zero) { prevPuzzlePos = puzzleOverride.PrevPosOverride.ToVector3(); flag = true; } else if (puzzleOverride.PrevPosOverrideIndex != 0) { CP_Bioscan_Core bioscanCore = PuzzleOverrideManager.Current.GetBioscanCore(puzzleOverride.PrevPosOverrideIndex); ? val2; if (bioscanCore == null) { CP_Cluster_Core clusterCore = PuzzleOverrideManager.Current.GetClusterCore(puzzleOverride.PrevPosOverrideIndex); val2 = ((clusterCore != null) ? ((Component)clusterCore).transform.position : Vector3.zero); } else { val2 = bioscanCore.m_position; } Vector3 val3 = (Vector3)val2; if (val3 == Vector3.zero) { SPOLogger.Error($"PuzzleOverrideIndex: {num} - trying to use 'PrevPosOverrideIndex' ({puzzleOverride.PrevPosOverrideIndex}) but the puzzle is not found."); SPOLogger.Error($"The puzzle is probably yet registered. NOTE: 'PrevPosOverrideIndex' could only be a integer that is less than PuzzleOverrideIndex({num})"); flag = false; } else { prevPuzzlePos = val3; flag = true; } } } if (!flag && puzzleIndex != 0) { CP_Bioscan_Core val4 = ((Il2CppObjectBase)((Il2CppArrayBase<iChainedPuzzleCore>)(object)val.m_chainedPuzzleCores)[puzzleIndex - 1]).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val4 != (Object)null) { prevPuzzlePos = ((Component)val4).transform.position; } else { CP_Cluster_Core val5 = ((Il2CppObjectBase)((Il2CppArrayBase<iChainedPuzzleCore>)(object)val.m_chainedPuzzleCores)[puzzleIndex - 1]).TryCast<CP_Cluster_Core>(); if ((Object)(object)val5 == (Object)null) { SPOLogger.Error($"Cannot cast m_chainedPuzzleCores[{puzzleIndex - 1}] to neither CP_Bioscan_Core or CP_Cluster_Core! WTF???"); } else { prevPuzzlePos = ((Component)val5).transform.position; } } } if (puzzleOverride != null) { if (puzzleOverride.Position.ToVector3() != Vector3.zero || puzzleOverride.Rotation.ToVector3() != Vector3.zero) { ((Component)__instance).transform.SetPositionAndRotation(puzzleOverride.Position.ToVector3(), puzzleOverride.Rotation.ToQuaternion()); } if (puzzleOverride.RequiredItemsIndices != null && puzzleOverride.RequiredItemsIndices.Count > 0) { PuzzleReqItemManager.Current.QueueForAddingReqItems(__instance, puzzleOverride.RequiredItemsIndices); } if (puzzleOverride.HideSpline) { revealWithHoloPath = false; } SPOLogger.Warning("Overriding CP_Cluster_Core!"); } } [HarmonyPostfix] [HarmonyPatch(typeof(CP_Cluster_Core), "Setup")] private static void Post_CP_Cluster_Core_Setup(CP_Cluster_Core __instance) { ChainedPuzzleInstance val = ((Il2CppObjectBase)__instance.m_owner).Cast<ChainedPuzzleInstance>(); foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores) { if (item.IsMovable && PuzzleOverrideManager.Current.GetBioscanCoreOverrideIndex(((Il2CppObjectBase)item).Pointer) != 0) { val.SetupMovement(((Component)((Il2CppObjectBase)item).Cast<CP_Bioscan_Core>()).gameObject, val.m_sourceArea); } } uint clusterCoreOverrideIndex = PuzzleOverrideManager.Current.GetClusterCoreOverrideIndex(__instance); if (clusterCoreOverrideIndex == 0) { return; } PuzzleOverride def = Plugin.GetOverride(PuzzleOverrideManager.MainLevelLayout, clusterCoreOverrideIndex); if (def == null) { return; } if (def.ConcurrentCluster) { if (2 <= ((Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores).Count && ((Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores).Count <= 4) { CP_Cluster_Hud val2 = ((Il2CppObjectBase)__instance.m_hud).Cast<CP_Cluster_Hud>(); ConcurrentClusterHud concurrentClusterHud = ((Component)val2).gameObject.AddComponent<ConcurrentClusterHud>(); concurrentClusterHud.parent = __instance; concurrentClusterHud.parentHud = ((Il2CppObjectBase)val2.m_hud).Cast<CP_Bioscan_Hud>(); concurrentClusterHud.def = def; if (concurrentClusterHud.Setup()) { PlayerScannerManager.Current.RegisterConcurrentCluster(__instance); SPOLogger.Warning("Setting up CP_Cluster_Core as Concurrent Cluster!"); } else { SPOLogger.Warning("Concurrent Cluster: failed to setup"); } } else { SPOLogger.Error("Trying to setup concurrent cluster, " + $"but the cluster scan has {((Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores).Count}, which is senseless or is impossible for 4 players to complete"); } } if (def.EventsOnClusterProgress.Count <= 0) { return; } foreach (iChainedPuzzleCore item2 in (Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores) { item2.OnPuzzleDone += Action<int>.op_Implicit((Action<int>)CheckEventsOnClusterProgress); } void CheckEventsOnClusterProgress(int puzzleIndex) { int num = 0; for (int i = 0; i < ((Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores).Length; i++) { if (((Il2CppArrayBase<iChainedPuzzleCore>)(object)__instance.m_childCores)[i].IsFinished()) { num++; } } foreach (ClusterProgressEvent item3 in def.EventsOnClusterProgress) { if (item3.Count == num) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(item3.Events), (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } } } } [HarmonyPatch] internal class Patches_CP_Cluster_Hud_ReqItems { private static Dictionary<IntPtr, List<bool>> childrenReqItemEnabled { get; } private static Dictionary<IntPtr, List<string[]>> clustersChildrenReqItemNames { get; } private static Dictionary<IntPtr, List<Il2CppStructArray<bool>>> clustersChildrenReqItemsStatus { get; } [HarmonyPostfix] [HarmonyPatch(typeof(CP_Bioscan_Core), "AddRequiredItems")] private static void Post_CP_Bioscan_Core_AddRequiredItems(CP_Bioscan_Core __instance, Il2CppReferenceArray<iWardenObjectiveItem> requiredItems) { CP_Cluster_Core val = ((Il2CppObjectBase)__instance.Owner).TryCast<CP_Cluster_Core>(); if ((Object)(object)val == (Object)null) { return; } if (__instance.m_hud == null) { SPOLogger.Error("CP_Cluster_Hud_ReqItems: replacement Cluster_hud is null."); return; } CP_Cluster_Hud val2 = ((Il2CppObjectBase)__instance.m_hud).Cast<CP_Cluster_Hud>(); string[] array = new string[((Il2CppArrayBase<iWardenObjectiveItem>)(object)requiredItems).Count]; for (int i = 0; i < __instance.m_reqItems.Count; i++) { if (__instance.m_reqItems[i] != null) { array[i] = __instance.m_reqItems[i].PublicName; } else { SPOLogger.Error("Post_CP_Bioscan_Core_AddRequiredItems: CP_Bioscan_Core " + ((Object)__instance).name + " has a missing m_reqItem! " + i); } } List<bool> list; List<string[]> list2; if (childrenReqItemEnabled.ContainsKey(((Il2CppObjectBase)val2).Pointer)) { list = childrenReqItemEnabled[((Il2CppObjectBase)val2).Pointer]; list2 = clustersChildrenReqItemNames[((Il2CppObjectBase)val2).Pointer]; } else { list = Enumerable.Repeat(element: false, val.NRofPuzzles()).ToList(); list2 = Enumerable.Repeat(new string[0], val.NRofPuzzles()).ToList(); childrenReqItemEnabled.Add(((Il2CppObjectBase)val2).Pointer, list); clustersChildrenReqItemNames.Add(((Il2CppObjectBase)val2).Pointer, list2); } list[__instance.m_puzzleIndex] = __instance.m_reqItemsEnabled; list2[__instance.m_puzzleIndex] = array; } [HarmonyPrefix] [HarmonyPatch(typeof(CP_Cluster_Hud), "SetRequiredItemData")] private static bool Pre_CP_Cluster_Hud_SetRequiredItemData(CP_Cluster_Hud __instance, int puzzleIndex, Il2CppStructArray<bool> reqItemStatus) { List<Il2CppStructArray<bool>> list; if (!clustersChildrenReqItemsStatus.ContainsKey(((Il2CppObjectBase)__instance).Pointer)) { list = Enumerable.Repeat<Il2CppStructArray<bool>>(null, __instance.m_clusterSize).ToList(); clustersChildrenReqItemsStatus.Add(((Il2CppObjectBase)__instance).Pointer, list); } else { list = clustersChildrenReqItemsStatus[((Il2CppObjectBase)__instance).Pointer]; } list[puzzleIndex] = reqItemStatus; return false; } [HarmonyPostfix] [HarmonyPatch(typeof(CP_Cluster_Hud), "UpdateDataFor")] private static void Post_CP_Cluster_Hud_UpdateDataFor(CP_Cluster_Hud __instance, int index) { if (clustersChildrenReqItemsStatus.ContainsKey(((Il2CppObjectBase)__instance).Pointer)) { if (!childrenReqItemEnabled.ContainsKey(((Il2CppObjectBase)__instance).Pointer) || !clustersChildrenReqItemNames.ContainsKey(((Il2CppObjectBase)__instance).Pointer)) { SPOLogger.Error("CP_Cluster_Hud_UpdateDataFor: Found registered reqItemStatus but ReqItemEnabled or ReqItemNames is missing!"); return; } Il2CppStructArray<bool> val = clustersChildrenReqItemsStatus[((Il2CppObjectBase)__instance).Pointer][index]; __instance.m_hud.SetupRequiredItems(childrenReqItemEnabled[((Il2CppObjectBase)__instance).Pointer][index], Il2CppStringArray.op_Implicit(clustersChildrenReqItemNames[((Il2CppObjectBase)__instance).Pointer][index])); __instance.m_hud.SetRequiredItemData(__instance.m_puzzleIndex, val); } } private static void Clear() { clustersChildrenReqItemsStatus.Clear(); clustersChildrenReqItemNames.Clear(); childrenReqItemEnabled.Clear(); } static Patches_CP_Cluster_Hud_ReqItems() { childrenReqItemEnabled = new Dictionary<IntPtr, List<bool>>(); clustersChildrenReqItemNames = new Dictionary<IntPtr, List<string[]>>(); clustersChildrenReqItemsStatus = new Dictionary<IntPtr, List<Il2CppStructArray<bool>>>(); LevelAPI.OnLevelCleanup += Clear; } } } namespace ScanPosOverride.Managers { public class PlayerScannerManager { private static readonly float[] ZERO_SCAN_SPEED; private Mutex CCStateMutex = null; private Dictionary<IntPtr, CP_PlayerScanner> ChildScanners = new Dictionary<IntPtr, CP_PlayerScanner>(); public static PlayerScannerManager Current { get; } private Dictionary<IntPtr, List<CP_PlayerScanner>> CCCores { get; } = new Dictionary<IntPtr, List<CP_PlayerScanner>>(); private Dictionary<IntPtr, HashSet<IntPtr>> CCChildren { get; } = new Dictionary<IntPtr, HashSet<IntPtr>>(); private Dictionary<IntPtr, HashSet<IntPtr>> CCChildrenState { get; } = new Dictionary<IntPtr, HashSet<IntPtr>>(); private Dictionary<IntPtr, float[]> OriginalClusterScanSpeeds { get; } = new Dictionary<IntPtr, float[]>(); private Dictionary<IntPtr, float[]> OriginalScanSpeed { get; } = new Dictionary<IntPtr, float[]>(); internal bool RegisterConcurrentCluster(CP_Cluster_Core core) { if (CCCores.ContainsKey(((Il2CppObjectBase)core).Pointer)) { return false; } List<CP_PlayerScanner> list = Enumerable.Repeat<CP_PlayerScanner>(null, core.m_amountOfPuzzles).ToList(); HashSet<IntPtr> hashSet = new HashSet<IntPtr>(); for (int i = 0; i < ((Il2CppArrayBase<iChainedPuzzleCore>)(object)core.m_childCores).Count; i++) { if ((Object)(object)list[i] != (Object)null) { SPOLogger.Error("SetupConcurrentClusterScanners: Duplicate child scanner for child scan. ??"); continue; } iChainedPuzzleCore val = ((Il2CppArrayBase<iChainedPuzzleCore>)(object)core.m_childCores)[i]; CP_Bioscan_Core val2 = ((Il2CppObjectBase)val).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val2 == (Object)null) { SPOLogger.Error("SetupConcurrentClusterScanners: Failed to cast child to CP_Bioscan_Core"); continue; } CP_PlayerScanner val3 = ((Il2CppObjectBase)val2.PlayerScanner).TryCast<CP_PlayerScanner>(); if ((Object)(object)val3 == (Object)null) { SPOLogger.Error("SetupConcurrentClusterScanners: Failed to cast CP_Bioscan_Core.PlayerScanner to CP_PlayerScanner"); continue; } list[i] = val3; ChildScanners.Add(((Il2CppObjectBase)val).Pointer, val3); hashSet.Add(((Il2CppObjectBase)val2).Pointer); if (!OriginalClusterScanSpeeds.ContainsKey(((Il2CppObjectBase)core).Pointer)) { Il2CppStructArray<float> scanSpeeds = val3.m_scanSpeeds; float[] array = new float[((Il2CppArrayBase<float>)(object)scanSpeeds).Length]; Array.Copy(Il2CppArrayBase<float>.op_Implicit((Il2CppArrayBase<float>)(object)scanSpeeds), array, ((Il2CppArrayBase<float>)(object)scanSpeeds).Length); OriginalClusterScanSpeeds.Add(((Il2CppObjectBase)core).Pointer, array); } } CCCores.Add(((Il2CppObjectBase)core).Pointer, list); CCChildren.Add(((Il2CppObjectBase)core).Pointer, hashSet); CCChildrenState.Add(((Il2CppObjectBase)core).Pointer, new HashSet<IntPtr>()); return true; } internal bool IsConcurrentCluster(CP_Cluster_Core core) { return CCCores.ContainsKey(((Il2CppObjectBase)core).Pointer); } internal bool IsConcurrentCluster(CP_Bioscan_Core core) { return CCCores.ContainsKey(((Il2CppObjectBase)core.Owner).Pointer); } internal void ZeroCCScanSpeed(CP_Cluster_Core parent) { if (!CCCores.ContainsKey(((Il2CppObjectBase)parent).Pointer)) { return; } foreach (CP_PlayerScanner item in CCCores[((Il2CppObjectBase)parent).Pointer]) { bool flag = true; for (int i = 0; i < 4; i++) { flag = flag && ((Il2CppArrayBase<float>)(object)item.m_scanSpeeds)[i] == 0f; ((Il2CppArrayBase<float>)(object)item.m_scanSpeeds)[i] = 0f; } if (flag) { break; } } } internal void RestoreCCScanSpeed(CP_Cluster_Core parent) { if (!CCCores.ContainsKey(((Il2CppObjectBase)parent).Pointer) || !OriginalClusterScanSpeeds.ContainsKey(((Il2CppObjectBase)parent).Pointer)) { return; } float[] array = OriginalClusterScanSpeeds[((Il2CppObjectBase)parent).Pointer]; foreach (CP_PlayerScanner item in CCCores[((Il2CppObjectBase)parent).Pointer]) { bool flag = false; for (int i = 0; i < 4; i++) { flag = flag || ((Il2CppArrayBase<float>)(object)item.m_scanSpeeds)[i] != 0f; ((Il2CppArrayBase<float>)(object)item.m_scanSpeeds)[i] = array[i]; } if (flag) { break; } } } internal float[] GetCacheOriginalScanSpeed(CP_Bioscan_Core core) { if (IsConcurrentCluster(core)) { return CCCores.ContainsKey(((Il2CppObjectBase)core.Owner).Pointer) ? OriginalClusterScanSpeeds[((Il2CppObjectBase)core.Owner).Pointer] : ZERO_SCAN_SPEED; } if (OriginalScanSpeed.ContainsKey(((Il2CppObjectBase)core).Pointer)) { return OriginalScanSpeed[((Il2CppObjectBase)core).Pointer]; } CP_PlayerScanner cacheScanner = GetCacheScanner(core); if ((Object)(object)cacheScanner == (Object)null) { SPOLogger.Error("GetCacheOriginalScanSpeed: cannot get scanner for this CP_Bioscan_Core"); return ZERO_SCAN_SPEED; } float[] array = new float[4]; Array.Copy(Il2CppArrayBase<float>.op_Implicit((Il2CppArrayBase<float>)(object)cacheScanner.m_scanSpeeds), array, array.Length); OriginalScanSpeed.Add(((Il2CppObjectBase)core).Pointer, array); return array; } public CP_PlayerScanner GetCacheScanner(CP_Bioscan_Core core) { if (ChildScanners.ContainsKey(((Il2CppObjectBase)core).Pointer)) { return ChildScanners[((Il2CppObjectBase)core).Pointer]; } CP_PlayerScanner val = ((Il2CppObjectBase)core.PlayerScanner).TryCast<CP_PlayerScanner>(); if ((Object)(object)val == (Object)null) { return null; } ChildScanners.Add(((Il2CppObjectBase)core).Pointer, val); return val; } internal bool CCShouldProgress(CP_Bioscan_Core child, bool IsThisScanShouldProgress) { if (CCStateMutex == null) { CCStateMutex = new Mutex(); } if (CCStateMutex.WaitOne(2000)) { if (!CCCores.ContainsKey(((Il2CppObjectBase)child.Owner).Pointer)) { SPOLogger.Error("ConcurrentClusterShouldProgress: failed to find cluster parent!"); CCStateMutex.ReleaseMutex(); return false; } CP_Cluster_Core val = ((Il2CppObjectBase)child.Owner).Cast<CP_Cluster_Core>(); if (!CCChildrenState.ContainsKey(((Il2CppObjectBase)val).Pointer)) { SPOLogger.Error("ConcurrentClusterShouldProgress: ConcurrentClusterChildScanState initialization error!"); CCStateMutex.ReleaseMutex(); return false; } HashSet<IntPtr> hashSet = CCChildrenState[((Il2CppObjectBase)val).Pointer]; bool result; if (IsThisScanShouldProgress) { hashSet.Add(((Il2CppObjectBase)child).Pointer); result = hashSet.Count == val.m_amountOfPuzzles; } else { hashSet.Remove(((Il2CppObjectBase)child).Pointer); result = false; } CCStateMutex.ReleaseMutex(); return result; } SPOLogger.Debug("ConcurrentCluster: Failed to acquire scan mutex."); return false; } internal void CompleteConcurrentCluster(CP_Cluster_Core parent, CP_Bioscan_Core child) { if (CCChildren.ContainsKey(((Il2CppObjectBase)parent).Pointer)) { HashSet<IntPtr> hashSet = CCChildren[((Il2CppObjectBase)parent).Pointer]; hashSet.Remove(((Il2CppObjectBase)child).Pointer); if (hashSet.Count < 1) { CCChildren.Remove(((Il2CppObjectBase)parent).Pointer); } } } public List<CP_PlayerScanner> GetCCChildrenScanner(CP_Cluster_Core parent) { return CCCores.ContainsKey(((Il2CppObjectBase)parent).Pointer) ? CCCores[((Il2CppObjectBase)parent).Pointer] : null; } public void Clear() { CCCores.Clear(); CCChildren.Clear(); CCChildrenState.Clear(); OriginalClusterScanSpeeds.Clear(); ChildScanners.Clear(); OriginalScanSpeed.Clear(); if (CCStateMutex != null) { CCStateMutex.Dispose(); } CCStateMutex = null; } static PlayerScannerManager() { ZERO_SCAN_SPEED = new float[4]; Current = new PlayerScannerManager(); LevelAPI.OnLevelCleanup += Current.Clear; } private PlayerScannerManager() { } } public class PuzzleReqItemManager { public static readonly PuzzleReqItemManager Current; private Dictionary<int, CarryItemPickup_Core> BigPickupItemsInLevel = new Dictionary<int, CarryItemPickup_Core>(); private int itemIndexCounter = 1; private List<(CP_Bioscan_Core, List<int>)> bioscanCoresToAddReqItems = new List<(CP_Bioscan_Core, List<int>)>(); private List<(CP_Cluster_Core, List<int>)> clusterCoresToAddReqItems = new List<(CP_Cluster_Core, List<int>)>(); private Dictionary<IntPtr, CP_Bioscan_Core> movableScansWithReqItems = new Dictionary<IntPtr, CP_Bioscan_Core>(); internal int Register(CarryItemPickup_Core item) { int num = itemIndexCounter; itemIndexCounter++; BigPickupItemsInLevel.Add(num, item); return num; } internal void QueueForAddingReqItems(CP_Bioscan_Core core, List<int> itemsIndices) { bioscanCoresToAddReqItems.Add((core, itemsIndices)); } internal void QueueForAddingReqItems(CP_Cluster_Core core, List<int> itemsIndices) { clusterCoresToAddReqItems.Add((core, itemsIndices)); } internal CP_Bioscan_Core GetMovableCoreWithReqItem(CP_PlayerScanner scanner) { return movableScansWithReqItems.ContainsKey(((Il2CppObjectBase)scanner).Pointer) ? movableScansWithReqItems[((Il2CppObjectBase)scanner).Pointer] : null; } public CarryItemPickup_Core GetBigPickupItem(int bigPickupInLevelIndex) { return BigPickupItemsInLevel.ContainsKey(bigPickupInLevelIndex) ? BigPickupItemsInLevel[bigPickupInLevelIndex] : null; } public bool AddReqItems(CP_Bioscan_Core puzzle, int itemIndex) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown if ((Object)(object)puzzle == (Object)null || (long)itemIndex == 0) { return false; } if (!BigPickupItemsInLevel.ContainsKey(itemIndex)) { SPOLogger.Error($"Unregistered BigPickup Item with index {itemIndex}"); return false; } CarryItemPickup_Core val = BigPickupItemsInLevel[itemIndex]; puzzle.AddRequiredItems(Il2CppReferenceArray<iWardenObjectiveItem>.op_Implicit((iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1] { new iWardenObjectiveItem(((Il2CppObjectBase)val).Pointer) })); return true; } public bool AddReqItems(CP_Cluster_Core puzzle, int itemIndex) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown if ((Object)(object)puzzle == (Object)null || (long)itemIndex == 0) { return false; } if (!BigPickupItemsInLevel.ContainsKey(itemIndex)) { SPOLogger.Error($"Unregistered BigPickup Item with index {itemIndex}"); return false; } CarryItemPickup_Core val = BigPickupItemsInLevel[itemIndex]; foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)puzzle.m_childCores) { item.AddRequiredItems(Il2CppReferenceArray<iWardenObjectiveItem>.op_Implicit((iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1] { new iWardenObjectiveItem(((Il2CppObjectBase)val).Pointer) })); } return true; } public bool AddReqItems(CP_Bioscan_Core puzzle, List<int> itemsIndices) { if ((Object)(object)puzzle == (Object)null || itemsIndices == null || itemsIndices.Count < 1) { return false; } bool flag = false; foreach (int item in itemsIndices.ToHashSet()) { flag |= AddReqItems(puzzle, item); } if (puzzle.IsMovable && flag) { movableScansWithReqItems.Add(((Il2CppObjectBase)puzzle.m_playerScanner).Pointer, puzzle); } return flag; } public void RemoveReqItem(CP_Bioscan_Core puzzle, int itemIndex) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown if (!((Object)(object)puzzle == (Object)null)) { if (!BigPickupItemsInLevel.ContainsKey(itemIndex) && (long)itemIndex != 0) { SPOLogger.Error($"Unregistered BigPickup Item with index {itemIndex}"); } else { CarryItemPickup_Core val = BigPickupItemsInLevel[itemIndex]; puzzle.RemoveRequiredItems((iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1] { new iWardenObjectiveItem(((Il2CppObjectBase)val).Pointer) }); } } } public void RemoveReqItem(CP_Cluster_Core puzzle, int itemIndex) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown if ((Object)(object)puzzle == (Object)null) { return; } if (!BigPickupItemsInLevel.ContainsKey(itemIndex) && (long)itemIndex != 0) { SPOLogger.Error($"Unregistered BigPickup Item with index {itemIndex}"); return; } CarryItemPickup_Core val = BigPickupItemsInLevel[itemIndex]; foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)puzzle.m_childCores) { item.RemoveRequiredItems((iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1] { new iWardenObjectiveItem(((Il2CppObjectBase)val).Pointer) }); } } private void AddQueuedReqItems() { foreach (var (puzzle, itemsIndices) in bioscanCoresToAddReqItems) { AddReqItems(puzzle, itemsIndices); } foreach (var (val, itemsIndices2) in clusterCoresToAddReqItems) { foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val.m_childCores) { CP_Bioscan_Core val2 = ((Il2CppObjectBase)item).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val2 == (Object)null) { SPOLogger.Error("Failed to cast child core to CP_Bioscan_Core"); } else { AddReqItems(val2, itemsIndices2); } } } } public void OutputLevelBigPickupInfo() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) StringBuilder val = new StringBuilder(); val.AppendLine(); List<CarryItemPickup_Core> list = new List<CarryItemPickup_Core>(BigPickupItemsInLevel.Values); list.Sort(delegate(CarryItemPickup_Core b1, CarryItemPickup_Core b2) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) AIG_CourseNode spawnNode = b1.SpawnNode; AIG_CourseNode spawnNode2 = b2.SpawnNode; if (spawnNode.m_dimension.DimensionIndex != spawnNode2.m_dimension.DimensionIndex) { return (spawnNode.m_dimension.DimensionIndex > spawnNode2.m_dimension.DimensionIndex) ? 1 : (-1); } if (spawnNode.LayerType != spawnNode2.LayerType) { return (spawnNode.LayerType >= spawnNode2.LayerType) ? 1 : (-1); } return (spawnNode.m_zone.LocalIndex != spawnNode2.m_zone.LocalIndex) ? ((spawnNode.m_zone.LocalIndex >= spawnNode2.m_zone.LocalIndex) ? 1 : (-1)) : 0; }); Dictionary<CarryItemPickup_Core, int> dictionary = new Dictionary<CarryItemPickup_Core, int>(); foreach (int key in BigPickupItemsInLevel.Keys) { dictionary.Add(BigPickupItemsInLevel[key], key); } foreach (CarryItemPickup_Core item in list) { val.AppendLine("Item Name: " + ((Item)item).ItemDataBlock.publicName); val.AppendLine($"Zone {item.SpawnNode.m_zone.Alias}, {item.SpawnNode.LayerType}, Dim {item.SpawnNode.m_dimension.DimensionIndex}"); val.AppendLine($"Item Index: {dictionary[item]}"); val.AppendLine(); } SPOLogger.Debug(((Object)val).ToString()); } internal void OnEnterLevel() { AddQueuedReqItems(); OutputLevelBigPickupInfo(); } public void Clear() { BigPickupItemsInLevel.Clear(); itemIndexCounter = 1; bioscanCoresToAddReqItems.Clear(); clusterCoresToAddReqItems.Clear(); movableScansWithReqItems.Clear(); } static PuzzleReqItemManager() { Current = new PuzzleReqItemManager(); LevelAPI.OnLevelCleanup += Current.Clear; LevelAPI.OnEnterLevel += Current.OnEnterLevel; } private PuzzleReqItemManager() { } } public class PuzzleOverrideManager { public static readonly PuzzleOverrideManager Current; public static HashSet<uint> CompletedScans; private uint puzzleOverrideIndex = 1u; public static uint MainLevelLayout => RundownManager.ActiveExpedition.LevelLayoutData; private Dictionary<IntPtr, uint> bioscanIndex { get; } = new Dictionary<IntPtr, uint>(); private Dictionary<IntPtr, uint> clusterIndex { get; } = new Dictionary<IntPtr, uint>(); private Dictionary<uint, CP_Bioscan_Core> index2Bioscan { get; } = new Dictionary<uint, CP_Bioscan_Core>(); private Dictionary<uint, CP_Cluster_Core> index2Cluster { get; } = new Dictionary<uint, CP_Cluster_Core>(); public uint Register(CP_Bioscan_Core __instance) { if ((Object)(object)__instance == (Object)null) { return 0u; } uint num = puzzleOverrideIndex; puzzleOverrideIndex++; if (!bioscanIndex.ContainsKey(((Il2CppObjectBase)__instance).Pointer)) { bioscanIndex.Add(((Il2CppObjectBase)__instance).Pointer, num); index2Bioscan.Add(num, __instance); return num; } return GetBioscanCoreOverrideIndex(__instance); } public uint Register(CP_Cluster_Core __instance) { if ((Object)(object)__instance == (Object)null) { return 0u; } uint num = puzzleOverrideIndex; puzzleOverrideIndex++; if (!clusterIndex.ContainsKey(((Il2CppObjectBase)__instance).Pointer)) { clusterIndex.Add(((Il2CppObjectBase)__instance).Pointer, num); index2Cluster.Add(num, __instance); return num; } return GetClusterCoreOverrideIndex(__instance); } public void OutputLevelPuzzleInfo() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) List<ChainedPuzzleInstance> list = new List<ChainedPuzzleInstance>(); Enumerator<ChainedPuzzleInstance> enumerator = ChainedPuzzleManager.Current.m_instances.GetEnumerator(); while (enumerator.MoveNext()) { ChainedPuzzleInstance current = enumerator.Current; list.Add(current); } list.Sort(delegate(ChainedPuzzleInstance c1, ChainedPuzzleInstance c2) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) LG_Zone zone2 = c1.m_sourceArea.m_zone; LG_Zone zone3 = c2.m_sourceArea.m_zone; if (zone2.DimensionIndex != zone3.DimensionIndex) { return (zone2.DimensionIndex >= zone3.DimensionIndex) ? 1 : (-1); } return (zone2.Layer.m_type != zone3.Layer.m_type) ? ((zone2.Layer.m_type >= zone3.Layer.m_type) ? 1 : (-1)) : ((zone2.LocalIndex >= zone3.LocalIndex) ? 1 : (-1)); }); StringBuilder stringBuilder = new StringBuilder(); foreach (ChainedPuzzleInstance item in list) { LG_Zone zone = item.m_sourceArea.m_zone; StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(15, 3, stringBuilder2); handler.AppendLiteral("\nZone "); handler.AppendFormatted(zone.Alias); handler.AppendLiteral(", "); handler.AppendFormatted<LG_LayerType>(zone.m_layer.m_type); handler.AppendLiteral(", Dim "); handler.AppendFormatted<eDimensionIndex>(zone.DimensionIndex); handler.AppendLiteral("\n"); stringBuilder3.Append(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(14, 1, stringBuilder2); handler.AppendLiteral("Alarm name: "); handler.AppendFormatted(item.Data.PublicAlarmName); handler.AppendLiteral(":\n"); stringBuilder4.Append(ref handler); for (int num = 0; num < ((Il2CppArrayBase<iChainedPuzzleCore>)(object)item.m_chainedPuzzleCores).Count; num++) { iChainedPuzzleCore val = ((Il2CppArrayBase<iChainedPuzzleCore>)(object)item.m_chainedPuzzleCores)[num]; if (bioscanIndex.ContainsKey(((Il2CppObjectBase)val).Pointer)) { uint value = bioscanIndex[((Il2CppObjectBase)val).Pointer]; stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder2); handler.AppendLiteral("puzzle index: "); handler.AppendFormatted(num); handler.AppendLiteral("\n"); stringBuilder5.Append(ref handler); stringBuilder.Append("type: CP_Bioscan_Core\n"); stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(22, 1, stringBuilder2); handler.AppendLiteral("PuzzleOverrideIndex: "); handler.AppendFormatted(value); handler.AppendLiteral("\n"); stringBuilder6.Append(ref handler); CP_Bioscan_Core val2 = ((Il2CppObjectBase)val).Cast<CP_Bioscan_Core>(); CP_PlayerScanner val3 = ((Il2CppObjectBase)val2.PlayerScanner).Cast<CP_PlayerScanner>(); stringBuilder2 = stringBuilder; StringBuilder stringBuilder7 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(11, 1, stringBuilder2); handler.AppendLiteral("Position: "); handler.AppendFormatted<Vector3>(val2.m_position); handler.AppendLiteral("\n"); stringBuilder7.Append(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder8 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(9, 1, stringBuilder2); handler.AppendLiteral("Radius: "); handler.AppendFormatted(val3.Radius); handler.AppendLiteral("\n"); stringBuilder8.Append(ref handler); } else if (clusterIndex.ContainsKey(((Il2CppObjectBase)val).Pointer)) { uint value2 = clusterIndex[((Il2CppObjectBase)val).Pointer]; CP_Cluster_Core val4 = ((Il2CppObjectBase)val).Cast<CP_Cluster_Core>(); stringBuilder2 = stringBuilder; StringBuilder stringBuilder9 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder2); handler.AppendLiteral("puzzle index: "); handler.AppendFormatted(num); handler.AppendLiteral("\n"); stringBuilder9.Append(ref handler); stringBuilder.Append("type: CP_Cluster_Core\n"); stringBuilder2 = stringBuilder; StringBuilder stringBuilder10 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(22, 1, stringBuilder2); handler.AppendLiteral("PuzzleOverrideIndex: "); handler.AppendFormatted(value2); handler.AppendLiteral("\n"); stringBuilder10.Append(ref handler); stringBuilder.Append("=== Clustered puzzles info: ===\n"); for (int num2 = 0; num2 < val4.m_amountOfPuzzles; num2++) { iChainedPuzzleCore val5 = ((Il2CppArrayBase<iChainedPuzzleCore>)(object)val4.m_childCores)[num2]; if (!bioscanIndex.ContainsKey(((Il2CppObjectBase)val5).Pointer)) { SPOLogger.Error("Unregistered clustered iChainedPuzzleCore found..."); continue; } uint value3 = bioscanIndex[((Il2CppObjectBase)val5).Pointer]; stringBuilder2 = stringBuilder; StringBuilder stringBuilder11 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder2); handler.AppendLiteral("puzzle index: "); handler.AppendFormatted(num2); handler.AppendLiteral("\n"); stringBuilder11.Append(ref handler); stringBuilder.Append("type: CP_Bioscan_Core\n"); stringBuilder2 = stringBuilder; StringBuilder stringBuilder12 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(22, 1, stringBuilder2); handler.AppendLiteral("PuzzleOverrideIndex: "); handler.AppendFormatted(value3); handler.AppendLiteral("\n"); stringBuilder12.Append(ref handler); CP_Bioscan_Core val6 = ((Il2CppObjectBase)val5).Cast<CP_Bioscan_Core>(); CP_PlayerScanner val7 = ((Il2CppObjectBase)val6.PlayerScanner).Cast<CP_PlayerScanner>(); stringBuilder2 = stringBuilder; StringBuilder stringBuilder13 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(11, 1, stringBuilder2); handler.AppendLiteral("Position: "); handler.AppendFormatted<Vector3>(val6.m_position); handler.AppendLiteral("\n"); stringBuilder13.Append(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder14 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(9, 1, stringBuilder2); handler.AppendLiteral("Radius: "); handler.AppendFormatted(val7.Radius); handler.AppendLiteral("\n"); stringBuilder14.Append(ref handler); } stringBuilder.Append("=== Clustered puzzles END ===\n"); } else { SPOLogger.Error("Unregistered iChainedPuzzleCore found..."); } } stringBuilder.Append('\n'); } SPOLogger.Debug(stringBuilder.ToString()); } public uint GetBioscanCoreOverrideIndex(CP_Bioscan_Core core) { return bioscanIndex.ContainsKey(((Il2CppObjectBase)core).Pointer) ? bioscanIndex[((Il2CppObjectBase)core).Pointer] : 0u; } public uint GetClusterCoreOverrideIndex(CP_Cluster_Core core) { return clusterIndex.ContainsKey(((Il2CppObjectBase)core).Pointer) ? clusterIndex[((Il2CppObjectBase)core).Pointer] : 0u; } public uint GetBioscanCoreOverrideIndex(IntPtr pointer) { return bioscanIndex.ContainsKey(pointer) ? bioscanIndex[pointer] : 0u; } public uint GetClusterCoreOverrideIndex(IntPtr pointer) { return clusterIndex.ContainsKey(pointer) ? clusterIndex[pointer] : 0u; } public CP_Bioscan_Core GetBioscanCore(uint puzzleOverrideIndex) { return index2Bioscan.ContainsKey(puzzleOverrideIndex) ? index2Bioscan[puzzleOverrideIndex] : null; } public IEnumerable<KeyValuePair<uint, CP_Bioscan_Core>> GetRegisteredBioscanCores() { return index2Bioscan; } public int GetRegisteredBioscanCoreCount() { return index2Bioscan.Count; } public CP_Cluster_Core GetClusterCore(uint puzzleOverrideIndex) { return index2Cluster.ContainsKey(puzzleOverrideIndex) ? index2Cluster[puzzleOverrideIndex] : null; } public void Clear() { puzzleOverrideIndex = 1u; bioscanIndex.Clear(); clusterIndex.Clear(); index2Bioscan.Clear(); index2Cluster.Clear(); CompletedScans.Clear(); } private PuzzleOverrideManager() { } static PuzzleOverrideManager() { CompletedScans = new HashSet<uint>(); Current = new PuzzleOverrideManager(); LevelAPI.OnEnterLevel += Current.OutputLevelPuzzleInfo; LevelAPI.OnBuildStart += Current.Clear; LevelAPI.OnLevelCleanup += Current.Clear; } public iChainedPuzzleOwner ChainedPuzzleInstanceOwner(CP_Bioscan_Core bioscanCore) { if ((Object)(object)bioscanCore == (Object)null) { return null; } iChainedPuzzleOwner owner = bioscanCore.Owner; ChainedPuzzleInstance val = ((Il2CppObjectBase)owner).TryCast<ChainedPuzzleInstance>(); if ((Object)(object)val != (Object)null) { return owner; } CP_Cluster_Core val2 = ((Il2CppObjectBase)owner).TryCast<CP_Cluster_Core>(); if ((Object)(object)val2 != (Object)null) { return val2.m_owner; } SPOLogger.Error("Failed to find CP_BioScan_Core owner (instance of ChainedPuzzleInstance)."); return null; } } } namespace ScanPosOverride.JSON { public static class InjectLibUtil { public const string PLUGIN_GUID = "GTFO.InjectLib"; public static JsonConverter InjectLibConnector { get; private set; } public static bool IsLoaded { get; private set; } static InjectLibUtil() { InjectLibConnector = null; IsLoaded = false; if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("GTFO.InjectLib", out var value)) { return; } try { Assembly assembly = ((value == null) ? null : value.Instance?.GetType()?.Assembly) ?? null; if ((object)assembly == null) { throw new Exception("Assembly is Missing!"); } Type[] types = assembly.GetTypes(); Type type = types.First((Type t) => t.Name == "InjectLibConnector"); if ((object)type == null) { throw new Exception("Unable to Find InjectLibConnector Class"); } InjectLibConnector = (JsonConverter)Activator.CreateInstance(type); IsLoaded = true; } catch (Exception value2) { SPOLogger.Error($"Exception thrown while reading data from GTFO.AWO: {value2}"); } } } internal class LocalizedTextConverter : JsonConverter<LocalizedText> { public override bool HandleNull => false; public override LocalizedText Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { //IL_001d: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown switch (reader.TokenType) { case JsonTokenType.String: { string untranslatedText = reader.GetString(); return new LocalizedText { Id = 0u, UntranslatedText = untranslatedText }; } case JsonTokenType.Number: return new LocalizedText { Id = reader.GetUInt32(), UntranslatedText = null }; default: throw new JsonException($"LocalizedTextJson type: {reader.TokenType} is not implemented!"); } } public override void Write(Utf8JsonWriter writer, LocalizedText value, JsonSerializerOptions options) { JsonSerializer.Serialize<LocalizedText>(writer, value, options); } } public sealed class MyVector3Converter : JsonConverter<Vector3> { public override bool HandleNull => false; public override Vector3 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { //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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) Vector3 vector = Vector3.zero; switch (reader.TokenType) { case JsonTokenType.StartObject: { int currentDepth = reader.CurrentDepth; while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject && reader.CurrentDepth == currentDepth) { SPOLogger.Warning($"Parsed Vector3 : {vector}"); return vector; } if (reader.TokenType != JsonTokenType.PropertyName) { throw new JsonException("Expected PropertyName token"); } string text2 = reader.GetString(); reader.Read(); switch (text2.ToLowerInvariant()) { case "x": vector.x = reader.GetSingle(); break; case "y": vector.y = reader.GetSingle(); break; case "z": vector.z = reader.GetSingle(); break; } } throw new JsonException("Expected EndObject token"); } case JsonTokenType.String: { string text = reader.GetString().Trim(); if (TryParseVector3(text, out vector)) { return vector; } throw new JsonException("Vector3 format is not right: " + text); } default: throw new JsonException($"Vector3Json type: {reader.TokenType} is not implemented!"); } } private static bool TryParseVector3(string input, out Vector3 vector) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) float[] array = default(float[]); if (!RegexUtils.TryParseVectorString(input, ref array)) { vector = Vector3.zero; return false; } if (array.Length < 3) { vector = Vector3.zero; return false; } vector = new Vector3(array[0], array[1], array[2]); return true; } public override void Write(Utf8JsonWriter writer, Vector3 value, JsonSerializerOptions options) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) writer.WriteStringValue($"({value.x} {value.y} {value.z})"); } } public sealed class WritableLocalizedTextConverter : JsonConverter<LocalizedText> { public static WritableLocalizedTextConverter Converter { get; } = new WritableLocalizedTextConverter(); public override bool HandleNull => false; public override LocalizedText Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (MTFOPartialDataUtil.LocalizedTextConverter != null) { return ((JsonConverter<LocalizedText>)MTFOPartialDataUtil.LocalizedTextConverter).Read(ref reader, typeToConvert, options); } throw new NotImplementedException(); } public override void Write(Utf8JsonWriter writer, LocalizedText value, JsonSerializerOptions options) { if (value.Id != 0) { JsonSerializer.Serialize(writer, value.Id, options); } else { JsonSerializer.Serialize(writer, value.UntranslatedText, options); } } } internal static class Json { private static readonly JsonSerializerOptions _setting; static Json() { _setting = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, IncludeFields = false, PropertyNameCaseInsensitive = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; _setting.Converters.Add(new JsonStringEnumConverter()); _setting.Converters.Add(new MyVector3Converter()); if (MTFOPartialDataUtil.IsLoaded && InjectLibUtil.IsLoaded) { _setting.Converters.Add(InjectLibUtil.InjectLibConnector); _setting.Converters.Add(new LocalizedTextConverter()); SPOLogger.Log("InjectLib (AWO) && PartialData support found!"); return; } if (MTFOPartialDataUtil.IsLoaded) { _setting.Converters.Add(MTFOPartialDataUtil.PersistentIDConverter); _setting.Converters.Add(WritableLocalizedTextConverter.Converter); SPOLogger.Log("PartialData support found!"); return; } if (InjectLibUtil.IsLoaded) { _setting.Converters.Add(InjectLibUtil.InjectLibConnector); SPOLogger.Log("InjectLib (AWO) support found!"); } _setting.Converters.Add(new LocalizedTextConverter()); } public static T Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, _setting); } public static object Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize<T>(T value) { return JsonSerializer.Serialize(value, _setting); } public static void Load<T>(string file, out T config) where T : new() { if (file.Length < ".json".Length) { config = default(T); return; } if (file.Substring(file.Length - ".json".Length) != ".json") { file += ".json"; } string path = Path.Combine(Plugin.OVERRIDE_SCAN_POS_PATH, file); file = File.ReadAllText(path); config = Deserialize<T>(file); } } public static class MTFOUtil { public const string PLUGIN_GUID = "com.dak.MTFO"; public const BindingFlags PUBLIC_STATIC = BindingFlags.Static | BindingFlags.Public; public static string GameDataPath { get; private set; } public static string CustomPath { get; private set; } public static bool HasCustomContent { get; private set; } public static bool IsLoaded { get; private set; } static MTFOUtil() { GameDataPath = string.Empty; CustomPath = string.Empty; HasCustomContent = false; IsLoaded = false; if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("com.dak.MTFO", out var value)) { return; } try { Assembly assembly = ((value == null) ? null : value.Instance?.GetType()?.Assembly) ?? null; if ((object)assembly == null) { throw new Exception("Assembly is Missing!"); } Type[] types = assembly.GetTypes(); Type type = types.First((Type t) => t.Name == "ConfigManager"); if ((object)type == null) { throw new Exception("Unable to Find ConfigManager Class"); } FieldInfo field = type.GetField("GameDataPath", BindingFlags.Static | BindingFlags.Public); FieldInfo field2 = type.GetField("CustomPath", BindingFlags.Static | BindingFlags.Public); FieldInfo field3 = type.GetField("HasCustomContent", BindingFlags.Static | BindingFlags.Public); if ((object)field == null) { throw new Exception("Unable to Find Field: GameDataPath"); } if ((object)field2 == null) { throw new Exception("Unable to Find Field: CustomPath"); } if ((object)field3 == null) { throw new Exception("Unable to Find Field: HasCustomContent"); } GameDataPath = (string)field.GetValue(null); CustomPath = (string)field2.GetValue(null); HasCustomContent = (bool)field3.GetValue(null); IsLoaded = true; } catch (Exception value2) { SPOLogger.Error($"Exception thrown while reading path from DataDumper (MTFO): \n{value2}"); } } } } namespace ScanPosOverride.JSON.PData { public class PDataGUID { public string GUID { get; set; } public uint ID { get; set; } } public static class MTFOPartialDataUtil { public const string PLUGIN_GUID = "MTFO.Extension.PartialBlocks"; public const string ID_FILE_NAME = "_persistentID.json"; private static Dictionary<string, uint> pdataGUID; public static JsonConverter PersistentIDConverter { get; private set; } public static JsonConverter LocalizedTextConverter { get; private set; } public static bool IsLoaded { get; private set; } public static bool Initialized { get; private set; } public static string PartialDataPath { get; private set; } public static string ConfigPath { get; private set; } static MTFOPartialDataUtil() { PersistentIDConverter = null; LocalizedTextConverter = null; IsLoaded = false; Initialized = false; PartialDataPath = string.Empty; ConfigPath = string.Empty; pdataGUID = null; if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("MTFO.Extension.PartialBlocks", out var value)) { return; } try { Assembly assembly = ((value == null) ? null : value.Instance?.GetType()?.Assembly) ?? null; if ((object)assembly == null) { throw new Exception("Assembly is Missing!"); } Type[] types = assembly.GetTypes(); Type type = types.First((Type t) => t.Name == "PersistentIDConverter"); if ((object)type == null) { throw new Exception("Unable to Find PersistentIDConverter Class"); } Type type2 = types.First((Type t) => t.Name == "PartialDataManager"); if ((object)type2 == null) { throw new Exception("Unable to Find PartialDataManager Class"); } Type type3 = types.First((Type t) => t.Name == "LocalizedTextConverter"); if ((object)type3 == null) { throw new Exception("Unable to Find LocalizedTextConverter Class"); } PropertyInfo property = type2.GetProperty("Initialized", BindingFlags.Static | BindingFlags.Public); PropertyInfo property2 = type2.GetProperty("PartialDataPath", BindingFlags.Static | BindingFlags.Public); PropertyInfo property3 = type2.GetProperty("ConfigPath", BindingFlags.Static | BindingFlags.Public); if ((object)property == null) { throw new Exception("Unable to Find Property: Initialized"); } if ((object)property2 == null) { throw new Exception("Unable to Find Property: PartialDataPath"); } if ((object)property3 == null) { throw new Exception("Unable to Find Field: ConfigPath"); } Initialized = (bool)property.GetValue(null); PartialDataPath = (string)property2.GetValue(null); ConfigPath = (string)property3.GetValue(null); PersistentIDConverter = (JsonConverter)Activator.CreateInstance(type); LocalizedTextConverter = (JsonConverter)Activator.CreateInstance(type3); IsLoaded = true; } catch (Exception value2) { SPOLogger.Error($"Exception thrown while reading data from MTFO_Extension_PartialData:\n{value2}"); } } internal static void ReadPDataGUID() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown if (pdataGUID != null) { return; } if (!IsLoaded) { SPOLogger.Error("ReadPDataGUID: invoked when not loaded, which is a broken operation"); return; } string path = Path.Combine(PartialDataPath, "_persistentID.json"); if (!File.Exists(path)) { SPOLogger.Error("ReadPDataGUID: PartialData GUID file not found"); return; } string json = File.ReadAllText(path); List<PDataGUID> list = Json.Deserialize<List<PDataGUID>>(json); pdataGUID = new Dictionary<string, uint>(); foreach (PDataGUID item in list) { if (!pdataGUID.TryAdd(item.GUID, item.ID)) { SPOLogger.Error("ReadPDataGUID: cannot add '" + item.GUID + "', probably there's a duplicate"); } } bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(33, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("ReadPDataGUID: Loaded "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(pdataGUID.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" PData GUID"); } SPOLogger.Log(val); } public static bool TryGetID(string guid, out uint id) { id = 0u; return pdataGUID?.TryGetValue(guid, out id) ?? false; } public static string ConvertAllGUID(string json) { if (!IsLoaded) { SPOLogger.Error("MTFOPartialDataUtil.ConvertAllGUID: partial data is not loaded"); return json; } JsonNode jsonNode = JsonNode.Parse(json, default(JsonNodeOptions), new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }); foreach (var item in (from i in jsonNode.DescendantItemsAndSelf() where i.name != null && i.node is JsonValue select i).ToList()) { if (item.Item1.GetValue<JsonElement>().ValueKind == JsonValueKind.String && item.Item3 != null && TryGetID(item.Item1.ToString(), out var id) && id != 0) { JsonObject jsonObject = (JsonObject)item.Item4; jsonObject.Remove(item.Item3); jsonObject.Add(item.Item3, (JsonNode)id); } } return jsonNode.ToString(); } } } namespace ScanPosOverride.JSON.Extensions { public static class JsonExtensions { public static IEnumerable<JsonNode?> Descendants(this JsonNode? root) { return root.DescendantsAndSelf(includeSelf: false); } public static IEnumerable<JsonNode?> DescendantsAndSelf(this JsonNode? root, bool includeSelf = true) { return from i in root.DescendantItemsAndSelf(includeSelf) select i.node; } public static IEnumerable<(JsonNode? node, int? index, string? name, JsonNode? parent)> DescendantItemsAndSelf(this JsonNode? root, bool includeSelf = true) { return RecursiveEnumerableExtensions.Traverse<(JsonNode, int?, string, JsonNode)>((root, null, null, null), delegate((JsonNode node, int? index, string name, JsonNode parent) i) { JsonNode item = i.node; if (1 == 0) { } IEnumerable<(JsonNode, int?, string, JsonNode)> result = (IEnumerable<(JsonNode, int?, string, JsonNode)>)((item is JsonObject o) ? (from p in o.AsDictionary() select ((JsonNode Value, int?, string, JsonNode))(Value: p.Value, null, p.Key.AsNullableReference(), i.node.AsNullableReference())) : ((!(item is JsonArray source)) ? ((IEnumerable)i.ToEmptyEnumerable()) : ((IEnumerable)source.Select((JsonNode item2, int index) => ((JsonNode item, int?, string, JsonNode))(item: item2, index.AsNullableValue(), null, i.node.AsNullableReference()))))); if (1 == 0) { } return result; }, includeSelf); } private static IEnumerable<T> ToEmptyEnumerable<T>(this T item) { return Enumerable.Empty<T>(); } private static T? AsNullableReference<T>(this T item) where T : class { return item; } private static T? AsNullableValue<T>(this T item) where T : struct { return item; } private static IDictionary<string, JsonNode?> AsDictionary(this JsonObject o) { return o; } } public static class RecursiveEnumerableExtensions { public static IEnumerable<T> Traverse<T>(T root, Func<T, IEnumerable<T>> children, bool includeSelf = true) { if (includeSelf) { yield return root; } Stack<IEnumerator<T>> stack = new Stack<IEnumerator<T>>(); try { stack.Push(children(root).GetEnumerator()); while (stack.Count != 0) { IEnumerator<T> enumerator = stack.Peek(); if (!enumerator.MoveNext()) { stack.Pop(); enumerator.Dispose(); } else { yield return enumerator.Current; stack.Push(children(enumerator.Current).GetEnumerator()); } } } finally { foreach (IEnumerator<T> enumerator3 in stack) { enumerator3.Dispose(); } } } } } namespace ScanPosOverride.Component { internal class ConcurrentClusterHud : MonoBehaviour { public enum PlayerCountRequirement { INVALID, ANY, SOLO, DUO } private StringBuilder displayText = new StringBuilder(); private bool m_isValid = false; private List<CP_Bioscan_Core> children; private float childRadius = -1f; private int[] playerInScanCount; private readonly string[] ROMAN = new string[4] { "I", "II", "III", "IV" }; internal CP_Cluster_Core parent { get; set; } internal CP_Bioscan_Hud parentHud { get; set; } internal PuzzleOverride def { get; set; } public PlayerCountRequirement playerCountReq { get; private set; } = PlayerCountRequirement.INVALID; private PlayerCountRequirement ReqPlayerCount(iChainedPuzzleCore child) { //IL_0015: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected I4, but got Unknown CP_Bioscan_Core val = ((Il2CppObjectBase)child).Cast<CP_Bioscan_Core>(); CP_PlayerScanner val2 = ((Il2CppObjectBase)val.m_playerScanner).Cast<CP_PlayerScanner>(); PlayerRequirement playerRequirement = val2.m_playerRequirement; Il2CppStructArray<float> scanSpeeds = val2.m_scanSpeeds; PlayerRequirement val3 = playerRequirement; PlayerRequirement val4 = val3; switch ((int)val4) { case 2: return (((Il2CppArrayBase<float>)(object)scanSpeeds)[0] > 0f) ? PlayerCountRequirement.SOLO : PlayerCountRequirement.INVALID; case 0: { int i; for (i = 0; i < ((Il2CppArrayBase<float>)(object)scanSpeeds).Count && ((Il2CppArrayBase<float>)(object)scanSpeeds)[i] == 0f; i++) { } if (i >= 2) { return PlayerCountRequirement.INVALID; } if (i == 1) { return PlayerCountRequirement.DUO; } return (((Il2CppArrayBase<float>)(object)scanSpeeds)[i + 1] > 0f) ? PlayerCountRequirement.ANY : PlayerCountRequirement.SOLO; } default: return PlayerCountRequirement.INVALID; } } internal bool Setup() { if (((Il2CppArrayBase<iChainedPuzzleCore>)(object)parent.m_childCores).Count < 2 || ((Il2CppArrayBase<iChainedPuzzleCore>)(object)parent.m_childCores).Count > 4) { SPOLogger.Error($"ConcurrentClusterHud: got cluster scan with {((Il2CppArrayBase<iChainedPuzzleCore>)(o
plugins/Vega/Custom/_crisplugins/SupplyCrateSetup.dll
Decompiled 18 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AIGraph; using AK; using Agents; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using GTFO.API; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem; using LevelGeneration; using Microsoft.CodeAnalysis; using Player; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("SupplyCrateSetup")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SupplyCrateSetup")] [assembly: AssemblyTitle("SupplyCrateSetup")] [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 SupplyCrateSetup { [BepInPlugin("cris.SupplyCrateSetup", "SupplyCrateSetup", "0.0.1")] public class EntryPoint : BasePlugin { private readonly string[] SupplyCratePrefabPaths = new string[3] { "Assets/EternalPrefabs/2026_F.04/geo_64x64_mining_refinery_I_HA_06_AW_F04.prefab", "Assets/EternalPrefabs/2026_F.04/geo_64x64_service_gardens_I_01_F04.prefab", "Assets/EternalPrefabs/2026_F.04/geo_64x64_service_gardens_dead_end_SF_F04.prefab" }; public static EntryPoint e; public override void Load() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown e = this; Harmony val = new Harmony("cris.SupplyCrateSetup"); ((BasePlugin)this).Log.LogInfo((object)"Loading SupplyCrateSetup..."); ClassInjector.RegisterTypeInIl2Cpp<SupplyCrateSetup>(); LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)OverrideInteraction); val.PatchAll(); ((BasePlugin)this).Log.LogInfo((object)"SupplyCrateSetup loaded."); } private void OverrideInteraction() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown string[] supplyCratePrefabPaths = SupplyCratePrefabPaths; bool flag = default(bool); foreach (string text in supplyCratePrefabPaths) { GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>(text); if ((Object)(object)loadedAsset != (Object)null) { ManualLogSource log = ((BasePlugin)this).Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SupplyCrateSetup] Processing prefab: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); } log.LogInfo(val); AddTargetComponent(loadedAsset); } else { ManualLogSource log2 = ((BasePlugin)this).Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[SupplyCrateSetup] Prefab not found at: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text); } log2.LogWarning(val2); } } } private void AddTargetComponent(GameObject prefab) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown bool flag = default(bool); foreach (Transform componentsInChild in prefab.GetComponentsInChildren<Transform>(true)) { if (!((Object)componentsInChild).name.Contains("GIVE")) { continue; } GameObject gameObject = ((Component)componentsInChild).gameObject; if ((Object)(object)gameObject.GetComponent<SupplyCrateSetup>() == (Object)null) { gameObject.AddComponent<SupplyCrateSetup>(); ManualLogSource log = ((BasePlugin)this).Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AmmoCrateSetup] Attached to: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)gameObject).name); } log.LogInfo(val); } } } } public class SupplyCrateSetup : MonoBehaviour { private enum CrateType { Ammo, Medi, Tool, Gear } private Interact_Timed m_interact; private CrateType type; private Dictionary<string, uint> gearListStandard = new Dictionary<string, uint> { { "Shelling S49", 300u }, { "Shelling Nano", 6700u }, { "Bataldo 3RB", 4700u }, { "Raptus Treffen 2", 2900u }, { "Raptus Steigro", 4500u }, { "Drekker Pres MOD 556", 4100u }, { "Malatack LX", 1200u }, { "Malatack CH 4", 3000u }, { "Van Auken CAB F4", 3400u }, { "Accrat Golok DA", 4000u }, { "TR22 Hanaway", 500u }, { "Hanaway PSB", 5000u }, { "Van Auken LTC5", 400u }, { "Accrat ND6", 4900u }, { "Accrat STB", 6000u }, { "Bataldo Custom K330", 6500u }, { "Buckland SBS III", 5100u }, { "Bataldo J 300", 6100u } }; private Dictionary<string, uint> gearListSpecial = new Dictionary<string, uint> { { "Mastaba R66", 1500u }, { "Shelling Arid 5", 6300u }, { "Drekker CLR", 6600u }, { "Malatack HXC", 4600u }, { "Buckland s870", 1300u }, { "Buckland XDist2", 4400u }, { "Drekker INEX Drei", 5600u }, { "Buckland AF6", 3100u }, { "TechMan Klust 6", 3900u }, { "TechMan Arbalist V", 1600u }, { "TechMan Veruta XII", 3800u }, { "Omneco exp1", 4300u }, { "Omneco LRG", 4200u }, { "Drekker DEL P1", 6200u }, { "Köning PR 11", 1400u } }; private void Awake() { m_interact = ((Component)this).GetComponent<Interact_Timed>(); Interact_Timed interact = m_interact; interact.OnInteractionTriggered += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)OnInteractComplete); string name = ((Object)((Component)this).gameObject).name; if (name.Contains("AMMO")) { type = CrateType.Ammo; } else if (name.Contains("MEDI")) { type = CrateType.Medi; } else if (name.Contains("TOOL")) { type = CrateType.Tool; } else if (name.Contains("GEAR")) { type = CrateType.Gear; } } private void OnInteractComplete(PlayerAgent player) { switch (type) { case CrateType.Ammo: GiveResource(player, 101u, 120f); break; case CrateType.Medi: GiveResource(player, 102u, 40f); break; case CrateType.Tool: GiveResource(player, 127u, 40f); break; case CrateType.Gear: SwapGear(player); break; } } private void GiveResource(PlayerAgent player, uint id, float ammo) { //IL_0016: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) ItemDataBlock block = GameDataBlockBase<ItemDataBlock>.GetBlock(id); InventorySlot inventorySlot = block.inventorySlot; PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); LocalPlayerAgent val = ((localPlayerAgent != null) ? ((Il2CppObjectBase)localPlayerAgent).TryCast<LocalPlayerAgent>() : null); pItemData val2 = default(pItemData); val2.custom = new pItemData_Custom { ammo = ammo, byteId = 0, byteState = 0 }; val2.itemID_gearCRC = id; val2.slot = inventorySlot; val2.originLayer = ((Agent)val).CourseNode.LayerType; pItemData val3 = val2; ((pCourseNode)(ref val3.originCourseNode)).Set(((Agent)player).CourseNode); ItemReplicationManager.SpawnItem(val3, DelegateSupport.ConvertDelegate<delItemCallback>((Delegate)(Action<ISyncedItem, PlayerAgent>)delegate(ISyncedItem item, PlayerAgent player) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) ItemInLevel val4 = ((Il2CppObjectBase)item).TryCast<ItemInLevel>(); if (!((Object)(object)val4 == (Object)null)) { ItemInLevel val5 = val4; if (val5.CourseNode == null) { AIG_CourseNode val6 = (val5.CourseNode = ((Agent)player).CourseNode); } val4.internalSync.AttemptPickupInteraction((ePickupItemInteractionType)2, player.Owner, new pItemData_Custom { ammo = ammo }, default(Vector3), default(Quaternion), (AIG_CourseNode)null, false, false); val4.internalSync.AttemptPickupInteraction((ePickupItemInteractionType)0, player.Owner, default(pItemData_Custom), default(Vector3), default(Quaternion), (AIG_CourseNode)null, false, false); } }), (ItemMode)2, ((Agent)player).Position + new Vector3(0f, 0.06f, 0f), ((Agent)player).Rotation, ((Agent)player).CourseNode, (PlayerAgent)(object)val); } private void SwapGear(PlayerAgent player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(player.Owner); PlayerAmmoStorage ammoStorage = backpack.AmmoStorage; PlayerOfflineGearDataBlock val = new PlayerOfflineGearDataBlock(); InventorySlot wieldedSlot = player.Inventory.WieldedSlot; if ((int)wieldedSlot == 1) { BackpackItem item = PlayerBackpackManager.GetItem(player.Owner, (InventorySlot)1); if (!gearListStandard.ContainsKey(item.GearIDRange.PublicGearName)) { return; } val = GameDataBlockBase<PlayerOfflineGearDataBlock>.GetBlock(gearListStandard[item.GearIDRange.PublicGearName]); } else { BackpackItem item2 = PlayerBackpackManager.GetItem(player.Owner, (InventorySlot)2); if (!gearListSpecial.ContainsKey(item2.GearIDRange.PublicGearName)) { return; } val = GameDataBlockBase<PlayerOfflineGearDataBlock>.GetBlock(gearListSpecial[item2.GearIDRange.PublicGearName]); } GearIDRange val2 = new GearIDRange(val.GearJSON); PlayerBackpackManager.EquipLocalGear(val2); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } } }
plugins/Vega/Custom/AggroFix_Revised.dll
Decompiled 18 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.Json.Serialization; using AIGraph; using API; using Agents; using AggroFix.BepInEx; using AggroFix.CustomSettings; using AggroFix.Dependencies; using AggroFix.JSON; using AggroFix.JSON.Converters; using AggroFix.Utils; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Enemies; using GTFO.API; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem.Collections.Generic; using LevelGeneration; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using StateMachines; using UnityEngine; using UnityEngine.Analytics; [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("AggroFix_Revised")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AggroFix_Revised")] [assembly: AssemblyTitle("AggroFix_Revised")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace API { [HarmonyPatch(typeof(GameDataInit))] internal class GameDataInit_Patches { [HarmonyPatch("Initialize")] [HarmonyWrapSafe] [HarmonyPostfix] public static void Initialize_Postfix() { Analytics.enabled = false; } } internal static class APILogger { private static readonly ManualLogSource logger; static APILogger() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown logger = new ManualLogSource("Rand-API"); Logger.Sources.Add((ILogSource)(object)logger); } private static string Format(string module, object msg) { return $"[{module}]: {msg}"; } public static void Info(string module, object data) { logger.LogMessage((object)Format(module, data)); } public static void Verbose(string module, object data) { logger.LogDebug((object)Format(module, data)); } public static void Log(object data) { logger.LogDebug((object)Format("AggroFix_Revised", data)); } public static void Debug(object data) { if (ConfigManager.Debug) { Log(data); } } public static void Warn(object data) { logger.LogWarning((object)Format("AggroFix_Revised", data)); } public static void Error(object data) { logger.LogError((object)Format("AggroFix_Revised", data)); } } } namespace AggroFix { internal static class DinoLogger { private static ManualLogSource logger = Logger.CreateLogSource("AggroFix"); 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); } } } [HarmonyPatch] internal static class Fix { private static bool patch = true; private static bool IsTargetReachable(AIG_CourseNode source, AIG_CourseNode target) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 if (source == null || target == null) { return false; } if (source.NodeID == target.NodeID) { return true; } AIG_SearchID.IncrementSearchID(); ushort searchID = AIG_SearchID.SearchID; Queue<AIG_CourseNode> queue = new Queue<AIG_CourseNode>(); queue.Enqueue(source); while (queue.Count > 0) { AIG_CourseNode val = queue.Dequeue(); ((AIG_CourseGraphMember)val).m_searchID = searchID; Enumerator<AIG_CoursePortal> enumerator = val.m_portals.GetEnumerator(); while (enumerator.MoveNext()) { AIG_CoursePortal current = enumerator.Current; LG_Gate gate = current.Gate; object obj; if (gate == null) { obj = null; } else { iLG_Door_Core spawnedDoor = gate.SpawnedDoor; obj = ((spawnedDoor != null) ? ((Il2CppObjectBase)spawnedDoor).TryCast<LG_SecurityDoor>() : null); } LG_SecurityDoor val2 = (LG_SecurityDoor)obj; if ((Object)(object)val2 != (Object)null && (int)val2.LastStatus != 10 && (int)val2.LastStatus != 16) { continue; } AIG_CourseNode oppositeNode = current.GetOppositeNode(val); if (((AIG_CourseGraphMember)oppositeNode).m_searchID != searchID) { if (oppositeNode.NodeID == target.NodeID) { return true; } queue.Enqueue(oppositeNode); } } } return false; } [HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")] [HarmonyPostfix] private static void UpdateTracking(EnemyCourseNavigation __instance) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 if (!SettingsManager.ActiveSettings.EnableAggroFix || !patch || !SNet.IsMaster) { return; } EnemyAgent owner = __instance.m_owner; if (((Agent)owner).CourseNode == null || __instance.m_targetRef == null || (Object)(object)__instance.m_targetRef.m_agent == (Object)null) { return; } ES_StateEnum stateEnum = ((StateMachine<ES_Base>)(object)owner.Locomotion).m_currentState.m_stateEnum; ES_StateEnum val = stateEnum; if ((int)val == 14) { return; } if (!IsTargetReachable(((Agent)owner).CourseNode, __instance.m_targetRef.m_agent.CourseNode)) { if (ConfigManager.Debug) { APILogger.Debug("Invalid current " + ((Il2CppObjectBase)__instance.m_targetRef.m_agent).Cast<PlayerAgent>().Owner.NickName); } bool flag = false; int num = Random.RandomRangeInt(0, PlayerManager.PlayerAgentsInLevel.Count); PlayerAgent val2 = PlayerManager.PlayerAgentsInLevel[num]; for (int i = 0; i < PlayerManager.PlayerAgentsInLevel.Count; i++) { APILogger.Debug("Checking " + val2.Owner.NickName); if (((Agent)val2).Alive && ((Object)val2).GetInstanceID() != ((Object)__instance.m_targetRef.m_agent).GetInstanceID() && IsTargetReachable(((Agent)owner).CourseNode, ((Agent)val2).CourseNode)) { flag = true; break; } num = (num + 1) % PlayerManager.PlayerAgentsInLevel.Count; val2 = PlayerManager.PlayerAgentsInLevel[num]; } if (flag) { APILogger.Debug("Rerouted to " + val2.Owner.NickName); patch = false; ((AgentAI)owner.AI).SetTarget((Agent)(object)val2); patch = true; } else if (ConfigManager.Debug) { APILogger.Debug("No valid target found " + ((Il2CppObjectBase)__instance.m_targetRef.m_agent).Cast<PlayerAgent>().Owner.NickName); } } else if (ConfigManager.Debug) { APILogger.Debug("Current " + ((Il2CppObjectBase)__instance.m_targetRef.m_agent).Cast<PlayerAgent>().Owner.NickName); } } } } namespace AggroFix.Utils { internal static class DictExtensions { public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key) where TValue : new() { if (!dict.TryGetValue(key, out TValue value)) { dict.Add(key, value = new TValue()); } return value; } } internal class DictListEnumerator<T> : IEnumerator<T>, IEnumerator, IDisposable { private readonly IEnumerator<List<T>> _valueEnumerator; private List<T>? _curList; private int _index; private T? _current; public T Current => _current; object IEnumerator.Current => Current; internal DictListEnumerator(Dictionary<string, List<T>> data) { _valueEnumerator = data.Values.GetEnumerator(); if (_valueEnumerator.MoveNext()) { _curList = _valueEnumerator.Current; } _index = -1; } public void Dispose() { } public bool MoveNext() { if (_curList == null || ++_index >= _curList.Count) { if (!_valueEnumerator.MoveNext()) { return false; } _curList = _valueEnumerator.Current; _index = 0; } _current = _curList[_index]; return true; } public void Reset() { _valueEnumerator.Reset(); if (_valueEnumerator.MoveNext()) { _curList = _valueEnumerator.Current; } _index = -1; } } internal static class StringExtensions { public static T ToEnum<T>(this string? value, T defaultValue) where T : struct { if (string.IsNullOrEmpty(value)) { return defaultValue; } T result; return Enum.TryParse<T>(value.Replace(" ", null), ignoreCase: true, out result) ? result : defaultValue; } } } namespace AggroFix.Dependencies { internal static class MTFOWrapper { public const string PLUGIN_GUID = "com.dak.MTFO"; public static readonly bool HasMTFO; public static string GameDataPath => HasMTFO ? GameDataPath_Unsafe() : ""; public static string CustomPath => HasMTFO ? CustomPath_Unsafe() : ""; public static bool HasCustomContent => HasMTFO && HasCustomContent_Unsafe(); static MTFOWrapper() { HasMTFO = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("com.dak.MTFO"); } [MethodImpl(MethodImplOptions.NoInlining)] private static string GameDataPath_Unsafe() { return MTFOPathAPI.RundownPath; } [MethodImpl(MethodImplOptions.NoInlining)] private static string CustomPath_Unsafe() { return MTFOPathAPI.CustomPath; } [MethodImpl(MethodImplOptions.NoInlining)] private static bool HasCustomContent_Unsafe() { return MTFOPathAPI.HasRundownPath; } } } namespace AggroFix.BepInEx { public static class Module { public const string GUID = "randomuserhi.AggroFix_Revised"; public const string Name = "AggroFix_Revised"; public const string Version = "0.0.1"; } public static class ConfigManager { public static ConfigFile configFile; private static ConfigEntry<bool> debug; public static bool Debug { get { return debug.Value; } set { debug.Value = value; } } static ConfigManager() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown string text = Path.Combine(Paths.ConfigPath, "AggroFix_Revised.cfg"); configFile = new ConfigFile(text, true); debug = configFile.Bind<bool>("Debug", "enable", false, "Enables debug messages when true."); } } [BepInPlugin("randomuserhi.AggroFix_Revised", "AggroFix_Revised", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("randomuserhi.AggroFix")] public class Plugin : BasePlugin { private static Harmony? harmony; public override void Load() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown SettingsManager.Init(); APILogger.Log("Plugin is loaded!"); harmony = new Harmony("randomuserhi.AggroFix_Revised"); harmony.PatchAll(); APILogger.Log("Debug is " + (ConfigManager.Debug ? "Enabled" : "Disabled")); } } } namespace AggroFix.JSON { public static class ISFJson { private static readonly JsonSerializerOptions _setting = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, IncludeFields = true, PropertyNameCaseInsensitive = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; public static T? Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, _setting); } public static T? Deserialize<T>(ref Utf8JsonReader reader) { return JsonSerializer.Deserialize<T>(ref reader, _setting); } public static object? Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize<T>(T value) { return JsonSerializer.Serialize(value, _setting); } public static void Serialize<T>(Utf8JsonWriter writer, T value) { JsonSerializer.Serialize(writer, value, _setting); } public static void Serialize<T>(Utf8JsonWriter writer, string name, T value) { writer.WritePropertyName(name); JsonSerializer.Serialize(writer, value, _setting); } } } namespace AggroFix.JSON.Converters { public sealed class LevelTargetConverter : JsonConverter<LevelTarget> { public override LevelTarget? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { LevelTarget levelTarget = new LevelTarget(); if (ParseTarget(ref reader, levelTarget, options)) { return levelTarget; } throw new JsonException("Expected level target to be a tier, tierindex, or level layout ID"); } private static bool ParseTarget(ref Utf8JsonReader reader, LevelTarget target, JsonSerializerOptions options) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 if (reader.TokenType == JsonTokenType.Null) { return true; } if (reader.TokenType == JsonTokenType.String) { string @string = reader.GetString(); if (@string.Length >= 5) { target.Tier = @string.Substring(0, 5).ToEnum<eRundownTier>((eRundownTier)99); } else { target.Tier = ("Tier" + @string[0]).ToEnum<eRundownTier>((eRundownTier)99); } int num = ((@string.Length < 5) ? 1 : 5); if ((int)target.Tier != 99 && @string.Length > num) { string text = @string; int num2 = num; if (int.TryParse(text.Substring(num2, text.Length - num2), out var result)) { target.TierIndex = result - 1; } else { target.Tier = (eRundownTier)99; } } if ((int)target.Tier == 99) { target.LevelLayoutID = JsonSerializer.Deserialize<uint>(ref reader, options); } return true; } if (reader.TokenType == JsonTokenType.Number) { target.LevelLayoutID = reader.GetUInt32(); return true; } return false; } public override void Write(Utf8JsonWriter writer, LevelTarget? value, JsonSerializerOptions options) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (value != null) { if (value.LevelLayoutID == 0 && (int)value.Tier == 99) { writer.WriteNullValue(); return; } if (value.LevelLayoutID != 0) { writer.WriteNumberValue(value.LevelLayoutID); return; } eRundownTier tier = value.Tier; string? text = ((object)(eRundownTier)(ref tier)).ToString(); writer.WriteStringValue(text[text.Length - 1] + ((value.TierIndex >= 0) ? (value.TierIndex + 1).ToString() : "")); } } } public sealed class SettingsDataConverter : JsonConverter<SettingsData> { public override SettingsData? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType == JsonTokenType.Null) { return null; } SettingsData settingsData = new SettingsData(); if (reader.TokenType != JsonTokenType.StartObject) { throw new JsonException("Expected Trigger Coordinator to be either a string or object"); } while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { return settingsData; } if (reader.TokenType != JsonTokenType.PropertyName) { throw new JsonException("Expected PropertyName token"); } string @string = reader.GetString(); reader.Read(); switch (@string.ToLowerInvariant()) { case "levels": case "level": if (reader.TokenType == JsonTokenType.StartArray) { settingsData.Levels = JsonSerializer.Deserialize<LevelTarget[]>(ref reader, options); } else if (reader.TokenType != JsonTokenType.Null) { settingsData.Levels = new LevelTarget[1] { JsonSerializer.Deserialize<LevelTarget>(ref reader, options) }; } break; case "enableaggrofix": settingsData.EnableAggroFix = reader.GetBoolean(); break; } } throw new JsonException("Expected EndObject token"); } public override void Write(Utf8JsonWriter writer, SettingsData? value, JsonSerializerOptions options) { if (value == null) { writer.WriteNullValue(); return; } writer.WriteStartObject(); writer.WritePropertyName("Levels"); if (value.Levels.Length == 0) { writer.WriteNullValue(); } else if (value.Levels.Length == 1) { JsonSerializer.Serialize(writer, value.Levels[0], options); } else { JsonSerializer.Serialize(writer, value.Levels, options); } writer.WriteNumber("RundownID", value.RundownID); writer.WriteBoolean("EnableAggroFix", value.EnableAggroFix); writer.WriteEndObject(); } } } namespace AggroFix.CustomSettings { [JsonConverter(typeof(LevelTargetConverter))] public sealed class LevelTarget { public uint LevelLayoutID { get; set; } = 0u; public eRundownTier Tier { get; set; } = (eRundownTier)99; public int TierIndex { get; set; } = -1; public bool IsMatch(uint layoutID, eRundownTier tier, int tierIndex) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (layoutID == LevelLayoutID) { return true; } if (Tier == tier && (TierIndex == -1 || TierIndex == tierIndex)) { return true; } return false; } } [JsonConverter(typeof(SettingsDataConverter))] public sealed class SettingsData { public static readonly SettingsData Default = new SettingsData(); public static readonly SettingsData[] Template = new SettingsData[3] { new SettingsData { Levels = new LevelTarget[1] { new LevelTarget { LevelLayoutID = 420u } }, EnableAggroFix = true }, new SettingsData { Levels = new LevelTarget[1] { new LevelTarget { Tier = (eRundownTier)1 } }, EnableAggroFix = true }, new SettingsData { Levels = new LevelTarget[2] { new LevelTarget { LevelLayoutID = 4115u }, new LevelTarget { Tier = (eRundownTier)2, TierIndex = 0 } }, EnableAggroFix = true } }; public uint RundownID = 0u; public LevelTarget[] Levels { get; set; } = Array.Empty<LevelTarget>(); public bool EnableAggroFix { get; set; } = false; } public sealed class SettingsManager { public static readonly SettingsManager Current; private static (eRundownTier tier, int tierIndex) _currentLevel; private readonly Dictionary<string, List<SettingsData>> _fileToData = new Dictionary<string, List<SettingsData>>(); private readonly LiveEditListener _liveEditListener; public static SettingsData ActiveSettings { get; set; } private void FileChanged(LiveEditEventArgs e) { LiveEditEventArgs e2 = e; DinoLogger.Warning("LiveEdit File Changed: " + e2.FileName); LiveEdit.TryReadFileContent(e2.FullPath, (Action<string>)delegate(string content) { ReadFileContent(e2.FullPath, content); }); } private void FileDeleted(LiveEditEventArgs e) { DinoLogger.Warning("LiveEdit File Removed: " + e.FileName); _fileToData.Remove(e.FullPath); RefreshSettings(); } private void FileCreated(LiveEditEventArgs e) { LiveEditEventArgs e2 = e; DinoLogger.Warning("LiveEdit File Created: " + e2.FileName); LiveEdit.TryReadFileContent(e2.FullPath, (Action<string>)delegate(string content) { ReadFileContent(e2.FullPath, content); }); } private void ReadFileContent(string file, string content) { _fileToData.Remove(file); List<SettingsData> list = null; try { list = ISFJson.Deserialize<List<SettingsData>>(content); } catch (JsonException ex) { DinoLogger.Error("Error parsing settings json " + file); DinoLogger.Error(ex.Message); } if (list != null) { _fileToData[file] = list; RefreshSettings(); } } private static uint ActiveRundownID() { string activeRundownKey = RundownManager.ActiveRundownKey; uint result = default(uint); if (!RundownManager.RundownProgressionReady || !RundownManager.TryGetIdFromLocalRundownKey(activeRundownKey, ref result)) { return 0u; } return result; } private static void RefreshSettings() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) SettingsData activeSettings = ActiveSettings; ActiveSettings = SettingsData.Default; uint num = ActiveRundownID(); if (num == 0) { return; } pActiveExpedition activeExpeditionData = RundownManager.GetActiveExpeditionData(); if ((int)activeExpeditionData.tier == 99) { return; } if (_currentLevel.tier == activeExpeditionData.tier && _currentLevel.tierIndex == activeExpeditionData.expeditionIndex) { ActiveSettings = activeSettings; return; } uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData; IEnumerator<SettingsData> enumerator = Current.GetEnumerator(); while (enumerator.MoveNext()) { SettingsData current = enumerator.Current; if (current.RundownID != 0 && current.RundownID != num) { continue; } LevelTarget[] levels = current.Levels; foreach (LevelTarget levelTarget in levels) { if (levelTarget.IsMatch(levelLayoutData, activeExpeditionData.tier, activeExpeditionData.expeditionIndex)) { ActiveSettings = current; if (ActiveSettings.EnableAggroFix) { APILogger.Warn("Enabled=true, AggroFix Working."); } else { APILogger.Warn("Enabled=false, AggroFix Non-Working."); } return; } } } APILogger.Warn("Level Non-Detected in JSON. AggroFix doesn't load."); } private SettingsManager() { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown if (!MTFOWrapper.HasCustomContent) { DinoLogger.Log($"No custom path detected! Has MTFO? {MTFOWrapper.HasMTFO}"); return; } string text = Path.Combine(MTFOWrapper.CustomPath, "AggroFix_Revised"); if (!Directory.Exists(text)) { DinoLogger.Log("No settings directory detected. Creating template."); Directory.CreateDirectory(text); StreamWriter streamWriter = File.CreateText(Path.Combine(text, "Template.json")); streamWriter.WriteLine(ISFJson.Serialize(SettingsData.Template)); streamWriter.Flush(); streamWriter.Close(); } else { DinoLogger.Log("SettingsData directory detected."); } foreach (string item in Directory.EnumerateFiles(text, "*.json", SearchOption.AllDirectories)) { string content = File.ReadAllText(item); ReadFileContent(item, content); } _liveEditListener = LiveEdit.CreateListener(text, "*.json", true); _liveEditListener.FileCreated += new LiveEditEventHandler(FileCreated); _liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged); _liveEditListener.FileDeleted += new LiveEditEventHandler(FileDeleted); } static SettingsManager() { ActiveSettings = SettingsData.Default; _currentLevel = ((eRundownTier)99, 0); Current = new SettingsManager(); } internal static void Init() { LevelAPI.OnBuildStart += RefreshSettings; } public List<SettingsData> GetSettingsData() { List<SettingsData> list2 = new List<SettingsData>(_fileToData.Values.Sum((List<SettingsData> list) => list.Count)); IEnumerator<SettingsData> enumerator = GetEnumerator(); while (enumerator.MoveNext()) { list2.Add(enumerator.Current); } return list2; } public IEnumerator<SettingsData> GetEnumerator() { return new DictListEnumerator<SettingsData>(_fileToData); } } }
plugins/Vega/Custom/CullBucketTwoSidedLogFilter.dll
Decompiled 18 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; [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("CullBucketTwoSidedLogFilter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CullBucketTwoSidedLogFilter")] [assembly: AssemblyTitle("CullBucketTwoSidedLogFilter")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } [CompilerGenerated] [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 CullBucketTwoSidedLogFilter { [BepInPlugin("moomallaengi.gtfo.cullbucket_twosided_log_filter", "CullBucket TwoSided Log Filter", "1.1.0")] public sealed class Plugin : BasePlugin { public const string PluginGuid = "moomallaengi.gtfo.cullbucket_twosided_log_filter"; public const string PluginName = "CullBucket TwoSided Log Filter"; public const string PluginVersion = "1.1.0"; private Harmony? _harmony; internal static ConfigEntry<bool> SuppressExtraObjectiveSetupLSSMasterSync { get; private set; } public override void Load() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown SuppressExtraObjectiveSetupLSSMasterSync = ((BasePlugin)this).Config.Bind<bool>("Filters", "SuppressExtraObjectiveSetupLSSMasterSync", true, "When true, suppresses exactly: [Debug :ExtraObjectiveSetup] LSS: master synced 4 in 15 seconds"); _harmony = new Harmony("moomallaengi.gtfo.cullbucket_twosided_log_filter"); _harmony.PatchAll(typeof(Plugin).Assembly); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(64, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CullBucket TwoSided Log Filter"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.1.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded. "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("TwoSided filter: ON; "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("ExtraObjectiveSetup LSS filter: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(SuppressExtraObjectiveSetupLSSMasterSync.Value ? "ON" : "OFF"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); } } internal static class LogFilterRules { internal const string TwoSidedMessage = "C_CullBucket : AddToRenderLists : We do not support TwoSided!"; internal const string ExtraObjectiveSetupSource = "ExtraObjectiveSetup"; internal const string ExtraObjectiveSetupLSSMessage = "LSS: master synced 4 in 15 seconds"; internal static bool ShouldSuppressExtraObjectiveSetup(ManualLogSource source, LogLevel level, string? message) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!Plugin.SuppressExtraObjectiveSetupLSSMasterSync.Value) { return false; } return (int)level == 32 && string.Equals(source.SourceName, "ExtraObjectiveSetup", StringComparison.Ordinal) && string.Equals(message, "LSS: master synced 4 in 15 seconds", StringComparison.Ordinal); } } [HarmonyPatch(typeof(IL2CPPUnityLogSource), "UnityLogCallback")] internal static class UnityLogCallbackPatch { private static bool Prefix(string logLine) { return !string.Equals(logLine?.Trim(), "C_CullBucket : AddToRenderLists : We do not support TwoSided!", StringComparison.Ordinal); } } [HarmonyPatch(typeof(ManualLogSource), "Log", new Type[] { typeof(LogLevel), typeof(object) })] internal static class ManualLogSourceObjectPatch { private static bool Prefix(ManualLogSource __instance, LogLevel level, object data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return !LogFilterRules.ShouldSuppressExtraObjectiveSetup(__instance, level, data?.ToString()); } } [HarmonyPatch(typeof(ManualLogSource), "Log", new Type[] { typeof(LogLevel), typeof(BepInExLogInterpolatedStringHandler) })] internal static class ManualLogSourceInterpolatedPatch { private static bool Prefix(ManualLogSource __instance, LogLevel level, BepInExLogInterpolatedStringHandler logHandler) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (!Plugin.SuppressExtraObjectiveSetupLSSMasterSync.Value || (int)level != 32 || !string.Equals(__instance.SourceName, "ExtraObjectiveSetup", StringComparison.Ordinal)) { return true; } return !string.Equals(((object)logHandler).ToString(), "LSS: master synced 4 in 15 seconds", StringComparison.Ordinal); } } }
plugins/Vega/Custom/DecorativeReactorFix.dll
Decompiled 18 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AIGraph; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using GTFO.API; using GameData; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Microsoft.CodeAnalysis; 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("DecorativeReactorFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.5.0.0")] [assembly: AssemblyInformationalVersion("1.5.0")] [assembly: AssemblyProduct("DecorativeReactorFix")] [assembly: AssemblyTitle("DecorativeReactorFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } [CompilerGenerated] [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 DecorativeReactorFix { internal static class DecorativeReactorMatcher { private static readonly HashSet<IntPtr> LoggedReactors = new HashSet<IntPtr>(); internal static bool IsTarget(LG_WardenObjective_Reactor? reactor, bool log = false) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected I4, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected I4, but got Unknown if ((Object)(object)reactor == (Object)null) { return false; } try { ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; uint num = ((activeExpedition != null) ? activeExpedition.LevelLayoutData : 0u); if (num != Plugin.MainLevelLayoutId.Value) { return false; } string value = Plugin.TargetObjectNameContains.Value; if (!string.IsNullOrWhiteSpace(value) && HierarchyNameContains(reactor, value)) { LogMatch(reactor, num, Plugin.TargetLayer.Value, Plugin.TargetZone.Value, "hierarchy-name '" + value + "'", log); return true; } AIG_CourseNode spawnNode = reactor.SpawnNode; if (spawnNode == null || (Object)(object)spawnNode.m_zone == (Object)null) { return false; } int num2 = (int)spawnNode.LayerType; int num3 = (int)spawnNode.m_zone.LocalIndex; if (num2 != Plugin.TargetLayer.Value || num3 != Plugin.TargetZone.Value) { return false; } LogMatch(reactor, num, num2, num3, "SpawnNode", log); return true; } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(49, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed while checking decorative reactor target: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); return false; } } private static bool HierarchyNameContains(LG_WardenObjective_Reactor reactor, string fragment) { try { Transform val = ((Component)reactor).transform; int num = 0; while ((Object)(object)val != (Object)null && num < 8) { string text = (((Object)(object)((Component)val).gameObject != (Object)null) ? ((Object)((Component)val).gameObject).name : null); if (!string.IsNullOrEmpty(text) && text.IndexOf(fragment, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } val = val.parent; num++; } } catch { } return false; } private static void LogMatch(LG_WardenObjective_Reactor reactor, uint layout, int layer, int zone, string source, bool log) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (!log || !LoggedReactors.Add(((Il2CppObjectBase)reactor).Pointer)) { return; } string text = "<unknown>"; try { if ((Object)(object)((Component)reactor).gameObject != (Object)null) { text = ((Object)((Component)reactor).gameObject).name; } } catch { } ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(75, 6, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Decorative reactor matched via "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(source); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": layout="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(layout); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", layer="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(layer); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", zone="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(zone); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("object='"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("', ptr=0x"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<long>(((Il2CppObjectBase)reactor).Pointer.ToInt64(), "X"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } logger.LogWarning(val); } internal static void Reset() { LoggedReactors.Clear(); } } [BepInPlugin("dev.openai.gtfo.decorativereactorfix", "Decorative Reactor Fix", "1.5.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BasePlugin { public const string PluginGuid = "dev.openai.gtfo.decorativereactorfix"; public const string PluginName = "Decorative Reactor Fix"; public const string PluginVersion = "1.5.1"; internal static ManualLogSource Logger; internal static ConfigEntry<uint> MainLevelLayoutId; internal static ConfigEntry<int> TargetLayer; internal static ConfigEntry<int> TargetZone; internal static ConfigEntry<string> TargetObjectNameContains; internal static ConfigEntry<bool> VerboseLogging; public override void Load() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Logger = ((BasePlugin)this).Log; MainLevelLayoutId = ((BasePlugin)this).Config.Bind<uint>("Target", "MainLevelLayoutId", 626262u, "Only modify the decorative reactor in this Main Level Layout."); TargetLayer = ((BasePlugin)this).Config.Bind<int>("Target", "Layer", 0, "LG_LayerType numeric value. 0 = MainLayer, 1 = SecondaryLayer, 2 = ThirdLayer."); TargetZone = ((BasePlugin)this).Config.Bind<int>("Target", "Zone", 0, "Local zone index containing the decorative reactor component (late fallback)."); TargetObjectNameContains = ((BasePlugin)this).Config.Bind<string>("Target", "ObjectNameContains", "geo_data-center_hub_01(Clone)_ID_1", "Early-match hierarchy name for the decorative reactor geomorph. This is used before SpawnNode is populated."); VerboseLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "VerboseLogging", true, "Log neutralization/removal timing and final REACTOR_xxx registry contents."); new Harmony("dev.openai.gtfo.decorativereactorfix").PatchAll(Assembly.GetExecutingAssembly()); LevelAPI.OnAfterBuildBatch += ReactorDeferredRemoval.OnAfterBuildBatch; LevelAPI.OnBuildDone += ReactorDeferredRemoval.OnBuildDone; LevelAPI.OnLevelCleanup += ReactorDeferredRemoval.Reset; Logger.LogInfo((object)($"{"Decorative Reactor Fix"} {"1.5.1"} loaded. Target layout={MainLevelLayoutId.Value}, layer={TargetLayer.Value}, zone={TargetZone.Value}, name~='{TargetObjectNameContains.Value}'. " + "Strategy=early-name-neutralize + deferred component removal + terminal-registry unregister.")); } } internal static class ReactorDeferredRemoval { private static readonly HashSet<IntPtr> Neutralized = new HashSet<IntPtr>(); private static readonly HashSet<IntPtr> SetupCompleted = new HashSet<IntPtr>(); private static readonly HashSet<IntPtr> Removed = new HashSet<IntPtr>(); private static readonly HashSet<string> DecorativeTerminalKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase); [HarmonyPrefix] [HarmonyPriority(800)] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "GenericObjectiveSetup")] private static void BeforeGenericObjectiveSetup(LG_WardenObjective_Reactor __instance) { if (!DecorativeReactorMatcher.IsTarget(__instance, log: true)) { return; } IntPtr pointer = ((Il2CppObjectBase)__instance).Pointer; if (!(pointer == IntPtr.Zero)) { bool isWardenObjective = __instance.m_isWardenObjective; __instance.m_isWardenObjective = false; if (Neutralized.Add(pointer)) { Plugin.Logger.LogWarning((object)($"NEUTRALIZED decorative reactor BEFORE GenericObjectiveSetup: m_isWardenObjective {isWardenObjective} -> false, ptr=0x{pointer.ToInt64():X}. " + "Vanilla setup will continue so CustomGeomorphBuildJob keeps valid references.")); } } } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "GenericObjectiveSetup")] private static void AfterGenericObjectiveSetup(LG_WardenObjective_Reactor __instance) { if (!DecorativeReactorMatcher.IsTarget(__instance)) { return; } IntPtr pointer = ((Il2CppObjectBase)__instance).Pointer; if (!(pointer == IntPtr.Zero)) { __instance.m_isWardenObjective = false; string text = SafeGetItemKey(__instance); if (!string.IsNullOrEmpty(text)) { DecorativeTerminalKeys.Add(text); } if (SetupCompleted.Add(pointer)) { string value = (((Object)(object)__instance.m_terminal != (Object)null) ? "terminal=ready" : "terminal=null"); Plugin.Logger.LogInfo((object)($"Decorative reactor GenericObjectiveSetup completed safely ({value}, key='{text}'). " + "Waiting until AFTER CustomGeomorphBuildJob for unregister + component removal.")); } } } internal unsafe static void OnAfterBuildBatch(BatchName batch) { if (string.Equals(((object)(*(BatchName*)(&batch))/*cast due to .constrained prefix*/).ToString(), "CustomGeomorphBuildJob", StringComparison.Ordinal)) { ScanUnregisterAndRemoveAfterCustomGeomorphBatch(); } } private static void ScanUnregisterAndRemoveAfterCustomGeomorphBatch() { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown bool flag2 = default(bool); try { ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; if (((activeExpedition != null) ? activeExpedition.LevelLayoutData : 0) != Plugin.MainLevelLayoutId.Value) { return; } Il2CppReferenceArray<Object> val = Resources.FindObjectsOfTypeAll(Il2CppType.Of<LG_WardenObjective_Reactor>()); if (val == null || ((Il2CppArrayBase<Object>)(object)val).Length == 0) { Plugin.Logger.LogWarning((object)"AFTER CustomGeomorphBuildJob: no LG_WardenObjective_Reactor objects were found."); return; } int num = 0; for (int i = 0; i < ((Il2CppArrayBase<Object>)(object)val).Length; i++) { Object obj = ((Il2CppArrayBase<Object>)(object)val)[i]; LG_WardenObjective_Reactor val2 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast<LG_WardenObjective_Reactor>() : null); if ((Object)(object)val2 == (Object)null || !DecorativeReactorMatcher.IsTarget(val2, log: true)) { continue; } IntPtr pointer = ((Il2CppObjectBase)val2).Pointer; if (pointer == IntPtr.Zero || !Removed.Add(pointer)) { continue; } try { val2.m_isWardenObjective = false; string text = SafeGetItemKey(val2); if (!string.IsNullOrEmpty(text)) { DecorativeTerminalKeys.Add(text); } bool flag = UnregisterTerminalItemKey(text, "AFTER CustomGeomorphBuildJob"); BepInExWarningLogInterpolatedStringHandler val3; try { if ((Object)(object)val2.m_terminal != (Object)null) { val2.m_terminal.ConnectedReactor = null; } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; val3 = new BepInExWarningLogInterpolatedStringHandler(46, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Could not detach decorative reactor terminal: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } logger.LogWarning(val3); } string text2 = (((Object)(object)((Component)val2).gameObject != (Object)null) ? ((Object)((Component)val2).gameObject).name : "<unknown gameobject>"); Object.DestroyImmediate((Object)(object)val2); num++; ManualLogSource logger2 = Plugin.Logger; val3 = new BepInExWarningLogInterpolatedStringHandler(160, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("REMOVED decorative LG_WardenObjective_Reactor from '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text2); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' AFTER CustomGeomorphBuildJob. "); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("terminalKey='"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("', registryRemoved="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(flag); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(". Geomorph visuals/colliders were preserved."); } logger2.LogWarning(val3); } catch (Exception ex2) { Removed.Remove(pointer); ManualLogSource logger3 = Plugin.Logger; BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(44, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("FAILED deferred reactor unregister/removal: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex2); } logger3.LogError(val4); } } if (num == 0) { Plugin.Logger.LogWarning((object)"AFTER CustomGeomorphBuildJob: target decorative reactor was not removed. Check the NEUTRALIZED/GenericObjectiveSetup logs."); } LogReactorRegistry("after decorative reactor removal"); } catch (Exception ex3) { ManualLogSource logger4 = Plugin.Logger; BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(49, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Deferred reactor scan/unregister/removal failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex3); } logger4.LogError(val4); } } internal static void OnBuildDone() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown try { ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; if (((activeExpedition != null) ? activeExpedition.LevelLayoutData : 0) != Plugin.MainLevelLayoutId.Value) { return; } foreach (string decorativeTerminalKey in DecorativeTerminalKeys) { UnregisterTerminalItemKey(decorativeTerminalKey, "OnBuildDone backup cleanup"); } LogReactorRegistry("OnBuildDone final verification"); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(56, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("OnBuildDone decorative reactor registry cleanup failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); } } private static bool UnregisterTerminalItemKey(string key, string phase) { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if (string.IsNullOrWhiteSpace(key)) { return false; } bool flag4 = default(bool); try { LG_LevelInteractionManager current = LG_LevelInteractionManager.Current; if ((Object)(object)current == (Object)null || current.m_terminalItemsByKeyString == null) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(71, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(phase); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": LG_LevelInteractionManager terminal registry is not ready for key '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(key); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'."); } logger.LogWarning(val); return false; } bool flag2 = current.m_terminalItemsByKeyString.ContainsKey(key); if (flag2) { current.m_terminalItemsByKeyString.Remove(key); } bool flag3 = current.m_terminalItemsByKeyString.ContainsKey(key); ManualLogSource logger2 = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(54, 4, ref flag4); if (flag4) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(phase); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": unregister terminal item '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(key); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("': existed="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(flag2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", stillExists="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(flag3); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("."); } logger2.LogInfo(val2); return flag2 && !flag3; } catch (Exception ex) { ManualLogSource logger3 = Plugin.Logger; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(41, 3, ref flag4); if (flag4) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(phase); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": failed to unregister terminal item '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(key); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("': "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex); } logger3.LogError(val3); return false; } } private static string SafeGetItemKey(LG_WardenObjective_Reactor reactor) { try { if (!string.IsNullOrEmpty(reactor.m_itemKey)) { return reactor.m_itemKey; } if ((Object)(object)reactor.m_terminalItemComp != (Object)null) { LG_GenericTerminalItem val = ((Il2CppObjectBase)reactor.m_terminalItemComp).TryCast<LG_GenericTerminalItem>(); if ((Object)(object)val != (Object)null) { string terminalItemKey = val.TerminalItemKey; if (!string.IsNullOrEmpty(terminalItemKey)) { return terminalItemKey; } } } } catch { } return string.Empty; } private static void LogReactorRegistry(string phase) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if (!Plugin.VerboseLogging.Value) { return; } bool flag = default(bool); try { LG_LevelInteractionManager current = LG_LevelInteractionManager.Current; if ((Object)(object)current == (Object)null || current.m_terminalItemsByKeyString == null) { return; } List<string> list = new List<string>(); Enumerator<string, iTerminalItem> enumerator = current.m_terminalItemsByKeyString.GetEnumerator(); while (enumerator.MoveNext()) { string key = enumerator.Current.Key; if (!string.IsNullOrEmpty(key) && key.StartsWith("REACTOR_", StringComparison.OrdinalIgnoreCase)) { list.Add(key); } } ManualLogSource logger = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Reactor terminal registry "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(phase); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": count="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", keys=["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(string.Join(", ", list)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]"); } logger.LogInfo(val); } catch (Exception ex) { ManualLogSource logger2 = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(55, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Could not enumerate reactor terminal registry during "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(phase); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger2.LogWarning(val2); } } internal static void Reset() { Neutralized.Clear(); SetupCompleted.Clear(); Removed.Clear(); DecorativeTerminalKeys.Clear(); DecorativeReactorMatcher.Reset(); } } }
plugins/Vega/Custom/ForcedBloomOn.dll
Decompiled 18 hours agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using HarmonyLib; [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("ForcedBloomOn")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ForcedBloomOn")] [assembly: AssemblyTitle("ForcedBloomOn")] [assembly: AssemblyVersion("1.0.0.0")] namespace ForcedBloomOn; public class ForcedBloomOn { [HarmonyPatch] internal static class GraphicsSettings_ForceBloomEnabled { [HarmonyPrefix] [HarmonyPatch(typeof(CellSettingsApply), "ApplyBloomEnabled")] private static void Pre_CellSettingsApply_ApplyBloomEnabled(ref bool value) { value = true; } } }
plugins/Vega/Custom/Inas07.ThermalSights.dll
Decompiled 18 hours agousing System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json.Serialization; using AssetShards; using BepInEx; using BepInEx.Unity.IL2CPP; using ChainedPuzzles; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.Expedition.Gears; using ExtraObjectiveSetup.Utils; using FirstPersonItem; using GTFO.API; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Microsoft.CodeAnalysis; using ThermalSights.Definition; 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.ThermalSights")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Inas07.ThermalSights")] [assembly: AssemblyTitle("Inas07.ThermalSights")] [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 ThermalSights { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Inas.ThermalSights", "ThermalSights", "1.0.0")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string PLUGIN_NAME = "ThermalSights"; public const string VERSION = "1.0.0"; private Harmony m_Harmony; public override void Load() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown SetupManagers(); m_Harmony = new Harmony("ThermalSights"); m_Harmony.PatchAll(); EOSLogger.Log("ThermalSights loaded."); } private void SetupManagers() { AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)delegate { ((GenericDefinitionManager<TSADefinition>)TSAManager.Current).Init(); }); } } public class TSAManager : GenericDefinitionManager<TSADefinition> { public class PuzzleVisualWrapper { public GameObject GO { get; set; } public Renderer Renderer { get; set; } public float Intensity { get; set; } public float BehindWallIntensity { get; set; } public void SetIntensity(float t) { if (GO.active) { if (Intensity > 0f) { Renderer.material.SetFloat("_Intensity", Intensity * t); } if (BehindWallIntensity > 0f) { Renderer.material.SetFloat("_BehindWallIntensity", BehindWallIntensity * t); } } } } private const bool OUTPUT_THERMAL_SHADER_SETTINGS_ON_WIELD = false; public static TSAManager Current { get; } protected override string DEFINITION_NAME => "ThermalSight"; private Dictionary<uint, Renderer[]> InLevelGearThermals { get; } = new Dictionary<uint, Renderer[]>(); private HashSet<uint> ModifiedInLevelGearThermals { get; } = new HashSet<uint>(); private HashSet<uint> ThermalOfflineGears { get; } = new HashSet<uint>(); public uint CurrentGearPID { get; private set; } private List<PuzzleVisualWrapper> PuzzleVisuals { get; } = new List<PuzzleVisualWrapper>(); protected override void FileChanged(LiveEditEventArgs e) { base.FileChanged(e); InitThermalOfflineGears(); CleanupInLevelGearThermals(keepCurrentGear: true); TrySetThermalSightRenderer(CurrentGearPID); } public override void Init() { InitThermalOfflineGears(); } private void InitThermalOfflineGears() { ThermalOfflineGears.Clear(); foreach (PlayerOfflineGearDataBlock allBlock in GameDataBlockBase<PlayerOfflineGearDataBlock>.GetAllBlocks()) { if (((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)allBlock).name.ToLowerInvariant().EndsWith("_t")) { ThermalOfflineGears.Add(((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)allBlock).persistentID); } } EOSLogger.Debug($"Found OfflineGear with thermal sight, count: {ThermalOfflineGears.Count}"); } private bool TryGetInLevelGearThermalRenderersFromItem(ItemEquippable item, uint gearPID, out Renderer[] renderers) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) renderers = null; if (item.GearIDRange == null) { return false; } if (gearPID == 0) { gearPID = ExpeditionGearManager.GetOfflineGearPID(item.GearIDRange); } if (gearPID == 0 || !IsGearWithThermal(gearPID)) { return false; } bool flag = false; if (!InLevelGearThermals.ContainsKey(gearPID)) { flag = true; } else { try { _ = ((Component)InLevelGearThermals[gearPID][0]).gameObject.transform.position; flag = false; } catch { ModifiedInLevelGearThermals.Remove(gearPID); flag = true; } } if (flag) { renderers = (from x in ((IEnumerable<Renderer>)((Component)item).GetComponentsInChildren<Renderer>(true))?.Where((Renderer x) => (Object)(object)x.sharedMaterial != (Object)null && (Object)(object)x.sharedMaterial.shader != (Object)null) where ((Object)x.sharedMaterial.shader).name.ToLower().Contains("Thermal".ToLower()) select x).ToArray() ?? null; if (renderers != null) { if (renderers.Length != 1) { EOSLogger.Warning(((Item)item).PublicName + " contains more than 1 thermal renderers!"); } InLevelGearThermals[gearPID] = renderers; return true; } EOSLogger.Debug(((Item)item).PublicName + ": thermal renderer not found"); return false; } renderers = InLevelGearThermals[gearPID]; return true; } internal bool TrySetThermalSightRenderer(uint gearPID = 0u) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (gearPID == 0) { gearPID = CurrentGearPID; } if (!IsGearWithThermal(gearPID)) { return false; } if (ModifiedInLevelGearThermals.Contains(gearPID)) { return true; } if (base.definitions.TryGetValue(gearPID, out var value) && InLevelGearThermals.TryGetValue(gearPID, out var value2)) { TSShader shader = value.Definition.Shader; Renderer[] array = value2; foreach (Renderer val in array) { PropertyInfo[] properties = shader.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in properties) { Type type = Nullable.GetUnderlyingType(propertyInfo.PropertyType) ?? propertyInfo.PropertyType; string text = "_" + propertyInfo.Name; if (type == typeof(float)) { val.material.SetFloat(text, (float)propertyInfo.GetValue(shader)); } else if (type == typeof(EOSColor)) { EOSColor val2 = (EOSColor)propertyInfo.GetValue(shader); val.material.SetVector(text, Color.op_Implicit(val2.ToUnityColor())); } else if (type == typeof(bool)) { bool flag = (bool)propertyInfo.GetValue(shader); val.material.SetFloat(text, flag ? 1f : 0f); } else if (type == typeof(Vec4)) { Vec4 val3 = (Vec4)propertyInfo.GetValue(shader); val.material.SetVector(text, val3.ToVector4()); } } } ModifiedInLevelGearThermals.Add(gearPID); return true; } return false; } internal void OnPlayerItemWielded(FirstPersonItemHolder fpsItemHolder, ItemEquippable item) { if (item.GearIDRange == null) { CurrentGearPID = 0u; return; } CurrentGearPID = ExpeditionGearManager.GetOfflineGearPID(item.GearIDRange); TryGetInLevelGearThermalRenderersFromItem(item, CurrentGearPID, out var _); TrySetThermalSightRenderer(CurrentGearPID); } public bool IsGearWithThermal(uint gearPID) { return ThermalOfflineGears.Contains(gearPID); } private void CleanupInLevelGearThermals(bool keepCurrentGear = false) { if (!keepCurrentGear || !InLevelGearThermals.ContainsKey(CurrentGearPID)) { InLevelGearThermals.Clear(); } else { Renderer[] value = InLevelGearThermals[CurrentGearPID]; InLevelGearThermals.Clear(); InLevelGearThermals[CurrentGearPID] = value; } ModifiedInLevelGearThermals.Clear(); } internal void SetCurrentThermalSightSettings(float t) { if (InLevelGearThermals.TryGetValue(CurrentGearPID, out var value) && base.definitions.TryGetValue(CurrentGearPID, out var value2)) { Renderer[] array = value; foreach (Renderer obj in array) { float zoom = value2.Definition.Shader.Zoom; float offAimPixelZoom = value2.Definition.OffAimPixelZoom; float num = Mathf.Lerp(zoom, offAimPixelZoom, t); obj.material.SetFloat("_Zoom", num); } } } private void Clear() { CurrentGearPID = 0u; CleanupInLevelGearThermals(); CleanupPuzzleVisuals(); } private TSAManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } static TSAManager() { Current = new TSAManager(); } public void RegisterPuzzleVisual(CP_Bioscan_Core core) { Il2CppArrayBase<Renderer> componentsInChildren = ((Component)core).gameObject.GetComponentsInChildren<Renderer>(true); if (componentsInChildren == null) { return; } foreach (Renderer item2 in ((IEnumerable<Renderer>)componentsInChildren).Where((Renderer comp) => ((Object)((Component)comp).gameObject).name.Equals("Zone")).ToList()) { GameObject gameObject = ((Component)item2).gameObject; float @float = item2.material.GetFloat("_Intensity"); float float2 = item2.material.GetFloat("_BehindWallIntensity"); PuzzleVisualWrapper item = new PuzzleVisualWrapper { GO = gameObject, Renderer = item2, Intensity = @float, BehindWallIntensity = float2 }; PuzzleVisuals.Add(item); } } public void RegisterPuzzleVisual(PuzzleVisualWrapper wrapper) { PuzzleVisuals.Add(wrapper); } internal void SetPuzzleVisualsIntensity(float t) { PuzzleVisuals.ForEach(delegate(PuzzleVisualWrapper v) { v.SetIntensity(t); }); } private void CleanupPuzzleVisuals() { PuzzleVisuals.Clear(); } } } namespace ThermalSights.Patches { internal static class CP_Bioscan_Core_Setup { [HarmonyPostfix] [HarmonyPatch(typeof(CP_Bioscan_Core), "Setup")] private static void Post_CaptureBioscanVisual(CP_Bioscan_Core __instance) { TSAManager.Current.RegisterPuzzleVisual(__instance); } } [HarmonyPatch] internal static class FirstPersonItemHolder_SetWieldedItem { public static event Action<FirstPersonItemHolder, ItemEquippable> OnItemWielded; [HarmonyPostfix] [HarmonyPatch(typeof(FirstPersonItemHolder), "SetWieldedItem")] private static void Post_SetWieldedItem(FirstPersonItemHolder __instance, ItemEquippable item) { TSAManager.Current.OnPlayerItemWielded(__instance, item); TSAManager.Current.SetPuzzleVisualsIntensity(1f); TSAManager.Current.SetCurrentThermalSightSettings(1f); FirstPersonItemHolder_SetWieldedItem.OnItemWielded?.Invoke(__instance, item); } } [HarmonyPatch] internal static class FPIS_Aim_Update { public static event Action<FPIS_Aim, float> OnAimUpdate; [HarmonyPostfix] [HarmonyPatch(typeof(FPIS_Aim), "Update")] private static void Post_Aim_Update(FPIS_Aim __instance) { if (!((Object)(object)((FPItemState)__instance).Holder.WieldedItem == (Object)null)) { float num = 1f - FirstPersonItemHolder.m_transitionDelta; if (!TSAManager.Current.IsGearWithThermal(TSAManager.Current.CurrentGearPID)) { num = Math.Max(0.05f, num); } else { TSAManager.Current.SetCurrentThermalSightSettings(num); } TSAManager.Current.SetPuzzleVisualsIntensity(num); FPIS_Aim_Update.OnAimUpdate?.Invoke(__instance, num); } } } } namespace ThermalSights.Definition { public class TSADefinition { public float OffAimPixelZoom { get; set; } = 1f; public TSShader Shader { get; set; } = new TSShader(); } public class TSShader { [JsonPropertyName("DistanceFalloff")] [Range(0.0, 1.0)] public float HeatFalloff { get; set; } = 0.01f; [Range(0.0, 1.0)] public float FogFalloff { get; set; } = 0.1f; [JsonPropertyName("PixelZoom")] [Range(0.0, 1.0)] public float Zoom { get; set; } = 0.8f; [JsonPropertyName("AspectRatioAdjust")] [Range(0.0, 2.0)] public float RatioAdjust { get; set; } = 1f; [Range(0.0, 1.0)] public float DistortionCenter { get; set; } = 0.5f; public float DistortionScale { get; set; } = 1f; public float DistortionSpeed { get; set; } = 1f; public float DistortionSignalSpeed { get; set; } = 0.025f; [Range(0.0, 1.0)] public float DistortionMin { get; set; } = 0.01f; [Range(0.0, 1.0)] public float DistortionMax { get; set; } = 0.4f; [JsonPropertyName("AmbientTemperature")] [Range(0.0, 1.0)] public float AmbientTemp { get; set; } = 0.15f; [JsonPropertyName("BackgroundTemperature")] [Range(0.0, 1.0)] public float BackgroundTemp { get; set; } = 0.05f; [Range(0.0, 10.0)] public float AlbedoColorFactor { get; set; } = 0.5f; [Range(0.0, 10.0)] public float AmbientColorFactor { get; set; } = 5f; public float OcclusionHeat { get; set; } = 0.5f; public float BodyOcclusionHeat { get; set; } = 2.5f; [Range(0.0, 1.0)] public float ScreenIntensity { get; set; } = 0.2f; [Range(0.0, 1.0)] public float OffAngleFade { get; set; } = 0.95f; [Range(0.0, 1.0)] public float Noise { get; set; } = 0.1f; [JsonPropertyName("MinShadowEnemyDistortion")] [Range(0.0, 1.0)] public float DistortionMinShadowEnemies { get; set; } = 0.2f; [JsonPropertyName("MaxShadowEnemyDistortion")] [Range(0.0, 1.0)] public float DistortionMaxShadowEnemies { get; set; } = 1f; [Range(0.0, 1.0)] public float DistortionSignalSpeedShadowEnemies { get; set; } = 1f; public float ShadowEnemyFresnel { get; set; } = 10f; [Range(0.0, 1.0)] public float ShadowEnemyHeat { get; set; } = 0.1f; public EOSColor ReticuleColorA { get; set; } = new EOSColor { r = 1f, g = 1f, b = 1f, a = 1f }; public EOSColor ReticuleColorB { get; set; } = new EOSColor { r = 1f, g = 1f, b = 1f, a = 1f }; public EOSColor ReticuleColorC { get; set; } = new EOSColor { r = 1f, g = 1f, b = 1f, a = 1f }; [Range(0.0, 20.0)] public float SightDirt { get; set; } public bool LitGlass { get; set; } public bool ClipBorders { get; set; } = true; public Vec4 AxisX { get; set; } = new Vec4(); public Vec4 AxisY { get; set; } = new Vec4(); public Vec4 AxisZ { get; set; } = new Vec4(); public bool Flip { get; set; } = true; [JsonPropertyName("Distance1")] [Range(0.0, 100.0)] public float ProjDist1 { get; set; } = 100f; [JsonPropertyName("Distance2")] [Range(0.0, 100.0)] public float ProjDist2 { get; set; } = 66f; [JsonPropertyName("Distance3")] [Range(0.0, 100.0)] public float ProjDist3 { get; set; } = 33f; [JsonPropertyName("Size1")] [Range(0.0, 3.0)] public float ProjSize1 { get; set; } = 1f; [JsonPropertyName("Size2")] [Range(0.0, 3.0)] public float ProjSize2 { get; set; } = 1f; [JsonPropertyName("Size3")] [Range(0.0, 3.0)] public float ProjSize3 { get; set; } = 1f; [JsonPropertyName("Zeroing")] [Range(-1.0, 1.0)] public float ZeroOffset { get; set; } } }
plugins/Vega/Custom/LEGACY.dll
Decompiled 18 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using AIGraph; using AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using BoosterImplants; using CellMenu; using ChainedPuzzles; using EOSExt.Reactor.Managers; using Enemies; using ExtraObjectiveSetup; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.ExtendedWardenEvents; using ExtraObjectiveSetup.Instances; using ExtraObjectiveSetup.Utils; using FloLib.Infos; using FloLib.Networks.Replications; using GTFO.API; using GTFO.API.JSON.Converters; using GTFO.API.Utilities; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LEGACY.ExtraEvents; using LEGACY.LegacyOverride; using LEGACY.LegacyOverride.DummyVisual; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation.AnimationConfig; using LEGACY.LegacyOverride.DummyVisual.VisualSequenceType; using LEGACY.LegacyOverride.ElevatorCargo; using LEGACY.LegacyOverride.EnemyTagger; using LEGACY.LegacyOverride.EventScan; using LEGACY.LegacyOverride.ExpeditionIntelNotification; using LEGACY.LegacyOverride.ExpeditionSuccessPage; using LEGACY.LegacyOverride.FogBeacon; using LEGACY.LegacyOverride.ForceFail; using LEGACY.LegacyOverride.Music; using LEGACY.LegacyOverride.ResourceStations; using LEGACY.Utils; using LEGACY.VanillaFix; using LevelGeneration; using Localization; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using ScanPosOverride.Managers; using StateMachines; using TMPro; using ThermalSights; 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("LEGACY")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LEGACY")] [assembly: AssemblyTitle("LEGACY")] [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; } } } [HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")] internal static class Patch_WatermarkUpdateWatermark { private static void Postfix(PUI_Watermark __instance) { string text = "4.6.2+git44e73d7-dirty-main".Remove("x.x.x".Length); ((TMP_Text)__instance.m_watermarkText).SetText("<color=red>MODDED</color> <color=orange>" + text + "</color>\n<color=#2DB400>OPERATION :</color> <color=#09D0EF>VEGA</color>", true); } } namespace LEGACY { internal static class Assets { public static GameObject CircleSensor { get; private set; } public static GameObject MovableSensor { get; private set; } public static GameObject OBSVisual { get; private set; } public static GameObject ObjectiveMarker { get; private set; } public static GameObject EventScan { get; private set; } internal static GameObject DummyScan { get; private set; } internal static GameObject DummySensor { get; private set; } internal static GameObject AmmoStation { get; private set; } internal static GameObject MediStation { get; private set; } internal static GameObject ToolStation { get; private set; } public static void Init() { CircleSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/CircleSensor.prefab"); MovableSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/MovableSensor.prefab"); OBSVisual = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/OBSVisual.prefab"); ObjectiveMarker = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/ObjectiveMarker.prefab"); EventScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/EventObjects/EventScan.prefab"); DummyScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummyScan.prefab"); DummySensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummySensor.prefab"); AmmoStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/AmmoStation.prefab"); MediStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/MediStation.prefab"); ToolStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/ToolStation.prefab"); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("Localia.TeammatesIgnoreBullets")] [BepInIncompatibility("com.Chaxi.StrongerPrisoner")] [BepInIncompatibility("Hikaria.InLevelCarryOnBack")] [BepInPlugin("Inas.LEGACY", "LEGACY", "4.3.3")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string RUNDOWN_NAME = "LEGACY"; public const string VERSION = "4.3.3"; public const bool TESTING = false; public const string TEST_STRING = "TESTING"; 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("LEGACY"); m_Harmony.PatchAll(); LegacyOverrideManagers.Init(); LegacyExtraEvents.Init(); LEGACY.VanillaFix.Debugger.Current.Init(); AssetAPI.OnAssetBundlesLoaded += Assets.Init; EventAPI.OnManagersSetup += delegate { AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)MainMenuGuiLayer.Current.PageRundownNew.SetupCustomTutorialButton); }; } } } namespace LEGACY.Reactor { [HarmonyPatch] internal class Patch_ReactorShutdown { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected I4, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || oldState.status == newState.status) { return; } WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorShutdown: "); LegacyLogger.Error("Failed to get warden objective"); } else if ((int)val.Type == 2 && !val.OnActivateOnSolveItem) { eWardenObjectiveEventTrigger val2 = (eWardenObjectiveEventTrigger)0; eReactorStatus status = newState.status; switch (status - 7) { default: return; case 0: val2 = (eWardenObjectiveEventTrigger)1; break; case 1: val2 = (eWardenObjectiveEventTrigger)2; break; case 2: val2 = (eWardenObjectiveEventTrigger)3; break; } _ = __instance.SpawnNode.LayerType; WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val.EventsOnActivate, val2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")] private static void Pre_OnBuildDone_ChainedPuzzleMidObjectiveFix(LG_WardenObjective_Reactor __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorShutdown: Failed to get warden objective"); } else if (val.ChainedPuzzleMidObjective != 0) { __instance.m_chainedPuzzleAlignMidObjective = __instance.m_chainedPuzzleAlign; } } [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")] private static bool Pre_Update(LG_WardenObjective_Reactor __instance) { //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_000c: Invalid comparison between Unknown and I4 if ((int)__instance.m_currentState.status != 7) { return true; } if (!__instance.m_currentWaveData.HasVerificationTerminal) { return true; } __instance.SetGUIMessage(true, Text.Format(3000u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=orange>" + __instance.m_currentWaveData.VerificationTerminalSerial + "</color>") }), (ePUIMessageStyle)3, false, "", ""); return false; } } [HarmonyPatch] internal class Patch_ReactorStartup_ExtraEventsExecution { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_ExecuteOnNoneEventsOnDefenseStart(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if (oldState.status != newState.status && (int)newState.status == 3) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)0, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")] private static void Post_OnBuildDone(LG_WardenObjective_Reactor __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 WardenObjectiveDataBlock db = default(WardenObjectiveDataBlock); if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref db) || db == null) { LegacyLogger.Error("Patch_ReactorStartup_ExtraEventsExecution: "); LegacyLogger.Error("Failed to get warden objective"); } else if ((int)db.Type == 1 && !db.OnActivateOnSolveItem) { ChainedPuzzleInstance chainedPuzzleToStartSequence = __instance.m_chainedPuzzleToStartSequence; chainedPuzzleToStartSequence.OnPuzzleSolved += Action.op_Implicit((Action)delegate { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(db.EventsOnActivate, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); }); } } } [HarmonyPatch] internal class Patch_ReactorStartup_OverwriteGUIBehaviour { private static HashSet<uint> ForceDisableLevels; [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static bool Pre_HideReactorMessageForInfiniteWave(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //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_0020: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected I4, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if (oldState.status == newState.status) { return true; } if ((int)newState.status != 2 && (int)newState.status != 3 && (int)newState.status != 4) { return true; } if (ForceDisable()) { if (oldState.stateCount != newState.stateCount) { __instance.OnStateCountUpdate(newState.stateCount); } if (oldState.stateProgress != newState.stateProgress) { __instance.OnStateProgressUpdate(newState.stateProgress); } __instance.ReadyForVerification = false; eReactorStatus status = newState.status; switch (status - 2) { case 0: { WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorStartup_OverwriteGUIBehaviour: "); LegacyLogger.Error("Failed to get warden objective datablock"); break; } __instance.m_lightCollection.SetMode(val.LightsOnDuringIntro); __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_lightsBlinking = false; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.m_alarmCountdownPlayed = false; __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Warmup : __instance.m_currentWaveData.WarmupFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)1, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); if (__instance.m_currentWaveCount == 1) { Debug.LogError(Object.op_Implicit("Reactor IDLE START")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_LOOP, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } else { Debug.LogError(Object.op_Implicit("Reactor REACTOR_POWER_DOWN")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_2_TO_1_TRANSITION, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } break; } case 1: __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_spawnEnemies = true; __instance.m_currentEnemyWaveIndex = 0; __instance.m_alarmCountdownPlayed = false; __instance.m_progressUpdateEnabled = true; __instance.m_currentDuration = __instance.m_currentWaveData.Wave; __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_TO_3_TRANSITION, true); break; case 2: __instance.m_lightCollection.ResetUpdateValues(false); __instance.lcReset = true; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.ReadyForVerification = true; Debug.Log(Object.op_Implicit("Wait for verify! newState.verifyFailed? " + newState.verifyFailed)); __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Verify : __instance.m_currentWaveData.VerifyFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); break; } __instance.m_currentState = newState; return false; } return true; } private static bool ForceDisable() { return ForceDisableLevels.Contains(RundownManager.ActiveExpedition.LevelLayoutData); } static Patch_ReactorStartup_OverwriteGUIBehaviour() { ForceDisableLevels = new HashSet<uint>(); LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L3E2_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID); } block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L1E1_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID); } } } } namespace LEGACY.HardcodedBehaviours { [HarmonyPatch] internal class Patch_PickupItem_Hardcoded { [HarmonyPrefix] [HarmonyPatch(typeof(LG_Distribute_PickupItemsPerZone), "Build")] private static void Pre_LG_Distribute_PickupItemsPerZone(LG_Distribute_PickupItemsPerZone __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("LAYOUT_O4_1_L1"); if (block == null || RundownManager.ActiveExpedition.LevelLayoutData != ((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID) { return; } eLocalZoneIndex localIndex = __instance.m_zone.LocalIndex; if ((int)localIndex != 1) { if ((int)localIndex == 5) { __instance.m_zonePlacementWeights.Start = 0f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 100000f; } } else if ((int)__instance.m_pickupType == 1) { __instance.m_zonePlacementWeights.Start = 100000f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 0f; } } } } namespace LEGACY.VanillaFix { [HarmonyPatch] internal class Patch_FixScoutFreeze { [HarmonyPrefix] [HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")] private static bool Prefix_Debug(ES_ScoutScream __instance) { if (((AgentAI)((ES_Base)__instance).m_ai).Target == null) { return false; } return true; } } [HarmonyPatch] internal class Patch_LG_SecurityDoor_Fix_EventsOnUnlockDoor_Powergenerator { [HarmonyPrefix] [HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")] private static void Pre_OnSyncDoorStatusChange(LG_SecurityDoor __instance, pDoorState state, bool isRecall) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 eDoorStatus status = state.status; if ((status - 4 <= 1 || (int)status == 9) && (int)__instance.m_lastState.status == 6 && !isRecall) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.LinkedToZoneData.EventsOnUnlockDoor, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } } [HarmonyPatch] internal class Patch_LockSecurityDoor_FixCustomText { [HarmonyPostfix] [HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })] private static void Post_LG_SecurityDoor_Locks_Setup(LG_SecurityDoor door, LG_SecurityDoor_Locks __instance) { LocalizedText customText = door.LinkedToZoneData.ProgressionPuzzleToEnter.CustomText; __instance.m_lockedWithNoKeyInteractionText = customText; } } [HarmonyPatch] internal class Debugger { public static Debugger Current { get; private set; } = new Debugger(); public bool DEBUGGING { get; private set; } private Debugger() { } internal void Init() { _ = DEBUGGING; } private void f1(int k, out string v) { if (k < 2) { v = "2"; } v = null; } private void f2(int k, ref string v) { if (k < 2) { v = "2"; } } } } namespace LEGACY.Utils { public delegate float EasingFunction(float t, float b, float c, float d); public delegate bool BoolCheck(); internal static class CoroutineEase { [CompilerGenerated] private sealed class <DoEaseLocalPos>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 sourcePos; public Vector3 targetPos; public Action onDone; private bool <doAbort>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoEaseLocalPos>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__2) { <doAbort>5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localPosition = Vector3.Lerp(sourcePos, targetPos, num); <>2__current = null; <>1__state = 1; return true; } trans.localPosition = targetPos; if (!<doAbort>5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoEaseLocalRot>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 sourceEuler; public Vector3 targetEuler; public Action onDone; private bool <doAbort>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoEaseLocalRot>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__2) { <doAbort>5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, num); <>2__current = null; <>1__state = 1; return true; } trans.localEulerAngles = targetEuler; if (!<doAbort>5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoEaseLocalScale>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 startScale; public Vector3 targetScale; public Action onDone; private bool <doAbort>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoEaseLocalScale>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__2) { <doAbort>5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localScale = Vector3.Lerp(startScale, targetScale, num); <>2__current = null; <>1__state = 1; return true; } trans.localScale = targetScale; if (!<doAbort>5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(<DoEaseLocalScale>d__0))] private static IEnumerator DoEaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoEaseLocalScale>d__0(0) { trans = trans, startScale = startScale, targetScale = targetScale, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } [IteratorStateMachine(typeof(<DoEaseLocalPos>d__1))] private static IEnumerator DoEaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoEaseLocalPos>d__1(0) { trans = trans, sourcePos = sourcePos, targetPos = targetPos, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } [IteratorStateMachine(typeof(<DoEaseLocalRot>d__2))] private static IEnumerator DoEaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoEaseLocalRot>d__2(0) { trans = trans, sourceEuler = sourceEuler, targetEuler = targetEuler, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } internal static Coroutine EaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: 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) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalScale(trans, startScale, targetScale, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: 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) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalPos(trans, sourcePos, targetPos, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: 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) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalRot(trans, sourceEuler, targetEuler, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } } public static class Helper { private static void ResetChild(iChainedPuzzleCore ICore) { CP_Bioscan_Core val = ((Il2CppObjectBase)ICore).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val != (Object)null) { ((Il2CppObjectBase)val.m_spline).Cast<CP_Holopath_Spline>(); ((Il2CppObjectBase)val.PlayerScanner).Cast<CP_PlayerScanner>().ResetScanProgression(0f); val.Deactivate(); return; } CP_Cluster_Core val2 = ((Il2CppObjectBase)ICore).TryCast<CP_Cluster_Core>(); if ((Object)(object)val2 == (Object)null) { LegacyLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core..."); return; } ((Il2CppObjectBase)val2.m_spline).Cast<CP_Holopath_Spline>(); foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val2.m_childCores) { ResetChild(item); } val2.Deactivate(); } public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_005d: 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_0065: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_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_009b: 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_00a9: Unknown result type (might be due to invalid IL or missing references) if (chainedPuzzleInstance.Data.DisableSurvivalWaveOnComplete) { chainedPuzzleInstance.m_sound = new CellSoundPlayer(chainedPuzzleInstance.m_parent.position); } foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)chainedPuzzleInstance.m_chainedPuzzleCores) { ResetChild(item); } if (SNet.IsMaster) { pChainedPuzzleState state = chainedPuzzleInstance.m_stateReplicator.State; pChainedPuzzleState val = default(pChainedPuzzleState); val.status = (eChainedPuzzleStatus)0; val.currentSurvivalWave_EventID = state.currentSurvivalWave_EventID; val.isSolved = false; val.isActive = false; pChainedPuzzleState val2 = val; chainedPuzzleInstance.m_stateReplicator.InteractWithState(val2, new pChainedPuzzleInteraction { type = (eChainedPuzzleInteraction)2 }); } } public static List<T> ToManagedList<T>(this List<T> il2cppList) { List<T> list = new List<T>(); Enumerator<T> enumerator = il2cppList.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list.Add(current); } return list; } public static bool TryGetComponent<T>(this GameObject obj, out T comp) { comp = obj.GetComponent<T>(); return comp != null; } public static bool IsPlayerInLevel(PlayerAgent player) { //IL_0006: 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_0012: Invalid comparison between Unknown and I4 return (int)player.Owner.Load<pGameState>().gameState == 10; } public static ChainedPuzzleInstance GetChainedPuzzleForCommandOnTerminal(LG_ComputerTerminal terminal, string command) { //IL_001a: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected I4, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Invalid comparison between Unknown and I4 //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Invalid comparison between Unknown and I4 //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Invalid comparison between Unknown and I4 //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Invalid comparison between Unknown and I4 //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Invalid comparison between Unknown and I4 uint num = 0u; if (terminal.SpawnNode.m_dimension.IsMainDimension) { LG_LayerType layerType = terminal.SpawnNode.LayerType; switch ((int)layerType) { case 0: num = RundownManager.ActiveExpedition.LevelLayoutData; break; case 1: num = RundownManager.ActiveExpedition.SecondaryLayout; break; case 2: num = RundownManager.ActiveExpedition.ThirdLayout; break; default: LegacyLogger.Error("Unimplemented layer type."); return null; } } else { num = terminal.SpawnNode.m_dimension.DimensionData.LevelLayoutData; } LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock(num); List<CustomTerminalCommand> val = null; List<LG_ComputerTerminal> terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone; int num2 = terminalsSpawnedInZone.IndexOf(terminal); ExpeditionZoneData val2 = null; Enumerator<ExpeditionZoneData> enumerator = block.Zones.GetEnumerator(); while (enumerator.MoveNext()) { ExpeditionZoneData current = enumerator.Current; if (current.LocalIndex == terminal.SpawnNode.m_zone.LocalIndex) { val2 = current; break; } } if (val2 == null) { LegacyLogger.Error("Cannot find target zone data."); return null; } if (val2.TerminalPlacements.Count != terminalsSpawnedInZone.Count) { LegacyLogger.Error("The numbers of terminal placement and spawn, skipped for the zone terminal."); return null; } val = val2.TerminalPlacements[num2].UniqueCommands; if (val.Count == 0) { return null; } List<WardenObjectiveEventData> val3 = null; TERM_Command val4 = (TERM_Command)0; Enumerator<CustomTerminalCommand> enumerator2 = val.GetEnumerator(); string text = default(string); string text2 = default(string); while (enumerator2.MoveNext()) { CustomTerminalCommand current2 = enumerator2.Current; if (current2.Command == command) { val3 = current2.CommandEvents; if (!terminal.m_command.TryGetCommand(current2.Command, ref val4, ref text, ref text2)) { LegacyLogger.Error("Cannot get TERM_COMMAND for command {0} on the specified terminal."); } break; } } if (val3 == null || (int)val4 == 0) { return null; } if ((int)val4 != 38 && (int)val4 != 39 && (int)val4 != 40 && (int)val4 != 41 && (int)val4 != 42) { return null; } ChainedPuzzleInstance val5 = null; for (int i = 0; i < val3.Count && (val3[i].ChainPuzzle == 0 || !terminal.TryGetChainPuzzleForCommand(val4, i, ref val5) || !((Object)(object)val5 != (Object)null)); i++) { } return val5; } public static bool TryGetZoneEntranceSecDoor(LG_Zone zone, out LG_SecurityDoor door) { if ((Object)(object)zone == (Object)null) { door = null; return false; } if ((Object)(object)zone.m_sourceGate == (Object)null) { door = null; return false; } if (zone.m_sourceGate.SpawnedDoor == null) { door = null; return false; } door = ((Il2CppObjectBase)zone.m_sourceGate.SpawnedDoor).TryCast<LG_SecurityDoor>(); return (Object)(object)door != (Object)null; } internal static bool isSecDoorToZoneOpened(LG_Zone zone14) { //IL_001d: 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 LG_SecurityDoor door = null; if (!TryGetZoneEntranceSecDoor(zone14, out door) || (Object)(object)door == (Object)null) { return false; } return (int)door.m_sync.GetCurrentSyncState().status == 10; } public static List<T> cast<T>(List<T> list) { List<T> list2 = new List<T>(); Enumerator<T> enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list2.Add(current); } return list2; } private static eDimensionIndex GetCurrentDimensionIndex() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (PlayerManager.PlayerAgentsInLevel.Count <= 0) { throw new Exception("? You don't have any player agent in level? How could that happen?"); } return ((Agent)PlayerManager.PlayerAgentsInLevel[0]).DimensionIndex; } public static void GetMinLayerAndLocalIndex(out LG_LayerType MinLayer, out eLocalZoneIndex MinLocalIndex) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between I4 and Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between I4 and Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected I4, but got Unknown MinLayer = (LG_LayerType)2; MinLocalIndex = (eLocalZoneIndex)20; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (IsPlayerInLevel(current)) { if ((int)MinLayer > (int)current.m_courseNode.LayerType) { MinLayer = (LG_LayerType)(int)current.m_courseNode.LayerType; MinLocalIndex = (eLocalZoneIndex)20; } if ((int)MinLocalIndex >= (int)current.m_courseNode.m_zone.LocalIndex) { MinLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex; } } } } public static void GetMaxLayerAndLocalIndex(out LG_LayerType MaxLayer, out eLocalZoneIndex MaxLocalIndex) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between I4 and Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between I4 and Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected I4, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected I4, but got Unknown MaxLayer = (LG_LayerType)0; MaxLocalIndex = (eLocalZoneIndex)0; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (IsPlayerInLevel(current)) { if ((int)MaxLayer < (int)current.m_courseNode.LayerType) { MaxLayer = (LG_LayerType)(int)current.m_courseNode.LayerType; MaxLocalIndex = (eLocalZoneIndex)0; } if ((int)MaxLocalIndex < (int)current.m_courseNode.m_zone.LocalIndex) { MaxLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex; } } } } public static int GetMinAreaIndex(LG_Zone zone) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)zone == (Object)null) { return -1; } LG_LayerType type = zone.m_layer.m_type; eLocalZoneIndex localIndex = zone.LocalIndex; GetCurrentDimensionIndex(); int num = zone.m_areas.Count; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (current.m_courseNode.LayerType != type || current.m_courseNode.m_zone.LocalIndex != localIndex) { continue; } int i = 0; for (List<LG_Area> areas = zone.m_areas; i < areas.Count; i++) { if (((Object)((Component)areas[i]).gameObject).GetInstanceID() == ((Object)((Component)current.m_courseNode.m_area).gameObject).GetInstanceID()) { if (num > i) { num = i; } break; } } } return num; } public static LG_ComputerTerminal FindTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, int terminalIndex) { //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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = null; if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error($"FindTerminal: Didn't find LG_Zone {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (val.TerminalsSpawnedInZone == null || terminalIndex >= val.TerminalsSpawnedInZone.Count) { LegacyLogger.Error($"FindTerminal: Invalid terminal index {terminalIndex} - {((val.TerminalsSpawnedInZone != null) ? val.TerminalsSpawnedInZone.Count : 0)} terminals are spawned in {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (terminalIndex >= 0) { return val.TerminalsSpawnedInZone[terminalIndex]; } return null; } public static AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position) { //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_0012: 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) AIG_GeomorphNodeVolume val = default(AIG_GeomorphNodeVolume); AIG_VoxelNodePillar val2 = default(AIG_VoxelNodePillar); AIG_INode val3 = default(AIG_INode); AIG_NodeCluster result = default(AIG_NodeCluster); if (!AIG_GeomorphNodeVolume.TryGetGeomorphVolume(0, dimensionIndex, position, ref val) || !((AIG_NodeVolume)val).m_voxelNodeVolume.TryGetPillar(position, ref val2) || !val2.TryGetVoxelNode(position.y, ref val3) || !AIG_NodeCluster.TryGetNodeCluster(val3.ClusterID, ref result)) { LegacyLogger.Error("TryWarpTo : Position is not valid, try again inside an area."); return null; } return result; } } internal static class Json { private static readonly JsonSerializerOptions _setting; static Json() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown _setting = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, IncludeFields = false, PropertyNameCaseInsensitive = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; _setting.Converters.Add(new JsonStringEnumConverter()); _setting.Converters.Add((JsonConverter)new LocalizedTextConverter()); } public static T Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, _setting); } public static object Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize<T>(T value) { return JsonSerializer.Serialize(value, _setting); } public static void Load<T>(string filePath, out T config) where T : new() { config = Deserialize<T>(File.ReadAllText(filePath)); } } internal static class LegacyLogger { private static ManualLogSource logger = Logger.CreateLogSource("LEGACYCore"); 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 class SpawnHibernateEnemiesEvent { public eWardenObjectiveEventTrigger Trigger { get; set; } public int Type { get; set; } = 170; public eDimensionIndex DimensionIndex { get; set; } public LG_LayerType Layer { get; set; } public eLocalZoneIndex LocalIndex { get; set; } public string WorldEventObjectFilter { get; set; } = "RANDOM"; public uint EnemyID { get; set; } public int Count { get; set; } = 1; public float Delay { get; set; } public float Duration { get; set; } = 2f; } public class WeightedAreaSelector { private static readonly Dictionary<LG_Zone, WeightedAreaSelector> dict; private WeightedRandomBag<LG_Area> weightedRandomBag; public static WeightedAreaSelector Get(LG_Zone zone) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected I4, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!dict.ContainsKey(zone)) { WeightedAreaSelector weightedAreaSelector = new WeightedAreaSelector(); Enumerator<LG_Area> enumerator = zone.m_areas.GetEnumerator(); while (enumerator.MoveNext()) { LG_Area current = enumerator.Current; float num = 0f; LG_AreaSize size = current.m_size; switch (size - 1) { case 4: num = 7f; break; case 0: num = 20f; break; case 1: num = 30f; break; case 2: num = 35f; break; case 3: num = 45f; break; default: LegacyLogger.Error($"Unhandled LG_AreaSize: {current.m_size}. Won't build."); return null; } weightedAreaSelector.AddEntry(current, num); } dict.Add(zone, weightedAreaSelector); } return dict[zone]; } public static WeightedAreaSelector Get(eDimensionIndex eDimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex) { //IL_0005: 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) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(eDimensionIndex, layerType, localIndex, ref val) || !Object.op_Implicit((Object)(object)val)) { return null; } return Get(val); } private WeightedAreaSelector() { weightedRandomBag = new WeightedRandomBag<LG_Area>(); } private void AddEntry(LG_Area area, float weight) { weightedRandomBag.AddEntry(area, weight); } public LG_Area GetRandom() { return weightedRandomBag.GetRandom(); } private static void OnBuildDone() { } private static void Clear() { dict.Clear(); } static WeightedAreaSelector() { dict = new Dictionary<LG_Zone, WeightedAreaSelector>(); LevelAPI.OnLevelCleanup += dict.Clear; } } public class WeightedRandomBag<T> { private struct Entry { public double accumulatedWeight; public T item; } private List<Entry> entries = new List<Entry>(); private double accumulatedWeight; private Random rand = new Random(); public void AddEntry(T item, double weight) { if (weight <= 0.0) { LegacyLogger.Error("AddEntry: no non-positive weight pls."); return; } accumulatedWeight += weight; entries.Add(new Entry { item = item, accumulatedWeight = accumulatedWeight }); } public T GetRandom() { double num = rand.NextDouble() * accumulatedWeight; foreach (Entry entry in entries) { if (entry.accumulatedWeight >= num) { return entry.item; } } return default(T); } } } namespace LEGACY.LegacyOverride { internal class NavMarkerManager { private Dictionary<string, GameObject> markerVisuals = new Dictionary<string, GameObject>(); private Dictionary<string, NavMarker> navMarkers = new Dictionary<string, NavMarker>(); private List<GameObject> arbitraryNavMarkers = new List<GameObject>(); public static NavMarkerManager Current { get; private set; } = new NavMarkerManager(); private GameObject InstantiateMarkerVisual() { //IL_0017: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(Assets.ObjectiveMarker); float num = 0.16216217f; Transform transform = obj.transform; transform.localPosition += Vector3.up * num; return obj; } public void EnableMarkerAt(string markerName, GameObject target, float scale) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { NavMarker val = GuiManager.NavMarkerLayer.PrepareGenericMarker(target); if ((Object)(object)val != (Object)null) { val.SetColor(new Color(0.855f, 0.482f, 0.976f)); val.SetStyle((eNavMarkerStyle)14); val.SetVisible(true); navMarkers[markerName] = val; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } GameObject val2 = null; if (markerVisuals.ContainsKey(markerName)) { val2 = markerVisuals[markerName]; } else { val2 = InstantiateMarkerVisual(); val2.transform.localScale = new Vector3(scale, scale, scale); val2.transform.SetPositionAndRotation(target.transform.position, Quaternion.identity); markerVisuals[markerName] = val2; } CoroutineManager.BlinkIn(val2, 0f); LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } public void EnableArbitraryMarkerAt(string markerName, Vector3 Position) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { GameObject val = new GameObject(markerName); val.transform.SetPositionAndRotation(Position, Quaternion.identity); arbitraryNavMarkers.Add(val); NavMarker val2 = GuiManager.NavMarkerLayer.PrepareGenericMarker(val); if ((Object)(object)val2 != (Object)null) { val2.SetColor(new Color(0.855f, 0.482f, 0.976f)); val2.SetStyle((eNavMarkerStyle)14); val2.SetVisible(true); navMarkers[markerName] = val2; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } internal (GameObject markerVisual, NavMarker navMakrer) GetMarkerVisuals(string markerName) { if (!markerVisuals.TryGetValue(markerName, out var value) || !navMarkers.TryGetValue(markerName, out var value2)) { return (null, null); } return (value, value2); } public void DisableMakrer(string markerName) { if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(false); } if (markerVisuals.ContainsKey(markerName)) { GameObject val = markerVisuals[markerName]; if (val.active) { CoroutineManager.BlinkOut(val, 0f); } LegacyLogger.Debug("DisableMakrer: marker " + markerName + " disabled"); } } public void Clear() { foreach (GameObject value in markerVisuals.Values) { Object.Destroy((Object)(object)value); } arbitraryNavMarkers.ForEach((Action<GameObject>)Object.Destroy); markerVisuals.Clear(); navMarkers.Clear(); arbitraryNavMarkers.Clear(); } private NavMarkerManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } } internal static class LegacyOverrideManagers { internal static readonly string LEGACY_CONFIG_PATH = Path.Combine(MTFOPathAPI.CustomPath, "LegacyOverride"); internal static void Init() { ElevatorCargoOverrideManager.Current.Init(); BigPickupFogBeaconSettingManager.Current.Init(); EnemyTaggerSettingManager.Current.Init(); ForceFailManager.Current.Init(); ((GenericExpeditionDefinitionManager<ExpeditionIntel>)ExpeditionIntelNotifier.Current).Init(); ((GenericExpeditionDefinitionManager<EventScanDefinition>)EventScanManager.Current).Init(); ((GenericExpeditionDefinitionManager<VisualGroupDefinition>)VisualManager.Current).Init(); ((GenericExpeditionDefinitionManager<MusicOverride>)MusicStateOverrider.Current).Init(); ((ZoneDefinitionManager<LevelSpawnedFogBeaconDefinition>)LevelSpawnedFogBeaconManager.Current).Init(); ((GenericExpeditionDefinitionManager<SuccessPageCustomization>)SuccessPageCustomizationManager.Current).Init(); ((GenericExpeditionDefinitionManager<ResourceStationDefinition>)ResourceStationManager.Current).Init(); } } } namespace LEGACY.LegacyOverride.ResourceStations { public sealed class ToolStation : ResourceStation { public override string ItemKey => $"Tool_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.ToolStation"); Interact.InteractionMessage = ((block == null) ? "TOOL STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.Tool - ammoStorage.ClassAmmo.RelInPack, def.SupplyEfficiency.Tool)); player.GiveAmmoRel((PlayerAgent)null, 0f, 0f, num); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } public static ToolStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.TOOL) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.ToolStation); return new ToolStation(def, gO); } private ToolStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static ToolStation() { } } public sealed class MediStation : ResourceStation { public const float VANILLA_MAX_HEALTH = 25f; public override string ItemKey => $"Health_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.MediStation"); Interact.InteractionMessage = ((block == null) ? "HEALTH STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { float health = ((Dam_SyncedDamageBase)player.Damage).Health; float num = def.SupplyUplimit.Medi * 25f; if (!(health >= num)) { player.GiveHealth((PlayerAgent)null, Math.Min(def.SupplyEfficiency.Medi, (num - health) / 25f)); player.Sound.Post(EVENTS.MEDPACK_APPLY, true); } } public static MediStation Instantiate(ResourceStationDefinition def) { if (def.StationType != 0) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.MediStation); return new MediStation(def, gO); } private MediStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static MediStation() { } } public abstract class ResourceStation { [CompilerGenerated] private sealed class <BlinkMarker>d__61 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ResourceStation <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BlinkMarker>d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown int num = <>1__state; ResourceStation resourceStation = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } resourceStation.StationMarkerGO.SetActive(!resourceStation.StationMarkerGO.active); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const int UNLIMITED_USE_TIME = int.MaxValue; private Coroutine m_blinkMarkerCoroutine; public virtual GameObject GameObject { get; protected set; } public GameObject InteractGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(3)).gameObject : null) ?? null; } } public GameObject StationMarkerGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(2)).gameObject : null) ?? null; } } public virtual Interact_Timed Interact { get; protected set; } public virtual ResourceStationDefinition def { get; protected set; } public RSTimer Timer { get; protected set; } public StateReplicator<RSStateStruct> StateReplicator { get; protected set; } public RSStateStruct State => StateReplicator?.State ?? new RSStateStruct(); public LG_GenericTerminalItem TerminalItem { get; protected set; } public AIG_CourseNode SpawnNode { get { return TerminalItem.SpawnNode; } set { TerminalItem.SpawnNode = value; } } protected int SerialNumber { get; private set; } public virtual string ItemKey => $"Resource_Station_{SerialNumber}"; public bool Enabled => State.Enabled; protected virtual bool InCooldown { get { if (State.RemainingUseTime <= 0) { return State.CurrentCooldownTime > 0f; } return false; } } public virtual bool HasUnlimitedUseTime => def.AllowedUseTimePerCooldown == int.MaxValue; public virtual void Destroy() { if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; } Object.Destroy((Object)(object)GameObject); StateReplicator?.Unload(); Interact = null; def = null; StateReplicator = null; } protected virtual bool CanInteract() { if (Enabled) { return !InCooldown; } return false; } protected abstract void Replenish(PlayerAgent player); protected virtual void SetInteractionText() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) string text = Text.Format(827u, (Object[])(object)new Object[1] { Object.op_Implicit(InputMapper.GetBindingName(((Interact_Base)Interact).InputAction)) }); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.OnAdditionalInteractionText.ResourceStation"); string text2 = ((block == null) ? "TO REPLENISH" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); string text3 = (HasUnlimitedUseTime ? string.Empty : $"({State.RemainingUseTime}/{def.AllowedUseTimePerCooldown})"); GuiManager.InteractionLayer.SetInteractPrompt(Interact.InteractionMessage, text + text2 + text3, (ePUIMessageStyle)0); } protected virtual void OnTriggerInteraction(PlayerAgent player) { RSStateStruct state = State; int num = (HasUnlimitedUseTime ? int.MaxValue : Math.Max(state.RemainingUseTime - 1, 0)); int num2 = player.Owner.PlayerSlotIndex(); if (num2 < 0 || num2 >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count) { LegacyLogger.Error($"ResourceStation_OnTriggerInteraction: player {player.PlayerName} has invalid slot index: {num2}"); } else { StateReplicator?.SetState(new RSStateStruct { LastInteractedPlayer = num2, RemainingUseTime = num, CurrentCooldownTime = ((num == 0) ? def.CooldownTime : 0f), Enabled = true }); } } protected virtual void OnInteractionSelected(PlayerAgent agent, bool selected) { if (selected) { SetInteractionText(); } } protected virtual void SetupInteraction() { Interact.InteractDuration = def.InteractDuration; Interact_Timed interact = Interact; interact.ExternalPlayerCanInteract += Func<PlayerAgent, bool>.op_Implicit((Func<PlayerAgent, bool>)((PlayerAgent _) => CanInteract())); Interact_Timed interact2 = Interact; interact2.OnInteractionSelected += Action<PlayerAgent, bool>.op_Implicit((Action<PlayerAgent, bool>)OnInteractionSelected); Interact_Timed interact3 = Interact; interact3.OnInteractionTriggered += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)OnTriggerInteraction); } protected virtual void SetupTerminalItem() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error("ResourceStation: Cannot find spawn node!"); return; } if (def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count) { LegacyLogger.Error("ResourceStation: Cannot find spawn node - Area index is invalid!"); return; } TerminalItem.Setup(ItemKey, val.m_areas[def.AreaIndex].m_courseNode); if (SpawnNode != null) { TerminalItem.FloorItemLocation = SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7); } TerminalItem.FloorItemStatus = (eFloorInventoryObjectStatus)0; } protected virtual void OnStateChanged(RSStateStruct oldState, RSStateStruct newState, bool isRecall) { if (isRecall) { return; } int lastInteractedPlayer = newState.LastInteractedPlayer; if (lastInteractedPlayer < 0 || lastInteractedPlayer >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count) { return; } if (((Interact_Base)Interact).IsSelected) { SetInteractionText(); } if (!SNet.IsMaster) { return; } LegacyLogger.Warning($"ResourceStation OnStateChanged: replenish for player {lastInteractedPlayer}, remaining use time: {newState.RemainingUseTime}"); if (oldState.RemainingUseTime > 0) { SNet_Player playerInSlot = SNet.Slots.GetPlayerInSlot(lastInteractedPlayer); if ((Object)(object)playerInSlot != (Object)null) { Replenish(((Il2CppObjectBase)playerInSlot.m_playerAgent).Cast<PlayerAgent>()); } else { LegacyLogger.Error($"playerSlot_{lastInteractedPlayer} has no player agent!"); } } if (newState.RemainingUseTime == 0) { LegacyLogger.Warning("ResourceStation OnStateChanged: cooldown timer starts!"); OnCoolDownStart(); } } protected virtual void OnCoolDownStart() { Timer.StartTimer(def.CooldownTime); if (m_blinkMarkerCoroutine == null) { m_blinkMarkerCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(BlinkMarker()), (Action)null); } } protected virtual void OnCoolDownTimerProgress(float progress) { } protected virtual void OnCoolDownEnd() { LegacyLogger.Warning("ResourceStation OnCoolDownEnd"); if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; StationMarkerGO.SetActive(true); } if (SNet.IsMaster) { LegacyLogger.Warning("ResourceStation OnCoolDownEnd: master reset state!"); StateReplicator.SetState(new RSStateStruct { LastInteractedPlayer = -1, RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = 0f, Enabled = true }); } } protected virtual void SetupReplicator() { if (StateReplicator == null) { uint num = EOSNetworking.AllotReplicatorID(); if (num == 0) { LegacyLogger.Error("ResourceStation: replicatorID depleted, cannot setup replicator!"); return; } StateReplicator = StateReplicator<RSStateStruct>.Create(num, new RSStateStruct { RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = -1f, Enabled = true }, (LifeTimeType)1, (IStateReplicatorHolder<RSStateStruct>)null); StateReplicator.OnStateChanged += OnStateChanged; } } protected virtual void SetupRSTimer() { if ((Object)(object)Timer == (Object)null) { Timer = RSTimer.Instantiate(OnCoolDownTimerProgress, OnCoolDownEnd); } } [IteratorStateMachine(typeof(<BlinkMarker>d__61))] private IEnumerator BlinkMarker() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BlinkMarker>d__61(0) { <>4__this = this }; } protected ResourceStation(ResourceStationDefinition def, GameObject GO) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) this.def = def; GameObject = GO; GameObject.transform.SetPositionAndRotation(def.Position.ToVector3(), def.Rotation.ToQuaternion()); Interact = InteractGO.GetComponent<Interact_Timed>(); SerialNumber = SerialGenerator.GetUniqueSerialNo(); if ((Object)(object)Interact == (Object)null) { LegacyLogger.Error("ResourceStation: Interact Comp not found!"); } else { SetupInteraction(); } TerminalItem = GO.GetComponent<LG_GenericTerminalItem>(); if ((Object)(object)TerminalItem == (Object)null) { LegacyLogger.Error("ResourceStation: TerminalItem not found!"); } else { SetupTerminalItem(); } SetupReplicator(); SetupRSTimer(); } static ResourceStation() { } } public sealed class AmmoStation : ResourceStation { public override string ItemKey => $"Ammunition_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.AmmoStation"); Interact.InteractionMessage = ((block == null) ? "AMMUNITION STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } public static AmmoStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.AMMO) { LegacyLogger.Error($"Trying to instantiate AmmoStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.AmmoStation); return new AmmoStation(def, gO); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoStandard - ammoStorage.StandardAmmo.RelInPack, def.SupplyEfficiency.AmmoStandard)); float num2 = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoSpecial - ammoStorage.SpecialAmmo.RelInPack, def.SupplyEfficiency.AmmoSpecial)); player.GiveAmmoRel((PlayerAgent)null, num, num2, 0f); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } private AmmoStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static AmmoStation() { } } public enum StationType { MEDI, AMMO, TOOL } public class SupplyUplimit { public float Medi { get; set; } = 0.6f; public float AmmoStandard { get; set; } = 1f; public float AmmoSpecial { get; set; } = 1f; public float Tool { get; set; } } public class SupplyEfficiency { public float Medi { get; set; } = 0.2f; public float AmmoStandard { get; set; } = 0.15f; public float AmmoSpecial { get; set; } = 0.15f; public float Tool { get; set; } } public class ResourceStationDefinition : GlobalZoneIndex { public int AreaIndex { get; set; } public string WorldEventObjectFilter { get; set; } = string.Empty; public StationType StationType { get; set; } = StationType.AMMO; public Vec3 Position { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); public float InteractDuration { get; set; } = 2.5f; public SupplyEfficiency SupplyEfficiency { get; set; } = new SupplyEfficiency(); public SupplyUplimit SupplyUplimit { get; set; } = new SupplyUplimit(); public int AllowedUseTimePerCooldown { get; set; } = int.MaxValue; public float CooldownTime { get; set; } = 3f; } public class ResourceStationManager : GenericExpeditionDefinitionManager<ResourceStationDefinition> { public static ResourceStationManager Current { get; private set; } protected override string DEFINITION_NAME => "ResourceStation"; private Dictionary<string, ResourceStation> Stations { get; } = new Dictionary<string, ResourceStation>(); private void Build(ResourceStationDefinition def) { if (Stations.ContainsKey(def.WorldEventObjectFilter)) { LegacyLogger.Error("ResourceStationManager: WorldEventObjectFilter '" + def.WorldEventObjectFilter + "' is already used"); return; } ResourceStation resourceStation = null; switch (def.StationType) { case StationType.MEDI: resourceStation = MediStation.Instantiate(def); break; case StationType.AMMO: resourceStation = AmmoStation.Instantiate(def); break; case StationType.TOOL: resourceStation = ToolStation.Instantiate(def); break; default: LegacyLogger.Error($"ResourceStation {def.StationType} is unimplemented"); return; } if (resourceStation != null) { Stations[def.WorldEventObjectFilter] = resourceStation; LegacyLogger.Debug("ResourceStation '" + def.WorldEventObjectFilter + "' instantiated"); } } private void BuildStations() { if (base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value)) { value.Definitions.ForEach(Build); } } private void Clear() { foreach (ResourceStation value in Stations.Values) { value.Destroy(); } Stations.Clear(); } private ResourceStationManager() { LevelAPI.OnBuildStart += delegate { Clear(); }; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnBuildDone += BuildStations; } static ResourceStationManager() { Current = new ResourceStationManager(); } } public struct RSStateStruct { public int LastInteractedPlayer; public int RemainingUseTime; public float CurrentCooldownTime; public bool Enabled; public RSStateStruct() { LastInteractedPlayer = 0; RemainingUseTime = 0; CurrentCooldownTime = 0f; Enabled = false; } } public class RSTimer : MonoBehaviour { private float startTime; private float endTime; private bool hasOnGoingTimer; private Action<float> OnProgress; private Action OnTimerEnd; public float RemainingTime { get { if (!hasOnGoingTimer) { return 0f; } return Math.Max(endTime - Clock.Time, 0f); } } private static List<GameObject> TimerGOs { get; } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName == 10 && hasOnGoingTimer) { float time = Clock.Time; if (OnProgress != null) { OnProgress((time - startTime) / (endTime - startTime)); } if (!(time < endTime)) { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd?.Invoke(); } } } public void StartTimer(float time) { if (time <= 0f) { LegacyLogger.Error("StartTimer: time is not positive!"); return; } if (hasOnGoingTimer) { LegacyLogger.Error("StartTimer: this timer is yet ended!"); return; } startTime = Clock.Time; endTime = startTime + time; hasOnGoingTimer = true; } private void OnDestroy() { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd = null; } public static RSTimer Instantiate(Action<float> onProgress, Action actionOnEnd) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown GameObject val = new GameObject(); RSTimer rSTimer = val.AddComponent<RSTimer>(); rSTimer.OnProgress = onProgress; rSTimer.OnTimerEnd = actionOnEnd; TimerGOs.Add(val); return rSTimer; } public static void DestroyAll() { TimerGOs.ForEach((Action<GameObject>)Object.Destroy); TimerGOs.Clear(); } private RSTimer() { } static RSTimer() { TimerGOs = new List<GameObject>(); ClassInjector.RegisterTypeInIl2Cpp<RSTimer>(); LevelAPI.OnBuildStart += DestroyAll; LevelAPI.OnLevelCleanup += DestroyAll; } } } namespace LEGACY.LegacyOverride.EnemyTargeting { internal class EnemyTargetingPrioritizer : MonoBehaviour { public const float UPDATE_INTERVAL = 3f; private float nextUpdateTime = float.NaN; internal EnemyAgent enemy; private Dam_EnemyDamageBase damage { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return obj.Damage; } } private AgentTarget target { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return ((AgentAI)obj.AI).Target; } } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((int)GameStateManager.CurrentStateName != 10 || !SNet.IsMaster) { return; } if (float.IsNaN(nextUpdateTime)) { nextUpdateTime = Clock.Time + 3f; } else if (!(Clock.Time < nextUpdateTime) && !((Object)(object)enemy == (Object)null)) { nextUpdateTime = Clock.Time + 3f; if ((int)((AgentAI)enemy.AI).Mode == 1 && target != null && !(((Il2CppObjectBase)target.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) && PlayerManager.PlayerAgentsInLevel.Count > 1 && ((Agent)PlayerManager.PlayerAgentsInLevel[0]).CourseNode.m_dimension.DimensionIndex == ((Agent)enemy).CourseNode.m_dimension.DimensionIndex) { TryPrioritizeCloserTarget(); } } } internal void TryPrioritizeCloserTarget() { _ = target; Agent val = null; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (((Agent)current).Alive && ((Il2CppObjectBase)((Agent)current).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) { val = (Agent)(object)current; break; } } if ((Object)(object)val == (Object)null) { enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current2 = enumerator.Current; if (((Agent)current2).Alive && ((Il2CppObjectBase)((Agent)current2).CourseNode.m_zone).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode.m_zone).Pointer) { val = (Agent)(object)current2; break; } } } if ((Object)(object)val != (Object)null) { ((AgentAI)enemy.AI).SetTarget(val); } } private void OnDestroy() { enemy = null; } static EnemyTargetingPrioritizer() { ClassInjector.RegisterTypeInIl2Cpp<EnemyTargetingPrioritizer>(); } } } namespace LEGACY.LegacyOverride.Patches { [HarmonyPatch] internal static class ExpeditionSuccessPage { [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")] private static void Post_CM_PageExpeditionSuccess_OnEnable(CM_PageExpeditionSuccess __instance) { if (!((Object)(object)__instance == (Object)null)) { SuccessPageCustomization currentCustomization = SuccessPageCustomizationManager.Current.CurrentCustomization; if (currentCustomization != null) { ((TMP_Text)__instance.m_header).SetText(LocalizedText.op_Implicit(currentCustomization.PageHeader), true); __instance.m_overrideSuccessMusic = currentCustomization.OverrideSuccessMusic; LegacyLogger.Warning("Post_CM_PageExpeditionSuccess_OnEnable: " + ((Object)currentCustomization.PageHeader).ToString()); } } } } [HarmonyPatch] internal static class LevelSpawnFogBeacon_BugFix { [HarmonyPostfix] [HarmonyPatch(typeof(HeavyFogRepellerGlobalState), "AttemptInteract")] private static void Post_HeavyFogRepellerGlobalState_AttemptInteract(HeavyFogRepellerGlobalState __instance) { LevelSpawnedFogBeaconSettings lSFBDef = LevelSpawnedFogBeaconManager.Current.GetLSFBDef(__instance); if (lSFBDef != null) { __instance.m_repellerSphere.Range = lSFBDef.Range; } } } [HarmonyPatch] internal class PrioritizeEnemyTargeting { private static bool s_patch = true; [HarmonyPostfix] [HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")] private static void UpdateTracking(EnemyCourseNavigation __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 if (!s_patch) { return; } int count = PlayerManager.PlayerAgentsInLevel.Count; if (!SNet.IsMaster || count <= 1) { return; } EnemyAgent owner = __instance.m_owner; if ((int)((StateMachine<ES_Base>)(object)owner.Locomotion).m_currentState.m_stateEnum == 14 || ((Il2CppObjectBase)__instance.m_targetRef.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { return; } PlayerAgent val = null; int num = Random.RandomRangeInt(0, count); for (int i = 0; i < count; i++) { PlayerAgent val2 = PlayerManager.PlayerAgentsInLevel[num]; if (((Agent)val2).Alive && ((Il2CppObjectBase)((Agent)val2).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { val = val2; break; } num = (num + 1) % count; } if ((Object)(object)val != (Object)null) { s_patch = false; ((AgentAI)owner.AI).SetTarget((Agent)(object)val); s_patch = true; } } } [HarmonyPatch] internal class RundownSelectionCustomization { [CompilerGenerated] private sealed class <reverseReveal>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CM_PageRundown_New p; public bool hosting; public Transform guixSurfaceTransform; private float <arrowScale>5__2; private float <tierMarkerDelay>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <reverseReveal>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Expected O, but got Unknown //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_040e: 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_0117: 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_00ac: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Expected O, but got Unknown //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Expected O, but got Unknown //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Expected O, but got Unknown //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Expected O, but got Unknown //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Expected O, but got Unknown //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <arrowScale>5__2 = p.m_tierSpacing * 5f * p.m_tierSpaceToArrowScale; if (hosting) { CoroutineManager.BlinkIn(p.m_buttonConnect, 0f, (Transform)null); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } goto IL_00ed; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.24f); <>1__state = 2; return true; case 2: <>1__state = -1; ((RectTransformComp)p.m_buttonConnect).SetVisible(false); goto IL_00ed; case 3: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 4; return true; case 4: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_SHRINK, ""); CoroutineEase.EaseLocalScale(p.m_textRundownHeader.transform, Vector3.one, new Vector3(0.6f, 0.6f, 0.6f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>2__current = CoroutineEase.EaseLocalScale(guixSurfaceTransform, Vector3.one, new Vector3(0.2f, 0.2f, 0.2f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 6; return true; case 6: <>1__state = -1; CoroutineEase.EaseLocalPos(p.m_textRundownHeader.transform, p.m_textRundownHeader.transform.localPosition, p.m_rundownHeaderPos, 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); CoroutineManager.BlinkIn(p.m_rundownIntelButton, 0f, (Transform)null); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 7; return true; case 7: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_TURN, ""); <>2__current = CoroutineEase.EaseLocalRot(guixSurfaceTransform, Vector3.zero, new Vector3(70f, 0f, 0f), 0.3f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 8; return true; case 8: <>1__state = -1; p.m_verticalArrow.SetActive(true); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 9; return true; case 9: <>1__state = -1; CoroutineManager.BlinkIn(((Component)p.m_tierMarkerSectorSummary).gameObject, 0f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 10; return true; case 10: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_START, ""); CoroutineEase.EaseLocalScale(p.m_verticalArrow.transform, new Vector3(1f, 0f, 1f), new Vector3(1f, <arrowScale>5__2, 1f), 4.3f, (EasingFunction)Easing.LinearTween, (Action)delegate { CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_STOP, ""); }, (BoolCheck)null); <tierMarkerDelay>5__3 = 0.6f; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 11; return true; case 11: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_3, ""); ((Component)p.m_guix_Tier3).gameObject.SetActive(true); for (int k = 0; k < p.m_expIconsTier3.Count; k++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier3[k]).gameObject, (float)k * 0.1f); } if (p.m_expIconsTier3.Count > 0) { p.m_tierMarker3.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 12; return true; } case 12: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); ((Component)p.m_guix_Tier5).gameObject.SetActive(true); for (int i = 0; i < p.m_expIconsTier5.Count; i++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier5[i]).gameObject, (float)i * 0.1f); } if (p.m_expIconsTier5.Count > 0) { p.m_tierMarker5.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 13; return true; } case 13: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_4, ""); ((Component)p.m_guix_Tier4).gameObject.SetActive(true); for (int m = 0; m < p.m_expIconsTier4.Count; m++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier4[m]).gameObject, (float)m * 0.1f); } if (p.m_expIconsTier4.Count > 0) { p.m_tierMarker4.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 14; return true; } case 14: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_2, ""); ((Component)p.m_guix_Tier2).gameObject.SetActive(true); for (int l = 0; l < p.m_expIconsTier2.Count; l++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier2[l]).gameObject, (float)l * 0.1f); } if (p.m_expIconsTier2.Count > 0) { p.m_tierMarker2.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 15; return true; } case 15: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_1, ""); ((Component)p.m_guix_Tier1).gameObject.SetActive(true); for (int j = 0; j < p.m_expIconsTier1.Count; j++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier1[j]).gameObject, (float)j * 0.1f); } if (p.m_expIconsTier1.Count > 0) { p.m_tierMarker1.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 16; return true; } case 16: { <>1__state = -1; ((Component)p.m_joinOnServerIdText).gameObject.SetActive(true); CoroutineManager.BlinkIn(p.m_aboutTheRundownButton, 0f, (Transform)null); CoroutineManager.BlinkIn(p.m_discordButton, 0.1f, (Transform)null); if (SNet.IsMaster || !SNet.IsInLobby) { CoroutineManager.BlinkIn(p.m_matchmakeAllButton, 0.2f, (Transform)null); } p.m_selectionIsRevealed = true; p.CheckClipboard(); return false; } IL_00ed: CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_MOVE_UP, ""); <>2__current = CoroutineEase.EaseLocalPos(guixSurfaceTransform, Vector3.zero, new Vector3(0f, 650f, 0f), 0.5f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.Mov
plugins/Vega/Custom/Oxygen.dll
Decompiled 18 hours agousing 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 AK; using Agents; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using GTFO.API; using GTFO.API.Utilities; using GameData; using GameEvent; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Localization; using MTFO.Managers; using Microsoft.CodeAnalysis; using Oxygen.Components; using Oxygen.Config; using Oxygen.Utils; using Oxygen.Utils.PartialData; using Player; using SNetwork; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Oxygen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Oxygen")] [assembly: AssemblyTitle("Oxygen")] [assembly: AssemblyVersion("1.0.0.0")] [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 Oxygen { [BepInPlugin("Inas.Oxygen", "Oxygen", "1.3.2")] [BepInProcess("GTFO.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { [CompilerGenerated] private static class <>O { public static Action <0>__OnBuildDone; public static Action <1>__OnLevelCleanup; public static Action <2>__Setup; public static Action <3>__OnLevelCleanup; public static Action <4>__OnBuildStart; public static Action <5>__OnLevelCleanup; public static LiveEditEventHandler <6>__Listener_FileChanged1; } public const string MODNAME = "Oxygen"; public const string AUTHOR = "Inas"; public const string GUID = "Inas.Oxygen"; public const string VERSION = "1.3.2"; public static readonly string OXYGEN_CONFIG_PATH = Path.Combine(ConfigManager.CustomPath, "Oxygen"); public static Dictionary<uint, OxygenBlock> lookup = new Dictionary<uint, OxygenBlock>(); private static LiveEditListener listener = null; public override void Load() { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown if (!Directory.Exists(OXYGEN_CONFIG_PATH)) { Directory.CreateDirectory(OXYGEN_CONFIG_PATH); StreamWriter streamWriter = File.CreateText(Path.Combine(OXYGEN_CONFIG_PATH, "Template.json")); streamWriter.WriteLine(ConfigManager.Serialize(new OxygenConfig())); streamWriter.Flush(); streamWriter.Close(); } ClassInjector.RegisterTypeInIl2Cpp<AirManager>(); LevelAPI.OnBuildDone += AirManager.OnBuildDone; LevelAPI.OnLevelCleanup += AirManager.OnLevelCleanup; ClassInjector.RegisterTypeInIl2Cpp<AirBar>(); LevelAPI.OnBuildStart += AirBar.Setup; LevelAPI.OnLevelCleanup += AirBar.OnLevelCleanup; ClassInjector.RegisterTypeInIl2Cpp<AirPlane>(); LevelAPI.OnBuildStart += AirPlane.OnBuildStart; LevelAPI.OnLevelCleanup += AirPlane.OnLevelCleanup; new Harmony("Inas.Oxygen").PatchAll(); foreach (string item in Directory.EnumerateFiles(OXYGEN_CONFIG_PATH, "*.json", SearchOption.AllDirectories)) { ConfigManager.Load<OxygenConfig>(item, out var config); foreach (OxygenBlock block in config.Blocks) { foreach (uint fogSetting in block.FogSettings) { if (!lookup.ContainsKey(fogSetting)) { lookup.Add(fogSetting, block); } } } } listener = LiveEdit.CreateListener(OXYGEN_CONFIG_PATH, "*.json", true); LiveEditListener obj = listener; object obj2 = <>O.<6>__Listener_FileChanged1; if (obj2 == null) { LiveEditEventHandler val = Listener_FileChanged1; <>O.<6>__Listener_FileChanged1 = val; obj2 = (object)val; } obj.FileChanged += (LiveEditEventHandler)obj2; } private static void Listener_FileChanged1(LiveEditEventArgs e) { Log.Warning("LiveEdit File Changed: " + e.FullPath + "."); LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content) { foreach (OxygenBlock block in ConfigManager.Deserialize<OxygenConfig>(content).Blocks) { foreach (uint fogSetting in block.FogSettings) { if (lookup.ContainsKey(fogSetting)) { lookup.Remove(fogSetting); } lookup.Add(fogSetting, block); Log.Warning($"Replaced OxygenConfig for FogSetting: {fogSetting}."); } } if (GameStateManager.IsInExpedition) { AirManager.Current.UpdateAirConfig(AirManager.Current.FogSetting(), LiveEditForceUpdate: true); } }); } } } namespace Oxygen.Utils { internal static class Extension { public static T Instantiate<T>(this GameObject gameObject, string name) where T : Component { GameObject obj = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent, false); ((Object)obj).name = name; return obj.GetComponent<T>(); } } internal class LocalizedTextConverter : JsonConverter<LocalizedText> { public override bool HandleNull => false; public override LocalizedText Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { //IL_0018: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown switch (reader.TokenType) { case JsonTokenType.String: { string @string = reader.GetString(); return new LocalizedText { Id = 0u, UntranslatedText = @string }; } case JsonTokenType.Number: return new LocalizedText { Id = reader.GetUInt32(), UntranslatedText = null }; default: throw new JsonException($"LocalizedTextJson type: {reader.TokenType} is not implemented!"); } } public override void Write(Utf8JsonWriter writer, LocalizedText value, JsonSerializerOptions options) { JsonSerializer.Serialize<LocalizedText>(writer, value, options); } } internal static class Log { private static ManualLogSource source; static Log() { source = Logger.CreateLogSource("Oxygen"); } public static void Debug(object msg) { source.LogDebug(msg); } public static void Error(object msg) { source.LogError(msg); } public static void Fatal(object msg) { source.LogFatal(msg); } public static void Info(object msg) { source.LogInfo(msg); } public static void Message(object msg) { source.LogMessage(msg); } public static void Warning(object msg) { source.LogWarning(msg); } } } namespace Oxygen.Utils.PartialData { public static class MTFOPartialDataUtil { public const string PLUGIN_GUID = "MTFO.Extension.PartialBlocks"; public static JsonConverter PersistentIDConverter { get; private set; } public static JsonConverter LocalizedTextConverter { get; private set; } public static bool IsLoaded { get; private set; } public static bool Initialized { get; private set; } public static string PartialDataPath { get; private set; } public static string ConfigPath { get; private set; } static MTFOPartialDataUtil() { PersistentIDConverter = null; LocalizedTextConverter = null; IsLoaded = false; Initialized = false; PartialDataPath = string.Empty; ConfigPath = string.Empty; if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("MTFO.Extension.PartialBlocks", out var value)) { return; } try { Assembly obj = ((value == null) ? null : value.Instance?.GetType()?.Assembly) ?? null; if ((object)obj == null) { throw new Exception("Assembly is Missing!"); } Type[] types = obj.GetTypes(); Type type = types.First((Type t) => t.Name == "PersistentIDConverter"); if ((object)type == null) { throw new Exception("Unable to Find PersistentIDConverter Class"); } Type type2 = types.First((Type t) => t.Name == "LocalizedTextConverter"); if ((object)type2 == null) { throw new Exception("Unable to Find LocalizedTextConverter Class"); } Type obj2 = types.First((Type t) => t.Name == "PartialDataManager") ?? throw new Exception("Unable to Find PartialDataManager Class"); PropertyInfo property = obj2.GetProperty("Initialized", BindingFlags.Static | BindingFlags.Public); PropertyInfo property2 = obj2.GetProperty("PartialDataPath", BindingFlags.Static | BindingFlags.Public); PropertyInfo? property3 = obj2.GetProperty("ConfigPath", BindingFlags.Static | BindingFlags.Public); if ((object)property == null) { throw new Exception("Unable to Find Property: Initialized"); } if ((object)property2 == null) { throw new Exception("Unable to Find Property: PartialDataPath"); } if ((object)property3 == null) { throw new Exception("Unable to Find Field: ConfigPath"); } Initialized = (bool)property.GetValue(null); PartialDataPath = (string)property2.GetValue(null); ConfigPath = (string)property3.GetValue(null); PersistentIDConverter = (JsonConverter)Activator.CreateInstance(type); LocalizedTextConverter = (JsonConverter)Activator.CreateInstance(type2); IsLoaded = true; } catch (Exception value2) { Log.Error($"Exception thrown while reading data from MTFO_Extension_PartialData:\n{value2}"); } } } public static class MTFOUtil { public const string PLUGIN_GUID = "com.dak.MTFO"; public const BindingFlags PUBLIC_STATIC = BindingFlags.Static | BindingFlags.Public; public static string GameDataPath { get; private set; } public static string CustomPath { get; private set; } public static bool HasCustomContent { get; private set; } public static bool IsLoaded { get; private set; } static MTFOUtil() { GameDataPath = string.Empty; CustomPath = string.Empty; HasCustomContent = false; IsLoaded = false; if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("com.dak.MTFO", out var value)) { return; } try { Assembly obj = ((value == null) ? null : value.Instance?.GetType()?.Assembly) ?? null; if ((object)obj == null) { throw new Exception("Assembly is Missing!"); } Type obj2 = obj.GetTypes().First((Type t) => t.Name == "ConfigManager") ?? throw new Exception("Unable to Find ConfigManager Class"); FieldInfo field = obj2.GetField("GameDataPath", BindingFlags.Static | BindingFlags.Public); FieldInfo field2 = obj2.GetField("CustomPath", BindingFlags.Static | BindingFlags.Public); FieldInfo? field3 = obj2.GetField("HasCustomContent", BindingFlags.Static | BindingFlags.Public); if ((object)field == null) { throw new Exception("Unable to Find Field: GameDataPath"); } if ((object)field2 == null) { throw new Exception("Unable to Find Field: CustomPath"); } if ((object)field3 == null) { throw new Exception("Unable to Find Field: HasCustomContent"); } GameDataPath = (string)field.GetValue(null); CustomPath = (string)field2.GetValue(null); HasCustomContent = (bool)field3.GetValue(null); IsLoaded = true; } catch (Exception value2) { Log.Error($"Exception thrown while reading path from DataDumper (MTFO): \n{value2}"); } } } } namespace Oxygen.Patches { [HarmonyPatch] internal class Patches_Dam_PlayerDamageLocal { [HarmonyPrefix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveNoAirDamage")] public static bool Pre_ReceiveNoAirDamage(Dam_PlayerDamageLocal __instance, pMiniDamageData data) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) float num = ((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)__instance).HealthMax); ((Dam_PlayerDamageBase)__instance).m_nextRegen = Clock.Time + ((Dam_PlayerDamageBase)__instance).Owner.PlayerData.healthRegenStartDelayAfterDamage; if (((Agent)((Dam_PlayerDamageBase)__instance).Owner).IsLocallyOwned) { DramaManager.CurrentState.OnLocalDamage(num); GameEventManager.PostEvent((eGameEvent)13, ((Dam_PlayerDamageBase)__instance).Owner, num, "", (Dictionary<string, string>)null); } else { DramaManager.CurrentState.OnTeammatesDamage(num); } if (((Dam_PlayerDamageBase)__instance).IgnoreAllDamage) { return false; } if (SNet.IsMaster && !((Dam_SyncedDamageBase)__instance).RegisterDamage(num)) { ((Dam_SyncedDamageBase)__instance).SendSetHealth(((Dam_SyncedDamageBase)__instance).Health); } __instance.Hitreact(((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)__instance).HealthMax), Vector3.zero, true, false, false); return false; } [HarmonyPostfix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveBulletDamage")] public static void Post_ReceiveBulletDamage() { AirManager.Current.ResetHealthToRegen(); } [HarmonyPostfix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveMeleeDamage")] public static void Post_ReceiveMeleeDamage() { AirManager.Current.ResetHealthToRegen(); } [HarmonyPostfix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveFireDamage")] public static void Post_ReceiveFireDamage() { AirManager.Current.ResetHealthToRegen(); } [HarmonyPostfix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveShooterProjectileDamage")] public static void Post_ReceiveShooterProjectileDamage() { AirManager.Current.ResetHealthToRegen(); } [HarmonyPostfix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveTentacleAttackDamage")] public static void Post_ReceiveTentacleAttackDamage() { AirManager.Current.ResetHealthToRegen(); } [HarmonyPostfix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceivePushDamage")] public static void Post_ReceivePushDamage() { AirManager.Current.ResetHealthToRegen(); } [HarmonyPostfix] [HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveSetDead")] public static void Post_ReceiveSetDead() { AirManager.Current.ResetHealthToRegen(); } } [HarmonyPatch(typeof(EnvironmentStateManager), "UpdateFog")] internal class EnvironmentStateManager_UpdateFog { public static void Prefix(EnvironmentStateManager __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AirManager.Current == (Object)null) { return; } FogState val = ((Il2CppArrayBase<FogState>)(object)__instance.m_stateReplicator.State.FogStates)[__instance.m_latestKnownLocalDimensionCreationIndex]; if (val.FogDataID != 0) { AirManager.Current.UpdateAirConfig(val.FogDataID); if (!AirManager.Current.HasAirConfig()) { AirManager.Current.StopInfectionLoop(); } } } } [HarmonyPatch(typeof(FogRepeller_Sphere), "StartRepelling")] internal class FogRepeller_Sphere_StartRepelling { public static void Postfix(ref FogRepeller_Sphere __instance) { if (__instance.m_infectionShield != null) { EffectVolumeManager.UnregisterVolume((EffectVolume)(object)__instance.m_infectionShield); ((EffectVolume)__instance.m_infectionShield).contents = (eEffectVolumeContents)0; EffectVolumeManager.RegisterVolume((EffectVolume)(object)__instance.m_infectionShield); } } } [HarmonyPatch(typeof(LocalPlayerAgentSettings), "UpdateBlendTowardsTargetFogSetting")] internal class LocalPlayerAgentSettings_UpdateBlendTowardsTargetFogSetting { public static void Postfix(LocalPlayerAgentSettings __instance, float amount) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!AirManager.Current.HasAirConfig()) { AirPlane.Current.Unregister(); } else { if (__instance.m_targetFogSettings == null || !SNet.LocalPlayer.HasPlayerAgent) { return; } PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); if ((Object)(object)localPlayerAgent.FPSCamera == (Object)null) { return; } AirPlane current = AirPlane.Current; if (!((Object)(object)current == (Object)null) && RundownManager.ExpeditionIsStarted) { float num = 0f; Dimension val = default(Dimension); if (Dimension.GetDimension(((Agent)localPlayerAgent).DimensionIndex, ref val)) { num = val.GroundY; } PreLitVolume prelitVolume = localPlayerAgent.FPSCamera.PrelitVolume; ((EffectVolume)current.airPlane).invert = (double)prelitVolume.m_densityHeightMaxBoost > (double)prelitVolume.m_fogDensity; ((EffectVolume)current.airPlane).contents = (eEffectVolumeContents)1; ((EffectVolume)current.airPlane).modification = (eEffectVolumeModification)0; ((EffectVolume)current.airPlane).modificationScale = AirManager.Current.AirLoss(); current.airPlane.lowestAltitude = prelitVolume.m_densityHeightAltitude + num; current.airPlane.highestAltitude = prelitVolume.m_densityHeightAltitude + prelitVolume.m_densityHeightRange + num; AirPlane.Current.Register(); } } } } [HarmonyPatch] internal class Patch_PlayerAgent { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerAgent), "ReceiveModification")] public static void ReceiveModification(PlayerAgent __instance, ref EV_ModificationData data) { if (AirManager.Current.HasAirConfig()) { if ((double)data.health != 0.0) { AirManager.Current.RemoveAir(data.health); } else { AirManager.Current.AddAir(); } data.health = 0f; } } [HarmonyPostfix] [HarmonyWrapSafe] [HarmonyPatch(typeof(PlayerAgent), "Setup")] internal static void Post_Setup(PlayerAgent __instance) { if (((Agent)__instance).IsLocallyOwned) { AirManager.Setup(__instance); } } } } namespace Oxygen.Config { public class ConfigManager { private static readonly JsonSerializerOptions s_SerializerOptions; public static T Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, s_SerializerOptions); } public static string Serialize<T>(T value) { return JsonSerializer.Serialize(value, s_SerializerOptions); } static ConfigManager() { s_SerializerOptions = new JsonSerializerOptions { AllowTrailingCommas = true, ReadCommentHandling = JsonCommentHandling.Skip, PropertyNameCaseInsensitive = true, WriteIndented = true }; s_SerializerOptions.Converters.Add(new JsonStringEnumConverter()); if (MTFOPartialDataUtil.IsLoaded && MTFOPartialDataUtil.Initialized) { s_SerializerOptions.Converters.Add(MTFOPartialDataUtil.PersistentIDConverter); s_SerializerOptions.Converters.Add(MTFOPartialDataUtil.LocalizedTextConverter); Log.Message("PartialData Support Found!"); } else { s_SerializerOptions.Converters.Add(new LocalizedTextConverter()); } } public static void Load<T>(string file, out T config) where T : new() { if (file.Length < ".json".Length) { config = default(T); return; } if (file.Substring(file.Length - ".json".Length) != ".json") { file += ".json"; } file = File.ReadAllText(Path.Combine(ConfigManager.CustomPath, "Oxygen", file)); config = Deserialize<T>(file); } } public class AirText { public float x { get; set; } public float y { get; set; } public LocalizedText Text { get; set; } } public class OxygenConfig { public List<OxygenBlock> Blocks { get; set; } = new List<OxygenBlock> { new OxygenBlock() }; } public class OxygenBlock { public float AirLoss { get; set; } public float AirGain { get; set; } = 1f; public float DamageTime { get; set; } = 1f; public float DamageAmount { get; set; } public bool ShatterGlass { get; set; } public float ShatterAmount { get; set; } public float DamageThreshold { get; set; } = 0.1f; public bool AlwaysDisplayAirBar { get; set; } public float HealthRegenProportion { get; set; } = 1f; public float TimeToStartHealthRegen { get; set; } = 3f; public float TimeToCompleteHealthRegen { get; set; } = 5f; public AirText AirText { get; set; } public List<uint> FogSettings { get; set; } = new List<uint> { 0u }; } } namespace Oxygen.Components { public class AirBar : MonoBehaviour { public static AirBar Current; private TextMeshPro m_airText; private TextMeshPro m_airTextLocalization; private float m_airTextX; private float m_airTextY; private float m_airTextZ; private RectTransform m_air1; private RectTransform m_air2; private SpriteRenderer m_airBar1; private SpriteRenderer m_airBar2; private float m_airWidth = 100f; private float m_barHeightMin = 3f; private float m_barHeightMax = 9f; private Color m_airLow = new Color(0f, 0.5f, 0.5f); private Color m_airHigh = new Color(0f, 0.3f, 0.8f); public AirBar(IntPtr value) : base(value) { }//IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) public static void Setup() { if ((Object)(object)Current == (Object)null) { Current = ((Component)GuiManager.Current.m_playerLayer.m_playerStatus).gameObject.AddComponent<AirBar>(); Current.Init(); } } private void Init() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_airText == (Object)null) { m_airText = ((Component)GuiManager.Current.m_playerLayer.m_playerStatus.m_healthText).gameObject.Instantiate<TextMeshPro>("AirText"); TextMeshPro airText = m_airText; ((TMP_Text)airText).fontSize = ((TMP_Text)airText).fontSize / 1.25f; m_airText.transform.Translate(0f, -30f, 0f); } if ((Object)(object)m_airTextLocalization == (Object)null) { m_airTextLocalization = ((Component)GuiManager.Current.m_playerLayer.m_playerStatus.m_pulseText).gameObject.Instantiate<TextMeshPro>("AirText Localization"); ((Behaviour)m_airTextLocalization).enabled = true; m_airTextLocalization.transform.Translate(300f - m_airWidth, -45f, 0f); m_airTextX = m_airTextLocalization.transform.position.x; m_airTextY = m_airTextLocalization.transform.position.y; m_airTextZ = m_airTextLocalization.transform.position.z; } if ((Object)(object)m_air1 == (Object)null) { m_air1 = ((Component)((Component)GuiManager.Current.m_playerLayer.m_playerStatus.m_health1).gameObject.transform.parent).gameObject.Instantiate<RectTransform>("AirFill Right"); ((Component)m_air1).transform.Translate(0f, -30f, 0f); SpriteRenderer component = ((Component)((Transform)m_air1).GetChild(0)).GetComponent<SpriteRenderer>(); component.size = new Vector2(m_airWidth, component.size.y); m_airBar1 = ((Component)((Transform)m_air1).GetChild(1)).GetComponent<SpriteRenderer>(); ((Renderer)((Component)((Transform)m_air1).GetChild(2)).GetComponent<SpriteRenderer>()).enabled = false; } if ((Object)(object)m_air2 == (Object)null) { m_air2 = ((Component)((Component)GuiManager.Current.m_playerLayer.m_playerStatus.m_health2).gameObject.transform.parent).gameObject.Instantiate<RectTransform>("AirFill Left"); ((Component)m_air2).transform.Translate(0f, 30f, 0f); SpriteRenderer component2 = ((Component)((Transform)m_air2).GetChild(0)).GetComponent<SpriteRenderer>(); component2.size = new Vector2(m_airWidth, component2.size.y); m_airBar2 = ((Component)((Transform)m_air2).GetChild(1)).GetComponent<SpriteRenderer>(); ((Renderer)((Component)((Transform)m_air2).GetChild(2)).GetComponent<SpriteRenderer>()).enabled = false; } UpdateAirBar(1f); SetVisible(vis: false); } public void UpdateAirBar(float air) { SetAirPercentageText(air); SetAirBar(m_airBar1, air); SetAirBar(m_airBar2, air); } private void SetAirBar(SpriteRenderer bar, float val) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) bar.size = new Vector2(val * m_airWidth, Mathf.Lerp(m_barHeightMin, m_barHeightMax, val)); bar.color = Color.Lerp(m_airLow, m_airHigh, val); } private void SetAirPercentageText(float val) { //IL_0001: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Color color = Color.Lerp(m_airLow, m_airHigh, val); ((TMP_Text)m_airText).text = "O<size=75%>2</size>"; ((Graphic)m_airText).color = color; ((TMP_Text)m_airText).ForceMeshUpdate(true, false); ((Graphic)m_airTextLocalization).color = color; ((TMP_Text)m_airTextLocalization).ForceMeshUpdate(true, false); } public void UpdateAirText(OxygenBlock config) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (config != null) { string text = LocalizedText.op_Implicit(config.AirText.Text); float x = config.AirText.x; float y = config.AirText.y; ((TMP_Text)m_airTextLocalization).text = text; ((TMP_Text)m_airTextLocalization).ForceMeshUpdate(true, false); CoroutineManager.BlinkIn(((Component)m_airTextLocalization).gameObject, 0f); m_airTextLocalization.transform.SetPositionAndRotation(new Vector3(m_airTextX + x, m_airTextY + y, m_airTextZ), m_airTextLocalization.transform.rotation); } } public void SetVisible(bool vis) { ((Component)m_airText).gameObject.SetActive(vis); ((Component)m_airTextLocalization).gameObject.SetActive(vis); ((Component)m_air1).gameObject.SetActive(vis); ((Component)m_air2).gameObject.SetActive(vis); } public static void OnLevelCleanup() { if (!((Object)(object)Current == (Object)null)) { Current.SetVisible(vis: false); } } } public class AirManager : MonoBehaviour { public static AirManager Current; public PlayerAgent m_playerAgent; private HUDGlassShatter m_hudGlass; private Dam_PlayerDamageBase Damage; public OxygenBlock config; private uint fogSetting; private FogSettingsDataBlock fogSettingDB; private float airAmount = 1f; private float damageTick; private float glassShatterAmount; private bool m_isInInfectionLoop; private bool isRegeningHealth; private float healthToRegen; private float healthRegenTick; private float tickUntilHealthRegenHealthStart; private readonly float regenHealthTickInterval = 0.25f; private float healthRegenAmountPerInterval; internal bool PlayerShouldCough; private readonly float CoughPerLoss = 0.1f; private float CoughLoss; public AirManager(IntPtr value) : base(value) { } public static void Setup(PlayerAgent playerAgent) { Current = ((Component)playerAgent).gameObject.AddComponent<AirManager>(); } public static void OnBuildDone() { if (!((Object)(object)Current == (Object)null)) { Current.m_playerAgent = PlayerManager.GetLocalPlayerAgent(); Current.m_hudGlass = ((Component)Current.m_playerAgent.FPSCamera).GetComponent<HUDGlassShatter>(); Current.Damage = ((Component)Current.m_playerAgent).gameObject.GetComponent<Dam_PlayerDamageBase>(); Current.UpdateAirConfig(RundownManager.ActiveExpedition.Expedition.FogSettings); AirBar.Current.UpdateAirText(Current.config); } } public static void OnLevelCleanup() { if (!((Object)(object)Current == (Object)null)) { if (Current.m_isInInfectionLoop) { Current.StopInfectionLoop(); } Current.config = null; Current.fogSetting = 0u; Current.fogSettingDB = null; Current.airAmount = 0f; Current.damageTick = 0f; Current.glassShatterAmount = 0f; Current.healthToRegen = 0f; Current.m_playerAgent = null; Current.m_hudGlass = null; Current.Damage = null; } } private void Update() { if (!RundownManager.ExpeditionIsStarted) { return; } if (!HasAirConfig()) { AirBar.Current.SetVisible(vis: false); return; } if (airAmount == 1f) { if (config.AlwaysDisplayAirBar) { AirBar.Current.SetVisible(vis: true); } else { AirBar.Current.SetVisible(vis: false); } } else { AirBar.Current.SetVisible(vis: true); } if (airAmount <= config.DamageThreshold) { damageTick += Time.deltaTime; if (damageTick > config.DamageTime && ((Agent)m_playerAgent).Alive) { AirDamage(); } isRegeningHealth = false; } else if (healthToRegen > 0f) { tickUntilHealthRegenHealthStart += Time.deltaTime; if (tickUntilHealthRegenHealthStart > config.TimeToStartHealthRegen) { if (healthRegenAmountPerInterval == 0f) { healthRegenAmountPerInterval = healthToRegen * (regenHealthTickInterval / config.TimeToCompleteHealthRegen); } RegenHealth(); if (!isRegeningHealth) { Damage.m_nextRegen = Clock.Time + config.TimeToStartHealthRegen + config.TimeToCompleteHealthRegen; isRegeningHealth = true; } } } else { isRegeningHealth = false; } } public void AddAir() { if (HasAirConfig()) { float airGain = config.AirGain; airAmount = Mathf.Clamp01(airAmount + airGain); AirBar.Current.UpdateAirBar(airAmount); if (fogSettingDB.Infection <= 0f && m_isInInfectionLoop) { StopInfectionLoop(); } } } public void RemoveAir(float amount) { if (HasAirConfig()) { amount = config.AirLoss; airAmount = Mathf.Clamp01(airAmount - amount); AirBar.Current.UpdateAirBar(airAmount); if (fogSettingDB.Infection <= 0f && amount > 0f) { StartInfectionLoop(); } } } public void AirDamage() { float health = ((Dam_SyncedDamageBase)Damage).Health; float damageAmount = config.DamageAmount; Damage.m_nextRegen = Clock.Time + config.TimeToStartHealthRegen; if (!(health <= 1f)) { ((Dam_SyncedDamageBase)Damage).NoAirDamage(damageAmount); if (config.ShatterGlass) { glassShatterAmount += config.ShatterAmount; m_hudGlass.SetGlassShatterProgression(glassShatterAmount); } damageTick = 0f; tickUntilHealthRegenHealthStart = 0f; healthRegenAmountPerInterval = 0f; healthToRegen += damageAmount * config.HealthRegenProportion; CoughLoss += damageAmount; if (CoughLoss > CoughPerLoss) { PlayerShouldCough = true; CoughLoss = 0f; } } } public void RegenHealth() { if (healthToRegen <= 0f) { return; } tickUntilHealthRegenHealthStart = config.TimeToStartHealthRegen; healthRegenTick += Time.deltaTime; if (healthRegenTick > regenHealthTickInterval) { float num = healthRegenAmountPerInterval; if (num >= healthToRegen) { num = healthToRegen; healthToRegen = 0f; tickUntilHealthRegenHealthStart = 0f; healthRegenAmountPerInterval = 0f; isRegeningHealth = false; } else { healthToRegen -= num; } ((Dam_SyncedDamageBase)Damage).AddHealth(num, (Agent)(object)m_playerAgent); healthRegenTick = 0f; } } public void UpdateAirConfig(uint fogsetting, bool LiveEditForceUpdate = false) { if (fogsetting != 0 && (fogsetting != fogSetting || LiveEditForceUpdate)) { if (Plugin.lookup.ContainsKey(fogsetting)) { config = Plugin.lookup[fogsetting]; } else if (Plugin.lookup.ContainsKey(0u)) { config = Plugin.lookup[0u]; } else { config = null; airAmount = 1f; } fogSetting = fogsetting; fogSettingDB = GameDataBlockBase<FogSettingsDataBlock>.GetBlock(fogsetting); if (GameStateManager.IsInExpedition) { AirBar.Current.UpdateAirText(config); } } } public void ResetHealthToRegen() { healthRegenTick = 0f; healthToRegen = 0f; tickUntilHealthRegenHealthStart = 0f; } public float AirLoss() { if (config != null) { return config.AirLoss; } return 0f; } public bool AlwaysDisplayAirBar() { if (config != null) { return config.AlwaysDisplayAirBar; } return false; } public uint FogSetting() { return fogSetting; } public float HealthToRegen() { return healthToRegen; } public string AirText() { return LocalizedText.op_Implicit((config == null) ? null : config.AirText.Text); } public float AirTextX() { if (config != null) { return config.AirText.x; } return 0f; } public float AirTextY() { if (config != null) { return config.AirText.y; } return 0f; } public bool HasAirConfig() { return config != null; } public void StartInfectionLoop() { if (!m_isInInfectionLoop) { m_playerAgent.Sound.Post(EVENTS.INFECTION_EFFECT_LOOP_START, true); m_isInInfectionLoop = true; } } public void StopInfectionLoop() { if (m_isInInfectionLoop) { if ((Object)(object)m_playerAgent != (Object)null && m_playerAgent.Sound != null) { m_playerAgent.Sound.Post(EVENTS.INFECTION_EFFECT_LOOP_STOP, true); } m_isInInfectionLoop = false; } } } public class AirPlane : MonoBehaviour { public static AirPlane Current; public EV_Plane airPlane; private bool isAirPlaneRegistered; public AirPlane(IntPtr value) : base(value) { } public static void OnBuildStart() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if ((Object)(object)Current == (Object)null) { Current = ((Component)LocalPlayerAgentSettings.Current).gameObject.AddComponent<AirPlane>(); } Current.airPlane = new EV_Plane(); uint num = RundownManager.ActiveExpedition.Expedition.FogSettings; if (num == 0) { num = 21u; } OxygenBlock oxygenBlock = (Plugin.lookup.ContainsKey(num) ? Plugin.lookup[num] : ((!Plugin.lookup.ContainsKey(0u)) ? null : Plugin.lookup[0u])); FogSettingsDataBlock block = GameDataBlockBase<FogSettingsDataBlock>.GetBlock(num); ((EffectVolume)Current.airPlane).invert = block.DensityHeightMaxBoost > block.FogDensity; ((EffectVolume)Current.airPlane).contents = (eEffectVolumeContents)1; ((EffectVolume)Current.airPlane).modification = (eEffectVolumeModification)0; Current.airPlane.lowestAltitude = block.DensityHeightAltitude; Current.airPlane.highestAltitude = block.DensityHeightAltitude + block.DensityHeightRange; if (oxygenBlock != null) { ((EffectVolume)Current.airPlane).modificationScale = oxygenBlock.AirLoss; Current.Register(); } } public static void OnLevelCleanup() { if (!((Object)(object)Current == (Object)null)) { Current.Unregister(); Current.isAirPlaneRegistered = false; Current.airPlane = null; } } public void Register() { if (airPlane != null && !isAirPlaneRegistered) { EffectVolumeManager.RegisterVolume((EffectVolume)(object)airPlane); isAirPlaneRegistered = true; } } public void Unregister() { if (airPlane != null && isAirPlaneRegistered) { EffectVolumeManager.UnregisterVolume((EffectVolume)(object)airPlane); isAirPlaneRegistered = false; } } } }
plugins/Vega/Custom/PortalPuzzleChanger.dll
Decompiled 18 hours agousing 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 AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using ChainedPuzzles; using Enemies; using FX_EffectSystem; using GTFO.API; using GTFO.API.Components; using GTFO.API.JSON.Converters; using GTFO.API.Wrappers; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using LevelGeneration; using MTFO.Managers; using Microsoft.CodeAnalysis; using Player; using PortalPuzzleChanger.ConfigFiles; using PortalPuzzleChanger.GameScripts; using PortalPuzzleChanger.Plugin; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("PortalPuzzleChanger")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PortalPuzzleChanger")] [assembly: AssemblyTitle("PortalPuzzleChanger")] [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 PortalPuzzleChanger.Plugin { [BepInPlugin("com.Breeze.PortalPuzzleChanger", "PortalPuzzleChanger", "0.0.1")] [BepInProcess("GTFO.exe")] internal class EntryPoint : BasePlugin { public static Dictionary<string, Sprite> CachedSprites; 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown LogSource = ((BasePlugin)this).Log; m_Harmony = new Harmony("_PortalPuzzleChanger_"); m_Harmony.PatchAll(); SerializerOptions.Converters.Add((JsonConverter)new LocalizedTextConverter()); SerializerOptions.Converters.Add((JsonConverter)new Vector3Converter()); SerializerOptions.Converters.Add((JsonConverter)new Vector2Converter()); SerializerOptions.Converters.Add((JsonConverter)new ColorConverter()); PortalPuzzleChangerSetup.Load(); EnemyTagChangerConfigSetup.Load(); GrenadeLauncherConfigSetup.Load(); ClassInjector.RegisterTypeInIl2Cpp<GrenadeProjectile>(); AssetAPI.OnAssetBundlesLoaded += OnAssetsLoaded; } public void OnAssetsLoaded() { //IL_0060: 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) List<EnemyTagChanger> list = EnemyTagChangerConfigSetup.EnabledConfigs.Values.ToList(); for (int i = 0; i < list.Count; i++) { if (!string.IsNullOrEmpty(list[i].CustomImagePath)) { Texture2D loadedAsset = AssetAPI.GetLoadedAsset<Texture2D>(list[i].CustomImagePath); Sprite val = Sprite.Create(loadedAsset, new Rect(0f, 0f, (float)((Texture)loadedAsset).width, (float)((Texture)loadedAsset).height), new Vector2(0.5f, 0.5f), 64f); ((Object)val).hideFlags = (HideFlags)61; ((Object)val).name = list[i].CustomImagePath; CachedSprites.Add(((Object)val).name, val); Debug("Created a sprite from path: " + list[i].CustomImagePath); } } } 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 class PortalPuzzleChangerSetup { public static Dictionary<uint, List<PortalEntry>> EnabledConfigs = new Dictionary<uint, List<PortalEntry>>(); private static List<PortalChangerConfig>? Configs; public static string Name { get; } = "PortalPuzzleChanger.json"; public static void Load() { string path = Path.Combine(ConfigManager.CustomPath, Name); if (File.Exists(path)) { Configs = JsonSerializer.Deserialize<List<PortalChangerConfig>>(File.ReadAllText(path), EntryPoint.SerializerOptions); EntryPoint.Debug(Name + " has loaded successfully"); } else { Configs = new List<PortalChangerConfig> { new PortalChangerConfig() }; string contents = JsonSerializer.Serialize(Configs, EntryPoint.SerializerOptions); File.WriteAllText(path, contents); EntryPoint.DebugWarning(Name + " did not exist, creating it now"); } EnabledConfigs.Clear(); int count = Configs.Count; for (int i = 0; i < count; i++) { if (Configs[i].InternalEnabled) { EnabledConfigs.Add(Configs[i].MainLevelLayoutID, Configs[i].PortalEntries); } } } } public class EnemyTagChangerConfigSetup { public static Dictionary<uint, EnemyTagChanger> EnabledConfigs = new Dictionary<uint, EnemyTagChanger>(); private static List<EnemyTagChanger>? Configs; public static string Name { get; } = "EnemyTags.json"; public static void Load() { string path = Path.Combine(ConfigManager.CustomPath, Name); if (File.Exists(path)) { Configs = JsonSerializer.Deserialize<List<EnemyTagChanger>>(File.ReadAllText(path), EntryPoint.SerializerOptions); EntryPoint.Debug(Name + " has loaded successfully"); } else { Configs = new List<EnemyTagChanger> { new EnemyTagChanger() }; string contents = JsonSerializer.Serialize(Configs, EntryPoint.SerializerOptions); File.WriteAllText(path, contents); EntryPoint.DebugWarning(Name + " did not exist, creating it now"); } EnabledConfigs.Clear(); int count = Configs.Count; for (int i = 0; i < count; i++) { if (Configs[i].internalEnabled) { EnabledConfigs.Add(Configs[i].EnemyID, Configs[i]); } } } } public class GrenadeLauncherConfigSetup { public static Dictionary<uint, GrenadeLauncherConfig> EnabledConfigs = new Dictionary<uint, GrenadeLauncherConfig>(); private static List<GrenadeLauncherConfig>? Configs; public static string Name { get; } = "GrenadeLauncher.json"; public static void Load() { string path = Path.Combine(ConfigManager.CustomPath, Name); if (File.Exists(path)) { Configs = JsonSerializer.Deserialize<List<GrenadeLauncherConfig>>(File.ReadAllText(path), EntryPoint.SerializerOptions); EntryPoint.Debug(Name + " has loaded successfully"); } else { Configs = new List<GrenadeLauncherConfig> { new GrenadeLauncherConfig() }; string contents = JsonSerializer.Serialize(Configs, EntryPoint.SerializerOptions); File.WriteAllText(path, contents); EntryPoint.DebugWarning(Name + " did not exist, creating it now"); } EnabledConfigs.Clear(); int count = Configs.Count; for (int i = 0; i < count; i++) { if (Configs[i].internalEnabled) { EnabledConfigs.Add(Configs[i].PersistentID, Configs[i]); } } } } } namespace PortalPuzzleChanger.Patches { [HarmonyPatch(typeof(LG_DimensionPortal), "Setup")] public static class DimensionPortalPatch { public static void Prefix(LG_DimensionPortal __instance) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00b8: Unknown result type (might be due to invalid IL or missing references) if (!PortalPuzzleChangerSetup.EnabledConfigs.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { return; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) original = (__instance.SpawnNode.m_dimension.DimensionIndex, __instance.SpawnNode.LayerType, __instance.SpawnNode.m_zone.LocalIndex); List<PortalEntry> list = PortalPuzzleChangerSetup.EnabledConfigs[RundownManager.ActiveExpedition.LevelLayoutData]; foreach (PortalEntry item in list) { (eDimensionIndex, LG_LayerType, eLocalZoneIndex) comparingTo = (item.DimensionIndex, item.LayerType, item.ZoneIndex); if (DoesZoneMatch(original, comparingTo)) { __instance.m_targetDimension = item.TargetDimension; __instance.m_targetZone = item.TargetZoneIndex; __instance.PortalChainPuzzle = item.PortalChainedPuzzleId; EntryPoint.Debug("Changing the ChainedPuzzleID on " + __instance.PublicName); } } } public static void Postfix(LG_DimensionPortal __instance) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00d1: Unknown result type (might be due to invalid IL or missing references) if (!PortalPuzzleChangerSetup.EnabledConfigs.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { return; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) original = (__instance.SpawnNode.m_dimension.DimensionIndex, __instance.SpawnNode.LayerType, __instance.SpawnNode.m_zone.LocalIndex); List<PortalEntry> list = PortalPuzzleChangerSetup.EnabledConfigs[RundownManager.ActiveExpedition.LevelLayoutData]; foreach (PortalEntry item in list) { (eDimensionIndex, LG_LayerType, eLocalZoneIndex) comparingTo = (item.DimensionIndex, item.LayerType, item.ZoneIndex); if (DoesZoneMatch(original, comparingTo) && item.CreateTeamScanAsLast) { ChainedPuzzleInstance puzzleInstance = ChainedPuzzleManager.CreatePuzzleInstance(4u, __instance.SpawnNode.m_area, __instance.m_portalBioScanPoint.position, __instance.m_portalBioScanPoint); puzzleInstance.OnPuzzleSolved = __instance.m_portalChainPuzzleInstance.OnPuzzleSolved; __instance.m_portalChainPuzzleInstance.OnPuzzleSolved = Action.op_Implicit((Action)delegate { puzzleInstance.AttemptInteract((eChainedPuzzleInteraction)0); }); EntryPoint.Debug("Adding team scan on " + __instance.PublicName); } } } private static bool DoesZoneMatch((eDimensionIndex, LG_LayerType, eLocalZoneIndex) original, (eDimensionIndex, LG_LayerType, eLocalZoneIndex) comparingTo) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) (eDimensionIndex, LG_LayerType, eLocalZoneIndex) tuple = original; (eDimensionIndex, LG_LayerType, eLocalZoneIndex) tuple2 = comparingTo; return tuple.Item1 == tuple2.Item1 && tuple.Item2 == tuple2.Item2 && tuple.Item3 == tuple2.Item3; } } [HarmonyPatch(typeof(HackingTool), "Setup")] public static class HackingToolTest { public static void Postfix(HackingTool __instance) { } } [HarmonyPatch(typeof(EnemyAgent), "SyncPlaceNavMarkerTag")] internal static class EnemyTagPatch { public static void Postfix(EnemyAgent __instance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (EnemyTagChangerConfigSetup.EnabledConfigs.ContainsKey(__instance.EnemyDataID)) { EnemyTagChanger enemyTagChanger = EnemyTagChangerConfigSetup.EnabledConfigs[__instance.EnemyDataID]; NavMarker tagMarker = __instance.m_tagMarker; if (!string.IsNullOrEmpty(enemyTagChanger.CustomImagePath)) { SpriteRenderer component = ((Component)tagMarker.m_enemySubObj).GetComponent<SpriteRenderer>(); component.sprite = EntryPoint.CachedSprites[enemyTagChanger.CustomImagePath]; } tagMarker.SetColor(enemyTagChanger.TagColor); } } } [HarmonyPatch(typeof(GrenadeBase), "Awake")] internal static class GrenadeBase_Setup { public static void Postfix(GrenadeBase __instance) { GrenadeProjectile grenadeProjectile = ((Component)__instance).gameObject.AddComponent<GrenadeProjectile>(); ((Behaviour)grenadeProjectile).enabled = true; grenadeProjectile.GrenadeBase = __instance; } } [HarmonyPatch(typeof(GrenadeBase), "GrenadeDelay")] internal static class GrenadeBase_GrenadeDelay { public static bool Prefix() { return false; } } [HarmonyPatch(typeof(GrenadeBase), "Start")] internal static class GrenadeBase_Start { public static void Postfix(GrenadeBase __instance) { ((MonoBehaviour)__instance).CancelInvoke("GrenadeDelay"); } } [HarmonyPatch(typeof(BulletWeapon), "Fire")] internal static class BulletWeapon_Fire { public static void Prefix(BulletWeapon __instance) { if (GrenadeLauncherConfigSetup.EnabledConfigs.ContainsKey(((ItemEquippable)__instance).ArchetypeID)) { GrenadeLauncherConfig config = GrenadeLauncherConfigSetup.EnabledConfigs[((ItemEquippable)__instance).ArchetypeID]; GrenadeLauncherFire.Fire(__instance, config); } } } internal static class GrenadeLauncherFire { public static void Fire(BulletWeapon weapon, GrenadeLauncherConfig config) { //IL_0003: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) pItemData val = default(pItemData); val.itemID_gearCRC = 136u; Vector3 targetLookDir = ((Agent)((Item)weapon).Owner).TargetLookDir; Vector3 normalized = ((Vector3)(ref targetLookDir)).normalized; ItemReplicationManager.ThrowItem(val, (delItemCallback)null, (ItemMode)3, ((Component)((ItemEquippable)weapon).MuzzleAlign).transform.position, ((Component)((ItemEquippable)weapon).MuzzleAlign).transform.rotation, normalized * config.ShootForce, ((Component)weapon).transform.position, ((Agent)((Item)weapon).Owner).CourseNode, ((Item)weapon).Owner); ((Weapon)weapon).MaxRayDist = 0f; } } } namespace PortalPuzzleChanger.GameScripts { public class GrenadeProjectile : ConsumableInstance { public GrenadeBase GrenadeBase; private static FX_Pool explosionPool; private float damageRadiusHigh; private float damageRadiusLow; private float damageValueHigh; private float damageValueLow; private float explosionForce; private readonly int explosionTargetMask = LayerManager.MASK_EXPLOSION_TARGETS; private readonly int explosionBlockMask = LayerManager.MASK_EXPLOSION_BLOCKERS; private bool madeNoise = false; private bool collision = false; private bool addForce = false; private float decayTime; private Rigidbody rigidbody; private CellSoundPlayer cellSoundPlayer; public GrenadeProjectile(IntPtr hdl) : base(hdl) { } private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown rigidbody = ((Component)this).GetComponent<Rigidbody>(); cellSoundPlayer = new CellSoundPlayer(); if (!Object.op_Implicit((Object)(object)explosionPool)) { explosionPool = FX_Manager.GetEffectPool(AssetShardManager.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/FX_Effects/FX_Tripmine.prefab", false)); } } private void Start() { GrenadeLauncherConfig grenadeLauncherConfig = GrenadeLauncherConfigSetup.EnabledConfigs[((Item)GrenadeBase).Owner.Inventory.WieldedItem.ArchetypeID]; damageRadiusHigh = grenadeLauncherConfig.MaximumDamageRange.Radius; damageRadiusLow = grenadeLauncherConfig.MinimumDamageRange.Radius; damageValueHigh = grenadeLauncherConfig.MaximumDamageRange.Damage; damageValueLow = grenadeLauncherConfig.MinimumDamageRange.Damage; explosionForce = grenadeLauncherConfig.ExplosionForce; } private void FixedUpdate() { //IL_0017: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (rigidbody.useGravity) { Vector3 val = ((Component)this).transform.position + rigidbody.velocity * Time.fixedDeltaTime; } else if (!madeNoise) { MakeNoise(); ((Component)this).transform.position = Vector3.down * 100f; madeNoise = true; } } private void Update() { //IL_001d: 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) if (rigidbody.useGravity) { cellSoundPlayer.UpdatePosition(((Component)this).transform.position); if (collision) { DetonateSequence(); } } else if (Time.time > decayTime) { ((Item)GrenadeBase).ReplicationWrapper.Replicator.Despawn(); } } private void OnCollisionEnter() { if (rigidbody.useGravity) { DetonateSequence(); } } private void DetonateSequence() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Detonate(); decayTime = Time.time + 10f; rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; rigidbody.useGravity = false; } private void Detonate() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) FX_EffectBase val = (FX_EffectBase)(object)explosionPool.AquireEffect(); val.Play((FX_Trigger)null, ((Component)this).transform.position, Quaternion.LookRotation(Vector3.up)); if (SNet.IsMaster) { DamageUtil.DoExplosionDamage(((Component)this).transform.position, damageRadiusHigh, damageValueHigh, explosionTargetMask, explosionBlockMask, addForce, explosionForce); DamageUtil.DoExplosionDamage(((Component)this).transform.position, damageRadiusLow, damageValueLow, explosionTargetMask, explosionBlockMask, addForce, explosionForce); } } private void MakeNoise() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown List<string> list = new List<string>(); Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(((Component)this).transform.position, 50f, LayerManager.MASK_ENEMY_DAMAGABLE); foreach (Collider item in (Il2CppArrayBase<Collider>)(object)val) { Dam_EnemyDamageLimb component = ((Component)item).GetComponent<Dam_EnemyDamageLimb>(); if ((Object)(object)component == (Object)null) { continue; } EnemyAgent glueTargetEnemyAgent = component.GlueTargetEnemyAgent; if (!((Object)(object)glueTargetEnemyAgent == (Object)null) && !list.Contains(((Object)((Component)glueTargetEnemyAgent).gameObject).name)) { list.Add(((Object)((Component)glueTargetEnemyAgent).gameObject).name); if (!Physics.Linecast(((Component)this).transform.position, ((Agent)glueTargetEnemyAgent).EyePosition, LayerManager.MASK_WORLD)) { NM_NoiseData val2 = new NM_NoiseData { position = ((Agent)glueTargetEnemyAgent).EyePosition, node = ((Agent)glueTargetEnemyAgent).CourseNode, type = (NM_NoiseType)0, radiusMin = 0.01f, radiusMax = 100f, yScale = 1f, noiseMaker = null, raycastFirstNode = false, includeToNeightbourAreas = false }; NoiseManager.MakeNoise(val2); } } } cellSoundPlayer.Post(EVENTS.FRAGGRENADEEXPLODE, true); } public override void OnDespawn() { ((ItemWrapped)this).OnDespawn(); } } } namespace PortalPuzzleChanger.ConfigFiles { public class EnemyTagChanger { public bool internalEnabled { get; set; } public string internalName { get; set; } public uint EnemyID { get; set; } public Color TagColor { get; set; } public string CustomImagePath { get; set; } public EnemyTagChanger() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) internalEnabled = false; internalName = string.Empty; EnemyID = 0u; TagColor = Color.red; CustomImagePath = string.Empty; } } public class GrenadeLauncherConfig { public DamageMinMax MaximumDamageRange { get; set; } public DamageMinMax MinimumDamageRange { get; set; } public float ExplosionForce { get; set; } public float ShootForce { get; set; } public uint PersistentID { get; set; } public string internalName { get; set; } public bool internalEnabled { get; set; } public GrenadeLauncherConfig() { MaximumDamageRange = new DamageMinMax(); MinimumDamageRange = new DamageMinMax(); ExplosionForce = 1000f; PersistentID = 0u; internalName = string.Empty; internalEnabled = false; } } public class DamageMinMax { public float Radius { get; set; } public float Damage { get; set; } public DamageMinMax() { Radius = 0f; Damage = 0f; } } public class PortalChangerConfig { public uint MainLevelLayoutID { get; set; } public bool InternalEnabled { get; set; } public string? InternalName { get; set; } public List<PortalEntry> PortalEntries { get; set; } public PortalChangerConfig() { PortalEntries = new List<PortalEntry> { new PortalEntry() }; InternalEnabled = false; InternalName = "Test"; MainLevelLayoutID = 0u; } } public class PortalEntry { public eLocalZoneIndex ZoneIndex { get; set; } public LG_LayerType LayerType { get; set; } public eDimensionIndex DimensionIndex { get; set; } public eDimensionIndex TargetDimension { get; set; } public eLocalZoneIndex TargetZoneIndex { get; set; } public uint PortalChainedPuzzleId { get; set; } public bool CreateTeamScanAsLast { get; set; } public PortalEntry() { ZoneIndex = (eLocalZoneIndex)0; LayerType = (LG_LayerType)0; DimensionIndex = (eDimensionIndex)0; TargetDimension = (eDimensionIndex)1; TargetZoneIndex = (eLocalZoneIndex)0; PortalChainedPuzzleId = 4u; CreateTeamScanAsLast = false; } } }