Decompiled source of ExcellentObjectiveSetup v0.9.3
ExcellentObjectiveSetup.dll
Decompiled a month 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.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; 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.Text.RegularExpressions; using AIGraph; using AK; using Agents; using AmorLib.Dependencies; using AmorLib.Events; using AmorLib.Networking; using AmorLib.Networking.StateReplicators; using AmorLib.Utils; using AmorLib.Utils.Extensions; using AmorLib.Utils.JsonElementConverters; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils; using BepInEx.Unity.IL2CPP.Utils.Collections; using ChainedPuzzles; using EOS.BaseClasses; using EOS.BaseClasses.CustomTerminalDefinition; using EOS.JSON; using EOS.Modules.Expedition.Gears; using EOS.Modules.Expedition.IndividualGeneratorGroup; using EOS.Modules.Expedition.ThermalSights; using EOS.Modules.Instances; using EOS.Modules.Objectives.ActivateSmallHSU; using EOS.Modules.Objectives.GeneratorCluster; using EOS.Modules.Objectives.IndividualGenerator; using EOS.Modules.Objectives.Reactor; using EOS.Modules.Objectives.TerminalUplink; using EOS.Modules.Tweaks.BossEvents; using EOS.Modules.Tweaks.ScoutEvents; using EOS.Modules.Tweaks.SecDoorIntText; using EOS.Modules.Tweaks.TerminalPosition; using EOS.Modules.Tweaks.TerminalTweak; using EOS.Modules.World.SecuritySensor; using EOS.Utils; using Enemies; using FirstPersonItem; using GTFO.API; using GTFO.API.Extensions; using GTFO.API.Utilities; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Attributes; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Localization; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using StateMachines; using TMPro; 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("ExcellentObjectiveSetup")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ecf09fa60e4c8136b95dacdaa4aabd07c333c95d")] [assembly: AssemblyProduct("ExcellentObjectiveSetup")] [assembly: AssemblyTitle("ExcellentObjectiveSetup")] [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 EOS { [BepInPlugin("Amor.ExcellentObjectiveSetup", "ExcellentObjectiveSetup", "0.9.2")] [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.*/)] internal sealed class EntryPoint : BasePlugin { private readonly List<Type[]> _callbackAssemblyTypes = new List<Type[]> { AccessTools.GetTypesFromAssembly(Assembly.GetExecutingAssembly()) }; public override void Load() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("ExcellentObjectiveSetup").PatchAll(); InteropAPI.RegisterCall("EOS.Managers", (Func<object[], object>)delegate(object[] args) { if (args != null && args.Length != 0 && args[0] is Type[] item) { _callbackAssemblyTypes.Add(item); } return null; }); ClassInjector.RegisterTypeInIl2Cpp<OverrideReactorComp>(); ClassInjector.RegisterTypeInIl2Cpp<SensorColliderComp>(); ClassInjector.RegisterTypeInIl2Cpp<InteractGlitchComp>(); AssetAPI.OnStartupAssetsLoaded += SetupManagers; EOSLogger.Log("EOS is done loading!"); } private void SetupManagers() { IEnumerable<BaseManager> managers = _callbackAssemblyTypes.SelectMany((Type[] types) => from t in types where typeof(BaseManager).IsAssignableFrom(t) && !t.IsAbstract select (BaseManager)Activator.CreateInstance(t, nonPublic: true) into m orderby m.ChainedPuzzleLoadOrder select m); BaseManager.SetupManagers(managers); } } 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 readonly HashSet<uint> _foreverUsedIDs; private static readonly HashSet<uint> _usedIDs; private static uint _currentForeverID; private static uint _currentID; static EOSNetworking() { _foreverUsedIDs = new HashSet<uint>(); _usedIDs = new HashSet<uint>(); _currentForeverID = 1000u; _currentID = 10000u; LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } public static uint AllotReplicatorID() { while (_currentID >= 10000 && _usedIDs.Contains(_currentID)) { _currentID++; } if (_currentID < 10000) { EOSLogger.Error("Replicator IDs depleted. How?"); return 0u; } uint currentID = _currentID; _usedIDs.Add(currentID); _currentID++; return currentID; } 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 currentForeverID = _currentForeverID; _foreverUsedIDs.Add(currentForeverID); _currentForeverID++; return currentForeverID; } private static void Clear() { _usedIDs.Clear(); _currentID = 10000u; } public static void ClearForever() { _foreverUsedIDs.Clear(); _currentForeverID = 1000u; } } public static class EOSWardenEventManager { [CompilerGenerated] private sealed class <Handle>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public WardenObjectiveEventData e; public float currentDuration; private uint <eventID>5__1; private float <delay>5__2; private int <reloadCount>5__3; private string <line>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Handle>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <line>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected I4, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <eventID>5__1 = (uint)(int)e.Type; <delay>5__2 = Mathf.Max(e.Delay - currentDuration, 0f); if (<delay>5__2 > 0f) { <reloadCount>5__3 = CheckpointManager.CheckpointUsage; <>2__current = (object)new WaitForSeconds(<delay>5__2); <>1__state = 1; return true; } break; case 1: <>1__state = -1; if (<reloadCount>5__3 < CheckpointManager.CheckpointUsage) { EOSLogger.Warning($"Delayed event ID {<eventID>5__1} aborted due to checkpoint reload"); return false; } break; } if (WorldEventManager.GetCondition(e.Condition.ConditionIndex) != e.Condition.IsTrue) { return false; } WardenObjectiveManager.DisplayWardenIntel(e.Layer, e.WardenIntel); if (e.DialogueID != 0) { PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false); } if (e.SoundID != 0) { WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true); <line>5__4 = ((Object)e.SoundSubtitle).ToString(); if (!string.IsNullOrWhiteSpace(<line>5__4)) { GuiManager.PlayerLayer.ShowMultiLineSubtitle(<line>5__4); } <line>5__4 = null; } SafeInvoke.Invoke<WardenObjectiveEventData>(_eventDefinitions[<eventID>5__1], e); 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(); } } public const uint AWOEventIDsStart = 10000u; private static readonly Dictionary<uint, Action<WardenObjectiveEventData>> _eventDefinitions = new Dictionary<uint, Action<WardenObjectiveEventData>>(); private static readonly Dictionary<string, uint> _eventIDNameMap = new Dictionary<string, uint>(StringComparer.OrdinalIgnoreCase); private static readonly ImmutableHashSet<eWardenObjectiveEventType> _vanillaEventIDs = Enum.GetValues<eWardenObjectiveEventType>().ToImmutableHashSet(); public static bool IsVanillaEventID(uint eventID) { return _vanillaEventIDs.Contains((eWardenObjectiveEventType)eventID); } public static bool IsAWOEventID(uint eventID) { return eventID >= 10000; } public static bool HasEventDefinition(string eventName) { return _eventIDNameMap.ContainsKey(eventName); } public static bool HasEventDefinition(uint eventID) { return _eventDefinitions.ContainsKey(eventID); } public static bool AddEventDefinition(string eventName, uint eventID, Action<WardenObjectiveEventData> definition) { if (IsAWOEventID(eventID)) { EOSLogger.Error($"EventID {eventID} is already used by AWO"); return false; } if (IsVanillaEventID(eventID)) { EOSLogger.Warning($"EventID {eventID}: overriding vanilla event!"); } if (_eventIDNameMap.ContainsKey(eventName)) { EOSLogger.Error($"AddEventDefinition: duplicate event name '{eventName}' or id '{eventID}'"); return false; } _eventIDNameMap[eventName] = eventID; _eventDefinitions[eventID] = definition; EOSLogger.Debug($"EOSWardenEventManager: added event with name '{eventName}', id '{eventID}'"); return true; } public static void ExecuteWardenEvent(WardenObjectiveEventData events, eWardenObjectiveEventTrigger trigger = 0, bool ignoreTrigger = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(events, trigger, ignoreTrigger, 0f); } public static void ExecuteWardenEvents(List<WardenObjectiveEventData> events, eWardenObjectiveEventTrigger trigger = 0, bool ignoreTrigger = true) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(events), trigger, ignoreTrigger, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } internal static void HandleEvent(WardenObjectiveEventData e, float currentDuration) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected I4, but got Unknown uint num = (uint)(int)e.Type; if (!_eventDefinitions.ContainsKey(num)) { EOSLogger.Error($"ExecuteEvent: event ID {num} doesn't have a definition"); } else { Coroutine val = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(e, currentDuration)), (Action)null); WorldEventManager.m_worldEventEventCoroutines.Add(val); } } [IteratorStateMachine(typeof(<Handle>d__12))] private static IEnumerator Handle(WardenObjectiveEventData e, float currentDuration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Handle>d__12(0) { e = e, currentDuration = currentDuration }; } } } namespace EOS.Utils { public static class ChainedPuzzleInstanceManagerHelper { public static void Add_OnStateChange(this ChainedPuzzleInstance instance, Action<pChainedPuzzleState, pChainedPuzzleState, bool> action) { BaseManager<ChainedPuzzleInstanceManager>.Current.Add_OnStateChange(instance, action); } public static void Remove_OnStateChange(this ChainedPuzzleInstance instance, Action<pChainedPuzzleState, pChainedPuzzleState, bool> action) { BaseManager<ChainedPuzzleInstanceManager>.Current.Remove_OnStateChange(instance, action); } public static void ResetProgress(this ChainedPuzzleInstance chainedPuzzle) { //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_0027: Expected O, but got Unknown //IL_006d: 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_0076: 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_0086: 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_00a4: 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_00b0: 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_00be: 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) { val3.m_spline.SetVisible(false); CP_PlayerScanner val4 = ((Il2CppObjectBase)val3.PlayerScanner).Cast<CP_PlayerScanner>(); val4.ResetScanProgression(0f); val3.Deactivate(); } else { CP_Cluster_Core val5 = ((Il2CppObjectBase)iCore).TryCast<CP_Cluster_Core>(); if ((Object)(object)val5 == (Object)null) { EOSLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core..."); } else { val5.m_spline.SetVisible(false); foreach (iChainedPuzzleCore item2 in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val5.m_childCores) { ResetChild(item2); } val5.Deactivate(); } } } } } public static class EOSLogger { private static readonly ManualLogSource _logger = Logger.CreateLogSource("EOS"); public static void Log(string format, params object[] args) { Log(string.Format(format, args)); } public static void Log(string str) { if (_logger != null) { _logger.Log((LogLevel)8, (object)str); } } public static void Warning(string format, params object[] args) { Warning(string.Format(format, args)); } public static void Warning(string str) { if (_logger != null) { _logger.Log((LogLevel)4, (object)str); } } public static void Error(string format, params object[] args) { Error(string.Format(format, args)); } public static void Error(string str) { if (_logger != null) { _logger.Log((LogLevel)2, (object)str); } } public static void Debug(string format, params object[] args) { Debug(string.Format(format, args)); } public static void Debug(string str) { if (_logger != null) { _logger.Log((LogLevel)32, (object)str); } } } public static class EOSTerminalUtil { public static List<LG_ComputerTerminal> FindTerminals((int dim, int layer, int zone) gIndex, Predicate<LG_ComputerTerminal> predicate) { return FindTerminals((eDimensionIndex)gIndex.dim, (LG_LayerType)(byte)gIndex.layer, (eLocalZoneIndex)gIndex.zone, predicate); } public static List<LG_ComputerTerminal> FindTerminals(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_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_008d: 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) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) AIG_CourseNode val = terminal.SpawnNode; if (val == null) { val = CourseNodeUtil.GetCourseNode(terminal.m_position); } if (val == null) { EOSLogger.Error("GetCommandEvents: Cannot find a terminal spawn node"); return new List<WardenObjectiveEventData>(); } LG_ZoneSettings settings = val.m_zone.m_settings; ExpeditionZoneData val2 = ((settings != null) ? settings.m_zoneData : null); if (val2 == null) { EOSLogger.Error("GetCommandEvents: Cannot find terminal zone data"); return new List<WardenObjectiveEventData>(); } List<LG_ComputerTerminal> terminalsSpawnedInZone = val.m_zone.TerminalsSpawnedInZone; int num = terminalsSpawnedInZone.IndexOf(terminal); if (num < 0) { EOSLogger.Warning("GetCommandEvents: terminal not found in TerminalsSpawnedInZone"); return new List<WardenObjectiveEventData>(); } List<TerminalPlacementData> val3 = val2.TerminalPlacements ?? new List<TerminalPlacementData>(); List<SpecificTerminalSpawnData> val4 = val2.SpecificTerminalSpawnDatas ?? new List<SpecificTerminalSpawnData>(); List<CustomTerminalCommand> list = new List<CustomTerminalCommand>(); if ((Object)(object)terminal.ConnectedReactor != (Object)null) { if (BaseManager<ReactorShutdownObjectiveManager>.Current.TryGetDefinition(terminal.ConnectedReactor, out ReactorShutdownDefinition definition)) { list = definition.ReactorTerminal.UniqueCommands.ConvertAll((CustomCommand cmd) => cmd.ToVanillaDataType()); } else { if (!BaseManager<ReactorStartupOverrideManager>.Current.TryGetDefinition(terminal.ConnectedReactor, out ReactorStartupOverride definition2)) { return new List<WardenObjectiveEventData>(); } list = definition2.ReactorTerminal.UniqueCommands.ConvertAll((CustomCommand cmd) => cmd.ToVanillaDataType()); } } else if (num >= val3.Count && num - val3.Count < val4.Count) { list = ListExtensions.ToManaged<CustomTerminalCommand>(val4[num - val3.Count].UniqueCommands); } else { if (num >= val3.Count) { EOSLogger.Warning($"GetCommandEvents: skipped! Terminal_{terminal.PublicName}, TerminalDataIndex({num})"); return new List<WardenObjectiveEventData>(); } list = ListExtensions.ToManaged<CustomTerminalCommand>(val3[num].UniqueCommands); } foreach (CustomTerminalCommand item in list) { if (item.Command.Equals(command, StringComparison.InvariantCultureIgnoreCase)) { return ListExtensions.ToManaged<WardenObjectiveEventData>(item.CommandEvents); } } EOSLogger.Warning("GetCommandEvents: command '" + command + "' not found on " + terminal.ItemKey); return new List<WardenObjectiveEventData>(); } 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 = FindTerminals(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_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Invalid comparison between Unknown and I4 //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Expected O, but got Unknown //IL_057a: Expected O, but got Unknown if ((Object)(object)terminal == (Object)null || data == null || !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($"BuildPassword: 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<uint> hashSet = new HashSet<uint>(); 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 val; if ((int)customTerminalZoneSelectionData.SeedType == 0) { LG_Zone zone = ((GlobalBase)customTerminalZoneSelectionData).Zone; if ((Object)(object)zone == (Object)null) { EOSLogger.Error($"BuildPassword: seedType {0} specified but cannot find zone {customTerminalZoneSelectionData}"); continue; } if (zone.TerminalsSpawnedInZone.Count == 0) { EOSLogger.Error($"BuildPassword: seedType {0} specified but cannot find terminal zone {customTerminalZoneSelectionData}"); continue; } val = zone.TerminalsSpawnedInZone[customTerminalZoneSelectionData.TerminalIndex]; } else { val = SelectPasswordTerminal(((GlobalBase)customTerminalZoneSelectionData).DimensionIndex, ((GlobalBase)customTerminalZoneSelectionData).Layer, ((GlobalBase)customTerminalZoneSelectionData).LocalIndex, customTerminalZoneSelectionData.SeedType); } if ((Object)(object)val == (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 val2 = new TerminalLogFileData { FileName = $"key{value}_{LG_TerminalPasswordLinkerJob.GetTerminalNumber(terminal)}{(val.HasPasswordPart ? "_1" : "")}.LOG", FileContent = new LocalizedText { UntranslatedText = string.Format(Text.Get((num > 1) ? 1431221909u : 2260297836u), text4), Id = 0u } }; val.AddLocalLog(val2, true); if (!hashSet.Contains(val.SyncID)) { if (j > 0) { text += ", "; } string text5 = text; string publicName = val.PublicName; AIG_CourseNode spawnNode = val.SpawnNode; text = text5 + publicName + " in " + (((spawnNode != null) ? spawnNode.m_zone.AliasName : null) ?? "???"); } hashSet.Add(val.SyncID); val.HasPasswordPart = true; } string text6 = text + "."; try { if (data.ShowPasswordLength) { terminal.LockWithPassword(codeWord, new string[3] { passwordHintText, text6, "Char[" + codeWord.Length + "]" }); } else { terminal.LockWithPassword(codeWord, new string[2] { passwordHintText, text6 }); } } catch (Exception value2) { EOSLogger.Error($"Something went wrong while setting up {terminal.PublicName}'s password!\n{value2}"); } } public static void AddUniqueCommand(LG_ComputerTerminal terminal, CustomCommand cmd) { //IL_0067: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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, LocaleText.op_Implicit(cmd.CommandDesc), cmd.SpecialCommandRule, ListExtensions.ToIl2Cpp<WardenObjectiveEventData>(cmd.CommandEvents), ListExtensions.ToIl2Cpp<TerminalOutput>(cmd.PostCommandOutputs)); ChainedPuzzleDataBlock val3 = default(ChainedPuzzleDataBlock); for (int i = 0; i < cmd.CommandEvents.Count; i++) { WardenObjectiveEventData val2 = cmd.CommandEvents[i]; if (val2.ChainPuzzle == 0) { continue; } if (!DataBlockUtil.TryGetBlock<ChainedPuzzleDataBlock>(val2.ChainPuzzle, ref val3)) { continue; } LG_Area val4; Transform val5; if ((Object)(object)terminal.ConnectedReactor == (Object)null) { val4 = terminal.SpawnNode.m_area; val5 = 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; } val4 = (LG_Area)obj; LG_WardenObjective_Reactor connectedReactor2 = terminal.ConnectedReactor; val5 = ((connectedReactor2 != null) ? connectedReactor2.m_chainedPuzzleAlign : null) ?? null; } if ((Object)(object)val4 == (Object)null) { EOSLogger.Error("Terminal source area is not found! Cannot create chained puzzle for command " + cmd.Command + "!"); continue; } ChainedPuzzleInstance val6 = ChainedPuzzleManager.CreatePuzzleInstance(val3, val4, val5.position, val5, val2.UseStaticBioscanPoints); List<WardenObjectiveEventData> events = cmd.CommandEvents.GetRange(i, cmd.CommandEvents.Count - i); val6.OnPuzzleSolved += Action.op_Implicit((Action)delegate { EOSWardenEventManager.ExecuteWardenEvents(events, (eWardenObjectiveEventTrigger)0); }); terminal.SetChainPuzzleForCommand(val, i, val6); } } } public static class TSL_Wrapper { public static string ParseTextFragments(this LocaleText input) { return ((object)(LocaleText)(ref input)).ToString().ParseTextFragments(); } public static string ParseTextFragments(this string input) { return (InteropAPI.Call("TSL.ParseTextFragments", new object[1] { input }) as string) ?? input; } } public static class VanillaTMPUtil { 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("VanillaTMPUtil.Instantiate: Cannot find TMP 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 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 implicit operator Vector3(Vec3 v3) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(v3.x, v3.y, v3.z); } public static implicit operator Quaternion(Vec3 v3) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(v3.x, v3.y, v3.z); } } 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 static implicit operator Vector4(Vec4 v4) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Vector4(v4.x, v4.y, v4.z, v4.w); } } } namespace EOS.Patches { [HarmonyPatch] internal class Patch_CheckAndExecuteEventsOnTrigger { [HarmonyPatch(typeof(WardenObjectiveManager), "CheckAndExecuteEventsOnTrigger", new Type[] { typeof(WardenObjectiveEventData), typeof(eWardenObjectiveEventTrigger), typeof(bool), typeof(float) })] [HarmonyPrefix] [HarmonyPriority(500)] [HarmonyWrapSafe] 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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.HasEventDefinition(num)) { return true; } string value = (EOSWardenEventManager.IsVanillaEventID(num) ? "overriding vanilla event implementation..." : "executing..."); EOSLogger.Debug($"EOSWardenEvent: found definition for event ID {num}, {value}"); EOSWardenEventManager.HandleEvent(eventToTrigger, currentDuration); return false; } } [HarmonyPatch] internal static class Patch_EventsOnBossDeath { private static readonly HashSet<ushort> _executedForInstances; static Patch_EventsOnBossDeath() { _executedForInstances = new HashSet<ushort>(); LevelAPI.OnLevelCleanup += _executedForInstances.Clear; } [HarmonyPatch(typeof(EnemySync), "OnSpawn")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_SpawnEnemy(EnemySync __instance, pEnemySpawnData spawnData) { //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_0095: Invalid comparison between Unknown and I4 //IL_0097: 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_009e: Invalid comparison between Unknown and I4 //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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Invalid comparison between Unknown and I4 //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) AIG_CourseNode val = default(AIG_CourseNode); if (!((pCourseNode)(ref spawnData.courseNode)).TryGet(ref val) || val == null) { EOSLogger.Error("Failed to get node for a boss! Skipped EventsOnBossDeath for it"); } else { if (!BaseManager<BossDeathEventManager>.Current.TryGetDefinition(GlobalIndexUtil.ToIntTuple(val.m_zone), out EventsOnZoneBossDeath def)) { return; } EnemyAgent agent = __instance.m_agent; if (!def.BossIDs.Contains(((GameDataBlockBase<EnemyDataBlock>)(object)agent.EnemyData).persistentID)) { return; } bool flag = ((int)spawnData.mode == 4 || (int)spawnData.mode == 3) && def.ApplyToHibernate; bool flag2 = (int)spawnData.mode == 1 && def.ApplyToWave; if (!flag && !flag2) { return; } BossDeathEventManager.Mode mode = (((int)spawnData.mode != 4) ? BossDeathEventManager.Mode.WAVE : BossDeathEventManager.Mode.HIBERNATE); ushort enemyID = ((Agent)agent).GlobalID; agent.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 (!BaseManager<BossDeathEventManager>.Current.TryConsumeBDEventsExecutionTimes(def, mode)) { EOSLogger.Debug($"EventsOnBossDeath: execution times depleted for {def}, {mode}"); } else if (_executedForInstances.Contains(enemyID)) { _executedForInstances.Remove(enemyID); } else { EOSWardenEventManager.ExecuteWardenEvents(def.EventsOnBossDeath, (eWardenObjectiveEventTrigger)0); _executedForInstances.Add(enemyID); } } }); EOSLogger.Debug($"EventsOnBossDeath: added for enemy with id {((GameDataBlockBase<EnemyDataBlock>)(object)agent.EnemyData).persistentID}, mode: {spawnData.mode}"); } } } [HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")] internal static class Patch_EventsOnZoneScoutScream { private static uint ScoutWaveSettings => RundownManager.ActiveExpedition.Expedition.ScoutWaveSettings; private static uint ScoutWavePopulation => RundownManager.ActiveExpedition.Expedition.ScoutWavePopulation; [HarmonyPrefix] private static bool Pre_ES_ScoutScream_CommonUpdate(ES_ScoutScream __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if ((int)__instance.m_state != 3 || __instance.m_stateDoneTimer >= Clock.Time) { return true; } EnemyAgent enemyAgent = ((ES_Base)__instance).m_enemyAgent; AIG_CourseNode courseNode = ((Agent)enemyAgent).CourseNode; if (!BaseManager<ScoutScreamEventManager>.Current.TryGetDefinition(GlobalIndexUtil.ToIntTuple(courseNode.m_zone), out EventsOnZoneScoutScream definition)) { return true; } if (definition.EventsOnScoutScream != null && definition.EventsOnScoutScream.Count > 0) { EOSLogger.Debug($"EventsOnZoneScoutScream: found config for {definition}, executing events."); EOSWardenEventManager.ExecuteWardenEvents(definition.EventsOnScoutScream, (eWardenObjectiveEventTrigger)0); } if (SNet.IsMaster) { if (!definition.SuppressVanillaScoutWave) { if (courseNode != null && ScoutWaveSettings != 0 && ScoutWavePopulation != 0) { ushort num = default(ushort); Mastermind.Current.TriggerSurvivalWave(courseNode, ScoutWaveSettings, ScoutWavePopulation, ref num, (SurvivalWaveSpawnType)0, 0f, 2f, true, false, default(Vector3), ""); } else { EOSLogger.Error($"ES_ScoutScream, a scout is screaming but we can't spawn a wave because the the scout settings are not set for this expedition, or null node! ScoutWaveSettings: {ScoutWaveSettings} ScoutWavePopulation: {ScoutWavePopulation}"); } } ((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 EOS.Patches.Uplink { [HarmonyPatch(typeof(LG_ComputerTerminal), "Setup")] internal static class ComputerTerminalSetup { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_LG_ComputerTerminal_Setup(LG_ComputerTerminal __instance) { BaseManager<TerminalInstanceManager>.Current.Register(__instance); if (__instance.SpawnNode != null) { BaseManager<TerminalPositionOverrideManager>.Current.Setup(__instance); } } } [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalCorruptedUplinkConfirm")] internal static class CorruptedUplinkConfirm { [HarmonyPrefix] [HarmonyWrapSafe] 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; } 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); BaseManager<UplinkObjectiveManager>.Current.ChangeState(sender, new UplinkState { status = UplinkStatus.InProgress }); }); sender.m_command.AddOutput(string.Empty, true); sender.m_command.AddOutput(Text.Get(3268596368u), true); sender.m_command.AddOutput(Text.Get(2277987284u), true); receiver.m_command.AddOutput(string.Empty, 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); BaseManager<UplinkObjectiveManager>.Current.ChangeState(sender, new UplinkState { status = UplinkStatus.InProgress }); } __result = true; return false; } } [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalCorruptedUplinkConnect")] internal static class CorruptedUplinkConnect { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalCorruptedUplinkConnect(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2, ref bool __result) { //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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; if (!BaseManager<UplinkObjectiveManager>.Current.TryGetDefinition(terminal, out UplinkDefinition definition)) { return true; } 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(typeof(LG_ComputerTerminalCommandInterpreter), "StartTerminalUplinkSequence")] internal static class StartTerminalUplinkSequence { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_ComputerTerminalCommandInterpreter_StartTerminalUplinkSequence(LG_ComputerTerminalCommandInterpreter __instance, string uplinkIp, bool corrupted) { LG_ComputerTerminal terminal2 = __instance.m_terminal; LG_ComputerTerminal terminal = (corrupted ? terminal2.CorruptedUplinkReceiver : terminal2); if (terminal.m_isWardenObjective) { return true; } if (!BaseManager<UplinkObjectiveManager>.Current.TryGetDefinition(terminal, out UplinkDefinition uplinkConfig)) { return true; } if (!BaseManager<UplinkObjectiveManager>.Current.FirstRoundOutputted(terminal)) { if (!corrupted) { terminal.m_command.AddOutput((TerminalLineType)4, string.Format(Text.Get(2583360288u), uplinkIp), 3f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.TerminalUplinkSequenceOutputs(terminal, false); } else { terminal.m_command.AddOutput((TerminalLineType)4, string.Format(Text.Get(2056072887u), terminal.PublicName), 3f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput("", true); terminal2.m_command.AddOutput((TerminalLineType)4, string.Format(Text.Get(2056072887u), terminal.PublicName), 3f, (TerminalSoundType)0, (TerminalSoundType)0); terminal2.m_command.AddOutput("", true); terminal2.m_command.TerminalUplinkSequenceOutputs(terminal, false); terminal2.m_command.TerminalUplinkSequenceOutputs(terminal2, true); } } terminal2.m_command.OnEndOfQueue = Action.op_Implicit((Action)delegate { EOSLogger.Log("UPLINK CONNECTED, VERIFICATION START!"); BaseManager<UplinkObjectiveManager>.Current.ChangeState(terminal, new UplinkState { status = UplinkStatus.InProgress }); terminal.UplinkPuzzle.OnStartSequence(); EOSWardenEventManager.ExecuteWardenEvents(uplinkConfig.EventsOnCommence, (eWardenObjectiveEventTrigger)0); int num = uplinkConfig.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == 0); UplinkRound uplinkRound = ((num != -1) ? uplinkConfig.RoundOverrides[num] : null); if (uplinkRound != null) { EOSWardenEventManager.ExecuteWardenEvents(uplinkRound.EventsOnRound, (eWardenObjectiveEventTrigger)1, ignoreTrigger: false); } }); return false; } } [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalUplinkConnect")] internal static class TerminalUplinkConnect { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalUplinkConnect(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2, ref bool __result) { LG_ComputerTerminalCommandInterpreter __instance2 = __instance; string param3 = param1; LG_ComputerTerminal terminal = __instance2.m_terminal; if (terminal.m_isWardenObjective) { return true; } if (LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != 0 && LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != terminal.SyncID) { __instance2.AddOngoingUplinkOutput(); return false; } if (!BaseManager<UplinkObjectiveManager>.Current.TryGetDefinition(terminal, out UplinkDefinition definition)) { return true; } if (!definition.UseUplinkAddress) { param3 = __instance2.m_terminal.UplinkPuzzle.TerminalUplinkIP; } if (!definition.UseUplinkAddress || param3 == __instance2.m_terminal.UplinkPuzzle.TerminalUplinkIP) { __instance2.m_terminal.TrySyncSetCommandRule((TERM_Command)25, (TERM_CommandRule)1); if ((Object)(object)__instance2.m_terminal.ChainedPuzzleForWardenObjective != (Object)null) { ChainedPuzzleInstance chainedPuzzleForWardenObjective = __instance2.m_terminal.ChainedPuzzleForWardenObjective; chainedPuzzleForWardenObjective.OnPuzzleSolved += Action.op_Implicit((Action)delegate { __instance2.StartTerminalUplinkSequence(param3, false); }); __instance2.AddOutput("", true); __instance2.AddOutput(Text.Get(3268596368u), true); if (SNet.IsMaster) { __instance2.m_terminal.ChainedPuzzleForWardenObjective.AttemptInteract((eChainedPuzzleInteraction)0); } } else { __instance2.StartTerminalUplinkSequence(param3, false); } __result = true; } else { __instance2.AddUplinkWrongAddressError(param3); __result = false; } return false; } } [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalUplinkSequenceOutputs")] internal static class TerminalUplinkSequenceOutput { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalUplinkSequenceOutputs(LG_ComputerTerminal terminal, bool corrupted) { if (terminal.m_isWardenObjective) { return true; } UplinkDefinition definition; bool flag = BaseManager<UplinkObjectiveManager>.Current.TryGetDefinition(terminal, out definition); bool flag2 = (Object)(object)terminal.CorruptedUplinkReceiver != (Object)null && BaseManager<UplinkObjectiveManager>.Current.TryGetDefinition(terminal.CorruptedUplinkReceiver, out definition); if ((!flag && !flag2) || definition == null) { return true; } if (!BaseManager<UplinkObjectiveManager>.Current.FirstRoundOutputted(terminal)) { terminal.m_command.AddOutput((TerminalLineType)3, Text.Get(3418104670u), 3f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput("", true); if (definition.DisplayUplinkWarning) { terminal.m_command.AddOutput((TerminalLineType)5, "WARNING! Breach detected!", 0.8f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput((TerminalLineType)5, "WARNING! Breach detected!", 0.8f, (TerminalSoundType)0, (TerminalSoundType)0); terminal.m_command.AddOutput((TerminalLineType)5, "WARNING! Breach detected!", 0.8f, (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); } BaseManager<UplinkObjectiveManager>.Current.ChangeState(terminal, new UplinkState(), clientCanSend: true); } return false; } } [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalUplinkVerify")] internal static class TerminalUplinkVerify { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_ComputerTerminalCommandInterpreter_TerminalUplinkVerify(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2, ref bool __result) { LG_ComputerTerminalCommandInterpreter __instance2 = __instance; if (__instance2.m_terminal.m_isWardenObjective) { return true; } if (!BaseManager<UplinkObjectiveManager>.Current.TryGetDefinition(__instance2.m_terminal, out UplinkDefinition uplinkConfig)) { return true; } TerminalUplinkPuzzle uplinkPuzzle = __instance2.m_terminal.UplinkPuzzle; int roundIndex2 = uplinkPuzzle.m_roundIndex; UplinkRound roundOverride = GetRoundOverride(roundIndex2); TimeSettings timeSettings = ((roundOverride != null) ? roundOverride.OverrideTimeSettings : uplinkConfig.DefaultTimeSettings); float num = ((timeSettings.TimeToStartVerify >= 0f) ? timeSettings.TimeToStartVerify : uplinkConfig.DefaultTimeSettings.TimeToStartVerify); float timeToCompleteVerify = ((timeSettings.TimeToCompleteVerify >= 0f) ? timeSettings.TimeToCompleteVerify : uplinkConfig.DefaultTimeSettings.TimeToCompleteVerify); float num2 = ((timeSettings.TimeToRestoreFromFail >= 0f) ? timeSettings.TimeToRestoreFromFail : uplinkConfig.DefaultTimeSettings.TimeToRestoreFromFail); if (!uplinkPuzzle.Connected) { __instance2.AddOutput("", true); __instance2.AddOutput(Text.Get(403360908u), true); __result = false; return false; } __instance2.AddOutput((TerminalLineType)3, Text.Get(2734004688u), num, (TerminalSoundType)0, (TerminalSoundType)0); if (!uplinkPuzzle.Solved && uplinkPuzzle.CurrentRound.CorrectCode.Equals(param1, StringComparison.InvariantCultureIgnoreCase)) { __instance2.AddOutput(string.Format(Text.Get(1221800228u), uplinkPuzzle.CurrentProgress), true); if (uplinkPuzzle.TryGoToNextRound()) { int roundIndex3 = uplinkPuzzle.m_roundIndex; UplinkRound newRoundOverride2 = GetRoundOverride(roundIndex3); if (roundOverride != null) { EOSWardenEventManager.ExecuteWardenEvents(roundOverride.EventsOnRound, (eWardenObjectiveEventTrigger)2, ignoreTrigger: false); } if (roundOverride != null && (Object)(object)roundOverride.ChainedPuzzleToEndRoundInstance != (Object)null) { TextDataBlock val = default(TextDataBlock); if (DataBlockUtil.TryGetBlock<TextDataBlock>("InGame.UplinkTerminal.ScanRequiredToProgress", ref val)) { __instance2.AddOutput((TerminalLineType)4, Text.Get(((GameDataBlockBase<TextDataBlock>)(object)val).persistentID), 0f, (TerminalSoundType)0, (TerminalSoundType)0); } ChainedPuzzleInstance chainedPuzzleToEndRoundInstance = roundOverride.ChainedPuzzleToEndRoundInstance; chainedPuzzleToEndRoundInstance.OnPuzzleSolved += Action.op_Implicit((Action)delegate { __instance2.AddOutput((TerminalLineType)4, Text.Get(27959760u), timeToCompleteVerify, (TerminalSoundType)0, (TerminalSoundType)0); __instance2.AddOutput("", true); __instance2.AddOutput(string.Format(Text.Get(4269617288u), uplinkPuzzle.CurrentProgress, uplinkPuzzle.CurrentRound.CorrectPrefix), true); __instance2.OnEndOfQueue = Action.op_Implicit(CreateNextRoundOnEndAction(newRoundOverride2)); }); if (SNet.IsMaster) { roundOverride.ChainedPuzzleToEndRoundInstance.AttemptInteract((eChainedPuzzleInteraction)0); } } else { __instance2.AddOutput((TerminalLineType)4, Text.Get(27959760u), timeToCompleteVerify, (TerminalSoundType)0, (TerminalSoundType)0); __instance2.AddOutput("", true); __instance2.AddOutput(string.Format(Text.Get(4269617288u), uplinkPuzzle.CurrentProgress, uplinkPuzzle.CurrentRound.CorrectPrefix), true); __instance2.OnEndOfQueue = Action.op_Implicit(CreateNextRoundOnEndAction(newRoundOverride2)); } } else { __instance2.AddOutput((TerminalLineType)3, Text.Get(1780488547u), 3f, (TerminalSoundType)0, (TerminalSoundType)0); __instance2.AddOutput("", true); __instance2.OnEndOfQueue = Action.op_Implicit((Action)delegate { if (roundOverride != null) { EOSWardenEventManager.ExecuteWardenEvents(roundOverride.EventsOnRound, (eWardenObjectiveEventTrigger)2, ignoreTrigger: false); } uplinkPuzzle.CurrentRound.ShowGui = false; if (roundOverride != null && (Object)(object)roundOverride.ChainedPuzzleToEndRoundInstance != (Object)null) { ChainedPuzzleInstance chainedPuzzleToEndRoundInstance2 = roundOverride.ChainedPuzzleToEndRoundInstance; chainedPuzzleToEndRoundInstance2.OnPuzzleSolved += Action.op_Implicit((Action)delegate { __instance2.AddOutput((TerminalLineType)0, string.Format(Text.Get(3928683780u), uplinkPuzzle.TerminalUplinkIP), 2f, (TerminalSoundType)0, (TerminalSoundType)0); __instance2.AddOutput("", true); __instance2.OnEndOfQueue = Action.op_Implicit(FinalUplinkVerification()); }); if (SNet.IsMaster) { roundOverride.ChainedPuzzleToEndRoundInstance.AttemptInteract((eChainedPuzzleInteraction)0); } } else { __instance2.AddOutput((TerminalLineType)0, string.Format(Text.Get(3928683780u), uplinkPuzzle.TerminalUplinkIP), 2f, (TerminalSoundType)0, (TerminalSoundType)0); __instance2.AddOutput("", true); FinalUplinkVerification()(); } }); } } else if (uplinkPuzzle.Solved) { __instance2.AddOutput("", true); __instance2.AddOutput((TerminalLineType)1, Text.Get(4080876165u), 0f, (TerminalSoundType)0, (TerminalSoundType)0); __instance2.AddOutput((TerminalLineType)0, Text.Get(4104839742u), 6f, (TerminalSoundType)0, (TerminalSoundType)0); } else { __instance2.AddOutput("", true); __instance2.AddOutput((TerminalLineType)1, string.Format(Text.Get(507647514u), uplinkPuzzle.CurrentRound.CorrectPrefix), 0f, (TerminalSoundType)0, (TerminalSoundType)0); __instance2.AddOutput((TerminalLineType)0, Text.Get(4104839742u), num2, (TerminalSoundType)0, (TerminalSoundType)0); } __result = false; return false; Action CreateNextRoundOnEndAction(UplinkRound? newRoundOverride) { UplinkRound newRoundOverride3 = newRoundOverride; return delegate { EOSLogger.Log("UPLINK VERIFICATION, GO TO NEXT ROUND!"); uplinkPuzzle.CurrentRound.ShowGui = true; if (newRoundOverride3 != null) { EOSWardenEventManager.ExecuteWardenEvents(newRoundOverride3.EventsOnRound, (eWardenObjectiveEventTrigger)1, ignoreTrigger: false); } BaseManager<UplinkObjectiveManager>.Current.ChangeState(__instance2.m_terminal, new UplinkState { status = UplinkStatus.InProgress, currentRoundIndex = uplinkPuzzle.m_roundIndex }); }; } Action FinalUplinkVerification() { return delegate { EOSLogger.Log("UPLINK VERIFICATION SEQUENCE DONE!"); LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId = 0u; uplinkPuzzle.CurrentRound.ShowGui = false; uplinkPuzzle.Solved = true; Action onPuzzleSolved = uplinkPuzzle.OnPuzzleSolved; if (onPuzzleSolved != null) { onPuzzleSolved.Invoke(); } BaseManager<UplinkObjectiveManager>.Current.ChangeState(__instance2.m_terminal, new UplinkState { status = UplinkStatus.Finished, currentRoundIndex = uplinkPuzzle.m_roundIndex }); }; } UplinkRound? GetRoundOverride(int roundIndex) { int num3 = uplinkConfig.RoundOverrides.FindIndex((UplinkRound o) => o.RoundIndex == roundIndex); return (num3 != -1) ? uplinkConfig.RoundOverrides[num3] : null; } } } [HarmonyPatch(typeof(LG_ComputerTerminal), "Update")] internal static class UplinkGUI_Update { [HarmonyPostfix] private static void Post_LG_ComputerTerminal_Update(LG_ComputerTerminal __instance) { if (!__instance.m_isWardenObjective && __instance.UplinkPuzzle != null) { __instance.UplinkPuzzle.UpdateGUI(false); } } } } namespace EOS.Patches.SecurityDoor { [HarmonyPatch(typeof(LG_SecurityDoor_Locks), "OnDoorState")] internal static class Patch_SecDoorLocks_OnDoorState { [HarmonyPostfix] [HarmonyPriority(400)] [HarmonyWrapSafe] private static void Patch_OnDoorState(LG_SecurityDoor_Locks __instance, pDoorState state) { //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_0008: Invalid comparison between Unknown and I4 //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_0011: Invalid comparison between Unknown and I4 if ((int)state.status == 5 || (int)state.status == 4) { BaseManager<SecDoorIntTextOverrideManager>.Current.ReplaceText(__instance); } } } [HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })] internal static class Patch_SecDoorLocks_Setup { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_Customize_SecDoor_Interaction_Text(LG_SecurityDoor_Locks __instance) { if (!BaseManager<SecDoorIntTextOverrideManager>.Current.TryGetDefinition(__instance, out SecDoorIntTextDefinition def) || def.GlitchMode == GlitchMode.None) { return; } InteractGlitchComp comp = ((Component)__instance).gameObject.AddComponent<InteractGlitchComp>(); comp.Init(def); __instance.m_intCustomMessage.OnInteractionSelected += Action<PlayerAgent, bool>.op_Implicit((Action<PlayerAgent, bool>)delegate(PlayerAgent agent, bool selected) { if (((Agent)agent).IsLocallyOwned) { comp.CanInteract = false; ((Behaviour)comp).enabled = selected; } }); __instance.m_intOpenDoor.OnInteractionSelected += Action<PlayerAgent, bool>.op_Implicit((Action<PlayerAgent, bool>)delegate(PlayerAgent agent, bool selected) { if (((Agent)agent).IsLocallyOwned) { comp.CanInteract = true; ((Behaviour)comp).enabled = selected; } }); } } } namespace EOS.Patches.Reactor { [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReactorVerify")] internal static class CommandInterpreter_ReactorVerify { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_ComputerTerminalCommandInterpreter_ReactorVerify(LG_ComputerTerminalCommandInterpreter __instance, string param1) { LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor; if ((Object)(object)connectedReactor == (Object)null) { EOSLogger.Error("ReactorVerify: connected reactor is null - bug detected"); return true; } if (connectedReactor.m_isWardenObjective) { return true; } if (connectedReactor.ReadyForVerification && param1 == connectedReactor.CurrentStateOverrideCode) { __instance.m_terminal.ChangeState((TERM_State)7); } else { __instance.AddOutput("", true); __instance.AddOutput((TerminalLineType)3, Text.Get(2195342028u), 4f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); } return false; } } [HarmonyPatch] internal static class CommandInterpreter_ReceiveCommand { [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")] [HarmonyPrefix] [HarmonyPriority(300)] [HarmonyWrapSafe] private static bool Pre_ReceiveCommand(LG_ComputerTerminalCommandInterpreter __instance, TERM_Command cmd, string inputLine, string param1, string param2) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor; if ((Object)(object)connectedReactor == (Object)null) { return true; } if ((int)cmd == 23 && !connectedReactor.m_isWardenObjective) { return Handle_ReactorShutdown(__instance, connectedReactor); } if ((int)cmd == 42) { return Handle_ReactorStartup_SpecialCommand(__instance, cmd, connectedReactor); } return true; } private static bool Handle_ReactorShutdown(LG_ComputerTerminalCommandInterpreter __instance, LG_WardenObjective_Reactor reactor) { if (!BaseManager<ReactorShutdownObjectiveManager>.Current.TryGetDefinition(reactor, out ReactorShutdownDefinition definition)) { EOSLogger.Error("ReactorVerify: found built custom reactor shutdown but its definition is missing, what happened?"); return true; } __instance.AddOutput((TerminalLineType)3, Text.Get(3436726297u), 4f, (TerminalSoundType)0, (TerminalSoundType)0); if ((Object)(object)definition.ChainedPuzzleToActiveInstance != (Object)null) { __instance.AddOutput(Text.Get(2277987284u), true); if (SNet.IsMaster) { definition.ChainedPuzzleToActiveInstance.AttemptInteract((eChainedPuzzleInteraction)0); } } else { reactor.AttemptInteract((eReactorInteraction)6, 0f); } return false; } private static bool Handle_ReactorStartup_SpecialCommand(LG_ComputerTerminalCommandInterpreter __instance, TERM_Command cmd, LG_WardenObjective_Reactor reactor) { //IL_0007: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_terminal.CommandIsHidden(cmd)) { return true; } OverrideReactorComp overrideReactorComp = default(OverrideReactorComp); if (!GameObjectPlusExtensions.TryAndGetComponent<OverrideReactorComp>(((Component)reactor).gameObject, ref overrideReactorComp)) { return true; } if (!reactor.ReadyForVerification) { __instance.AddOutput("", true); __instance.AddOutput((TerminalLineType)3, LocaleText.op_Implicit(ReactorStartupOverrideManager.NotReadyForVerificationOutputText), 4f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); return false; } if (overrideReactorComp.IsCorrectTerminal(__instance.m_terminal)) { EOSLogger.Log("Reactor Verify Correct!"); if (SNet.IsMaster) { reactor.AttemptInteract((eReactorInteraction)((reactor.m_currentWaveCount == reactor.m_waveCountMax) ? 5 : 3), 0f); } else { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(reactor.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)3, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } __instance.AddOutput(LocaleText.op_Implicit(ReactorStartupOverrideManager.CorrectTerminalOutputText), true); } else { EOSLogger.Log("Reactor Verify Incorrect!"); __instance.AddOutput("", true); __instance.AddOutput((TerminalLineType)3, LocaleText.op_Implicit(ReactorStartupOverrideManager.IncorrectTerminalOutputText), 4f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput("", true); } return false; } } [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "OnReactorShutdownVerifyChaosDone")] internal static class Reactor_OnReactorShutdownVerifyChaosDone { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_ComputerTerminalCommandInterpreter_OnReactorShutdownVerifyChaosDone(LG_ComputerTerminalCommandInterpreter __instance) { LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor; if ((Object)(object)connectedReactor == (Object)null || connectedReactor.m_isWardenObjective) { return true; } if (!BaseManager<ReactorShutdownObjectiveManager>.Current.TryGetDefinition(connectedReactor, out ReactorShutdownDefinition definition)) { EOSLogger.Error("OnReactorShutdownVerifyChaosDone: found built custom reactor shutdown but its definition is missing, what happened?"); return false; } connectedReactor.AttemptInteract((eReactorInteraction)(((Object)(object)definition.ChainedPuzzleOnVerificationInstance != (Object)null) ? 8 : 9), 0f); return false; } } [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnTerminalStartupSequenceVerify")] internal static class OnTerminalStartupSequenceVerify { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_ExecuteEventsOnEndOnClientSide(LG_WardenObjective_Reactor __instance) { if (!SNet.IsMaster) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)3, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } } [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")] internal static class Reactor_OnBuildDone { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_LG_WardenObjective_Reactor_OnBuildDone(LG_WardenObjective_Reactor __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 BaseManager<ReactorInstanceManager>.Current.Register(__instance); ReactorShutdownDefinition definition2; if (__instance.m_isWardenObjective) { if (!BaseManager<ReactorStartupOverrideManager>.Current.TryGetDefinition(__instance, out ReactorStartupOverride definition)) { return; } WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock); if (!WardenObjectiveManager.TryGetWardenObjectiveDataForLayer(__instance.SpawnNode.LayerType, __instance.WardenObjectiveChainIndex, ref val) || val == null) { EOSLogger.Error("Failed to get WardenObjectiveData for this reactor"); return; } if ((int)val.Type != 1) { EOSLogger.Error($"Reactor Instance {definition} is not setup as vanilla ReactorStartup, cannot override"); return; } definition.ObjectiveDB = val; ReactorStartupOverrideManager.Build(__instance, definition); } else if (BaseManager<ReactorShutdownObjectiveManager>.Current.TryGetDefinition(__instance, out definition2)) { ReactorShutdownObjectiveManager.Build(__instance, definition2); } else { EOSLogger.Error("EOS Reactor: something went wrong!"); } BaseManager<TerminalInstanceManager>.Current.Register(__instance.m_terminal); } } [HarmonyPatch] internal class Reactor_OnStateChange { [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_WardenObjective_Reactor_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState, bool isDropinState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0045: 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_0069: 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_005d: 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_0035: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if ((int)GameStateManager.CurrentStateName != 10) { return true; } if (__instance.m_isWardenObjective) { if (BaseManager<ReactorInstanceManager>.Current.IsStartupReactor(__instance)) { Startup_OnStateChange(__instance, oldState, newState, isDropinState); } return true; } if (oldState.stateCount != newState.stateCount) { __instance.OnStateCountUpdate(newState.stateCount); } if (oldState.stateProgress != newState.stateProgress) { __instance.OnStateProgressUpdate(newState.stateProgress); } if (oldState.status == newState.status) { return false; } __instance.ReadyForVerification = false; if (BaseManager<ReactorInstanceManager>.Current.IsShutdownReactor(__instance)) { if (!BaseManager<ReactorShutdownObjectiveManager>.Current.TryGetDefinition(__instance, out ReactorShutdownDefinition definition)) { EOSLogger.Error("Reactor_OnStateChange: found built custom reactor but its definition is missing, what happened?"); return false; } Shutdown_OnStateChange(__instance, oldState, newState, isDropinState, definition); __instance.m_currentState = newState; return false; } EOSLogger.Error("Reactor_OnStateChange: found built custom reactor but it's not a shutdown reactor, what happened?"); return false; } private static void Startup_OnStateChange(LG_WardenObjective_Reactor reactor, pReactorState oldState, pReactorState newState, bool isDropinState) { //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) if (!isDropinState && BaseManager<ReactorStartupOverrideManager>.Current.TryGetDefinition(reactor, out ReactorStartupOverride definition) && (int)oldState.status == 0 && (Object)(object)reactor.m_chainedPuzzleToStartSequence != (Object)null) { EOSWardenEventManager.ExecuteWardenEvents(definition.EventsOnActive, (eWardenObjectiveEventTrigger)0); } } private static void Shutdown_OnStateChange(LG_WardenObjective_Reactor reactor, pReactorState oldState, pReactorState newState, bool isDropinState, ReactorShutdownDefinition def) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown eReactorStatus status = newState.status; eReactorStatus val = status; switch (val - 6) { case 0: GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", Text.Get(1080u), false, 200f, 8f, (Action)null); reactor.m_progressUpdateEnabled = true; reactor.m_currentDuration = 15f; reactor.m_lightCollection.SetMode(false); reactor.m_sound.Stop(); EOSWardenEventManager.ExecuteWardenEvents(def.EventsOnActive, (eWardenObjectiveEventTrigger)0); break; case 1: GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", Text.Get(1081u), false, 200f, 8f, (Action)null); reactor.m_progressUpdateEnabled = false; reactor.ReadyForVerification = true; break; case 2: reactor.m_progressUpdateEnabled = false; if ((Object)(object)def.ChainedPuzzleOnVerificationInstance != (Object)null) { GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", Text.Get(1082u), false, 200f, 8f, (Action)null); def.ChainedPuzzleOnVerificationInstance.AttemptInteract((eChainedPuzzleInteraction)0); } EOSWardenEventManager.ExecuteWardenEvents(def.EventsOnShutdownPuzzleStarts, (eWardenObjectiveEventTrigger)0); break; case 3: reactor.m_progressUpdateEnabled = false; reactor.m_objectiveCompleteTimer = Clock.Time + 5f; EOSWardenEventManager.ExecuteWardenEvents(def.EventsOnComplete, (eWardenObjectiveEventTrigger)0); break; } } } [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateCountUpdate")] internal static class Reactor_OnStateCountUpdate { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_WardenObjective_Reactor_OnStateCountUpdate(LG_WardenObjective_Reactor __instance, int count) { //IL_00aa: 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_00bd: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown if (__instance.m_isWardenObjective || BaseManager<ReactorInstanceManager>.Current.IsStartupReactor(__instance)) { return true; } if (!BaseManager<ReactorInstanceManager>.Current.IsShutdownReactor(__instance)) { EOSLogger.Error("Reactor_OnStateCountUpdate: found built custom reactor but it's neither a startup nor shutdown reactor, what happen?"); return true; } if (!BaseManager<ReactorShutdownObjectiveManager>.Current.TryGetDefinition(__instance, out ReactorShutdownDefinition definition)) { EOSLogger.Error("Reactor_OnStateCountUpdate: found built custom reactor but its definition is missing, what happened?"); return true; } __instance.m_currentWaveCount = count; LG_ComputerTerminal val = null; if (definition.PutVerificationCodeOnTerminal) { val = BaseManager<TerminalInstanceManager>.Current.GetInstance(((GlobalBase)definition.VerificationCodeTerminal).IntTuple, definition.VerificationCodeTerminal.InstanceIndex); } __instance.m_currentWaveData = new ReactorWaveData { HasVerificationTerminal = ((Object)(object)val != (Object)null), VerificationTerminalSerial = (((val != null) ? val.ItemKey : null) ?? string.Empty), Warmup = 1f, WarmupFail = 1f, Wave = 1f, Verify = 1f, VerifyFail = 1f }; if (__instance.m_overrideCodes != null && !string.IsNullOrEmpty(((Il2CppArrayBase<string>)(object)__instance.m_overrideCodes)[0])) { __instance.CurrentStateOverrideCode = ((Il2CppArrayBase<string>)(object)__instance.m_overrideCodes)[0]; } else { EOSLogger.Error("Reactor_OnStateCountUpdate: code is not built?"); } return false; } } [HarmonyPatch] internal static class Reactor_Update { private static LocaleText _shutdownVerification_GUIText = LocaleText.Empty; private static bool _checked = false; [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")] [HarmonyPrefix] private static bool Pre_LG_WardenObjective_Reactor_Update(LG_WardenObjective_Reactor __instance) { //IL_000a: 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: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_007a: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_isWardenObjective || (int)__instance.m_currentState.status != 7) { return true; } if (!_checked) { LocaleText shutdownVerification_GUIText = default(LocaleText); shutdownVerification_GUIText.ID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.ExtraObjectiveSetup_ReactorShutdown.SecurityVerificationRequired"); shutdownVerification_GUIText.RawText = "SECURITY VERIFICATION REQUIRED. USE COMMAND <color=orange>REACTOR_VERIFY</color> AND FIND CODE ON <color=orange>{0}</color>."; _shutdownVerification_GUIText = shutdownVerification_GUIText; _checked = true; } string text = ((!__instance.m_currentWaveData.HasVerificationTerminal) ? string.Format(Text.Get(1107u), "<color=orange>" + __instance.CurrentStateOverrideCode + "</color>") : string.Format(LocaleText.op_Implicit(_shutdownVerification_GUIText), __instance.m_currentWaveData.VerificationTerminalSerial)); __instance.SetGUIMessage(true, text, (ePUIMessageStyle)3, false, "", ""); return false; } } } namespace EOS.Patches.PowerGenerator { [HarmonyPatch(typeof(LG_PowerGeneratorCluster), "Setup")] internal static class Patch_LG_PowerGeneratorCluster { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_PowerGeneratorCluster_Setup(LG_PowerGeneratorCluster __instance) { BaseManager<GeneratorClusterInstanceManager>.Current.Register(__instance); if (!BaseManager<GeneratorClusterObjectiveManager>.Current.TryGetDefinition(__instance, out GeneratorClusterDefinition definition)) { 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; BaseManager<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) { BaseManager<GeneratorClusterObjectiveManager>.Current.RegisterForChainedPuzzleBuild(__instance, definition); } } } [HarmonyPatch] internal static class Patch_LG_PowerGenerator_Core_Setup { [HarmonyPatch(typeof(LG_PowerGenerator_Core), "Setup")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_PowerGenerator_Setup(LG_PowerGenerator_Core __instance) { LG_PowerGenerator_Core __instance2 = __instance; iCarryItemInteractionTarget powerCellInteraction = __instance2.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 val = default(Item); if (PlayerBackpackManager.TryGetItemInLevelFromItemData(item.Get_pItemData(), ref val)) { ItemInLevel val2 = ((Il2CppObjectBase)val).Cast<ItemInLevel>(); val2.CanWarp = false; } else { EOSLogger.Error($"Inserting something other than PowerCell ({item.PublicName}) into {__instance2.m_itemKey}, how?"); } }); if (!BaseManager<PowerGeneratorInstanceManager>.Current.IsGCGenerator(__instance2)) { BaseManager<PowerGeneratorInstanceManager>.Current.Register(__instance2); BaseManager<IndividualGeneratorObjectiveManager>.Current.Setup(__instance2); } } } [HarmonyPatch(typeof(LG_PowerGenerator_Core), "SyncStatusChanged")] internal static class Patch_LG_PowerGenerator_Core_SyncStatusChanged { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_SyncStatusChanged(LG_PowerGenerator_Core __instance, pPowerGeneratorState state, bool isDropinState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0018: 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_0067: 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_0093: Invalid comparison between Unknown and I4 //IL_02a0: 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_00c5: Invalid comparison between Unknown and I4 //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName != 10) { return; } ePowerGeneratorStatus status = state.status; LG_PowerGeneratorCluster parentGeneratorCluster = BaseManager<PowerGeneratorInstanceManager>.Current.GetParentGeneratorCluster(__instance); if ((Object)(object)parentGeneratorCluster != (Object)null && BaseManager<GeneratorClusterObjectiveManager>.Current.TryGetDefinition(parentGeneratorCluster, out GeneratorClusterDefinition definition)) { 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 = definition.EventsOnInsertCell; int num2 = (int)(num - 1); if (!isDropinState) { if (num2 >= 0 && num2 < eventsOnInsertCell.Count) { EOSLogger.Debug($"Executing events ({num} / {((Il2CppArrayBase<LG_PowerGenerator_Core>)(object)parentGeneratorCluster.m_generators).Count}). Event count: {eventsOnInsertCell[num2].Count}"); EOSWardenEventManager.ExecuteWardenEvents(eventsOnInsertCell[num2], (eWardenObjectiveEventTrigger)0); } 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; } } if (BaseManager<IndividualGeneratorObjectiveManager>.Current.TryGetDefinition(__instance, out IndividualGeneratorDefinition definition2) && definition2.EventsOnInsertCell != null && (int)status == 0 && !isDropinState) { EOSWardenEventManager.ExecuteWardenEvents(definition2.EventsOnInsertCell, (eWardenObjectiveEventTrigger)0); } ExpeditionIGGroup expeditionIGGroup = BaseManager<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) { EOSWardenEventManager.ExecuteWardenEvents(expeditionIGGroup.EventsOnInsertCell[num4], (eWardenObjectiveEventTrigger)0); } } } } namespace EOS.Patches.HSUActivator { [HarmonyPatch(typeof(LG_HSUActivator_Core), "SetupFromCustomGeomorph")] internal static class SetupFromCustomGeomorph { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_LG_HSUActivator_Core_SetupFromCustomGeomorph(LG_HSUActivator_Core __instance) { LG_HSUActivator_Core __instance2 = __instance; BaseManager<HSUActivatorInstanceManager>.Current.Register(__instance2); if (!BaseManager<HSUActivatorObjectiveManager>.Current.TryGetDefinition(__instance2, out HSUActivatorDefinition definition)) { return; } if (__instance2.m_isWardenObjective) { EOSLogger.Error("BuildCustomHSUActivator: the HSUActivator has been set up by vanilla! Aborting custom setup..."); EOSLogger.Error($"HSUActivator in {GlobalIndexUtil.ToIntTuple(__instance2.SpawnNode.m_zone)}"); return; } __instance2.m_linkedItemGoingIn = __instance2.SpawnPickupItemOnAlign(definition.ItemFromStart, __instance2.m_itemGoingInAlign, false, -1); __instance2.m_linkedItemComingOut = __instance2.SpawnPickupItemOnAlign(definition.ItemAfterActivation, __instance2.m_itemComingOutAlign, false, -1); LG_LevelInteractionManager.DeregisterTerminalItem(((Component)__instance2.m_linkedItemGoingIn).GetComponentInChildren<iTerminalItem>()); LG_LevelInteractionManager.DeregisterTerminalItem(((Component)__instance2.m_linkedItemComingOut).GetComponentInChildren<iTerminalItem>()); __instance2.m_linkedItemGoingIn.SetPickupInteractionEnabled(false); __instance2.m_linkedItemComingOut.SetPickupInteractionEnabled(false); __instance2.m_insertHSUInteraction.OnInteractionSelected = Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)delegate { }); __instance2.m_sequencerInsertItem.OnSequenceDone = Action.op_Implicit((Action)delegate { //IL_000c: 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_0012: 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) pHSUActivatorState state2 = __instance2.m_stateReplicator.State; if (!state2.isSequenceIncomplete) { EOSLogger.Log(">>>>>> HSUInsertSequenceDone! Sequence was already complete"); } state2.isSequenceIncomplete = false; __instance2.m_stateReplicator.SetStateUnsynced(state2); EOSLogger.Log(">>>>>> HSUInsertSequenceDone!"); if (__instance2.m_triggerExtractSequenceRoutine != null) { ((MonoBehaviour)__instance2).StopCoroutine(__instance2.m_triggerExtractSequenceRoutine); } }); __instance2.m_sequencerExtractItem.OnSequenceDone = Action.op_Implicit((Action)delegate { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) SNet_StateReplicator<pHSUActivatorState, pHSUActivatorInteraction> stateReplicator = __instance2.m_stateReplicator; pHSUActivatorState state = __instance2.m_stateReplicator.State; state.isSequenceIncomplete = true; stateReplicator.SetStateUnsynced(state); if (SNet.IsMaster) { __instance2.AttemptInteract(new pHSUActivatorInteraction { type = (eHSUActivatorInteractionType)2 }); } }); EOSLogger.Debug($"HSUActivator: {definition}, custom setup complete"); } } [HarmonyPatch(typeof(LG_HSUActivator_Core), "SyncStatusChanged")] internal static class SyncStatusChanged { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_LG_HSUActivator_Core_SyncStatusChanged(LG_HSUActivator_Core __instance, pHSUActivatorState newState, bool isRecall) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0089: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid I