using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using AIGraph;
using AK;
using Agents;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using ChainedPuzzles;
using EOSExt.Reactor.Managers;
using Enemies;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.ExtendedWardenEvents;
using ExtraObjectiveSetup.Instances;
using GTFO.API;
using GTFO.API.JSON.Converters;
using GTFO.API.Utilities;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LEGACY.ExtraEvents;
using LEGACY.LegacyOverride;
using LEGACY.LegacyOverride.DimensionPortal;
using LEGACY.LegacyOverride.ElevatorCargo;
using LEGACY.LegacyOverride.EnemyTagger;
using LEGACY.LegacyOverride.ExtraExpeditionSettings;
using LEGACY.LegacyOverride.FogBeacon;
using LEGACY.LegacyOverride.SecDoorIntText;
using LEGACY.Utils;
using LevelGeneration;
using Localization;
using MTFO.API;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using ScanPosOverride.Managers;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PrequelCore")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PrequelCore")]
[assembly: AssemblyTitle("PrequelCore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")]
internal static class Patch_WatermarkUpdateWatermark
{
private static void Postfix(PUI_Watermark __instance)
{
string text = "4.6.1+gitf831086-dirty-main".Remove("x.x.x".Length);
((TMP_Text)__instance.m_watermarkText).SetText("<color=red>MODDED</color> <color=orange>" + text + "</color>\n<color=#FF6781></color>", true);
}
}
namespace LEGACY
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas07.PREQUELCore", "PREQUELCore", "2.0.3")]
[BepInIncompatibility("Inas.LEGACY")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas07";
public const string RUNDOWN_NAME = "PREQUELCore";
public const string VERSION = "2.0.3";
private Harmony m_Harmony;
public override void Load()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
m_Harmony = new Harmony("LEGACY");
m_Harmony.PatchAll();
LegacyOverrideManagers.Init();
LegacyExtraEvents.Init();
}
}
}
namespace LEGACY.Reactor
{
[HarmonyPatch]
internal class Patch_ReactorShutdown
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")]
private static void Post_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected I4, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null || oldState.status == newState.status)
{
return;
}
WardenObjectiveDataBlock val = null;
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null)
{
LegacyLogger.Error("Patch_ReactorShutdown: ");
LegacyLogger.Error("Failed to get warden objective");
}
else if ((int)val.Type == 2 && !val.OnActivateOnSolveItem)
{
eWardenObjectiveEventTrigger val2 = (eWardenObjectiveEventTrigger)0;
eReactorStatus status = newState.status;
switch (status - 7)
{
default:
return;
case 0:
val2 = (eWardenObjectiveEventTrigger)1;
break;
case 1:
val2 = (eWardenObjectiveEventTrigger)2;
break;
case 2:
val2 = (eWardenObjectiveEventTrigger)3;
break;
}
_ = __instance.SpawnNode.LayerType;
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val.EventsOnActivate, val2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")]
private static void Pre_OnBuildDone_ChainedPuzzleMidObjectiveFix(LG_WardenObjective_Reactor __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
WardenObjectiveDataBlock val = null;
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null)
{
LegacyLogger.Error("Patch_ReactorShutdown: Failed to get warden objective");
}
else if (val.ChainedPuzzleMidObjective != 0)
{
__instance.m_chainedPuzzleAlignMidObjective = __instance.m_chainedPuzzleAlign;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")]
private static bool Pre_Update(LG_WardenObjective_Reactor __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
if ((int)__instance.m_currentState.status != 7)
{
return true;
}
if (!__instance.m_currentWaveData.HasVerificationTerminal)
{
return true;
}
__instance.SetGUIMessage(true, Text.Format(3000u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=orange>" + __instance.m_currentWaveData.VerificationTerminalSerial + "</color>") }), (ePUIMessageStyle)3, false, "", "");
return false;
}
}
[HarmonyPatch]
internal class Patch_ReactorStartup_ExtraEventsExecution
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnTerminalStartupSequenceVerify")]
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);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")]
private static void Post_ExecuteOnNoneEventsOnDefenseStart(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
if (oldState.status != newState.status && (int)newState.status == 3)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)0, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")]
private static void Post_OnBuildDone(LG_WardenObjective_Reactor __instance)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Invalid comparison between Unknown and I4
WardenObjectiveDataBlock db = default(WardenObjectiveDataBlock);
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref db) || db == null)
{
LegacyLogger.Error("Patch_ReactorStartup_ExtraEventsExecution: ");
LegacyLogger.Error("Failed to get warden objective");
}
else if ((int)db.Type == 1 && !db.OnActivateOnSolveItem)
{
ChainedPuzzleInstance chainedPuzzleToStartSequence = __instance.m_chainedPuzzleToStartSequence;
chainedPuzzleToStartSequence.OnPuzzleSolved += Action.op_Implicit((Action)delegate
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(db.EventsOnActivate, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
});
}
}
}
}
namespace LEGACY.VanillaFix
{
[HarmonyPatch]
internal class Patch_FixHiddenCommandExecution
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")]
private static void Pre_TerminalInterpreter_ReceiveCommand(LG_ComputerTerminalCommandInterpreter __instance, ref TERM_Command cmd)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected I4, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Invalid comparison between Unknown and I4
TERM_Command val = cmd;
switch (val - 1)
{
default:
if ((int)val != 43)
{
break;
}
goto case 0;
case 0:
case 1:
case 2:
case 3:
case 11:
case 13:
case 14:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
if (__instance.m_terminal.CommandIsHidden(cmd))
{
cmd = (TERM_Command)10;
}
break;
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 12:
case 15:
case 16:
break;
}
}
}
[HarmonyPatch]
internal class Patch_FixScoutFreeze
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")]
private static bool Prefix_Debug(ES_ScoutScream __instance)
{
if (((AgentAI)((ES_Base)__instance).m_ai).Target == null)
{
return false;
}
return true;
}
}
[HarmonyPatch]
internal class Patch_LG_SecurityDoor_Fix_EventsOnUnlockDoor_Powergenerator
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")]
private static void Pre_OnSyncDoorStatusChange(LG_SecurityDoor __instance, pDoorState state, bool isRecall)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Invalid comparison between Unknown and I4
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
eDoorStatus status = state.status;
if ((status - 4 <= 1 || (int)status == 9) && (int)__instance.m_lastState.status == 6)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.LinkedToZoneData.EventsOnUnlockDoor, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
}
}
[HarmonyPatch]
internal class Patch_LockSecurityDoor_FixCustomText
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })]
private static void Post_LG_SecurityDoor_Locks_Setup(LG_SecurityDoor door, LG_SecurityDoor_Locks __instance)
{
LocalizedText customText = door.LinkedToZoneData.ProgressionPuzzleToEnter.CustomText;
__instance.m_lockedWithNoKeyInteractionText = customText;
}
}
[HarmonyPatch]
[HarmonyWrapSafe]
internal class Patch_RepeatableCommandEventFix
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "SetupCommandEvents")]
private static void Post_ResetupChainedPuzzleAfterExecution(LG_ComputerTerminalCommandInterpreter __instance)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected I4, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Invalid comparison between Unknown and I4
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Invalid comparison between Unknown and I4
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Invalid comparison between Unknown and I4
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Invalid comparison between Unknown and I4
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Invalid comparison between Unknown and I4
uint num = 0u;
if ((Object)(object)__instance.m_terminal.ConnectedReactor != (Object)null)
{
return;
}
if (__instance.m_terminal.SpawnNode.m_dimension.IsMainDimension)
{
LG_LayerType layerType = __instance.m_terminal.SpawnNode.LayerType;
switch ((int)layerType)
{
case 0:
num = RundownManager.ActiveExpedition.LevelLayoutData;
break;
case 1:
num = RundownManager.ActiveExpedition.SecondaryLayout;
break;
case 2:
num = RundownManager.ActiveExpedition.ThirdLayout;
break;
default:
LegacyLogger.Error("Unimplemented layer type.");
return;
}
}
else
{
num = __instance.m_terminal.SpawnNode.m_dimension.DimensionData.LevelLayoutData;
}
LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock(num);
List<CustomTerminalCommand> val = null;
int num2 = __instance.m_terminal.SpawnNode.m_zone.TerminalsSpawnedInZone.IndexOf(__instance.m_terminal);
ExpeditionZoneData val2 = null;
Enumerator<ExpeditionZoneData> enumerator = block.Zones.GetEnumerator();
while (enumerator.MoveNext())
{
ExpeditionZoneData current = enumerator.Current;
if (current.LocalIndex == __instance.m_terminal.SpawnNode.m_zone.LocalIndex)
{
val2 = current;
break;
}
}
if (val2 == null)
{
LegacyLogger.Error("Cannot find target zone data.");
return;
}
if (num2 >= val2.TerminalPlacements.Count)
{
LegacyLogger.Debug("RepeatableCommand: TerminalDataIndex >= TargetZoneData.TerminalPlacements.Count: found sec-door terminal, skipping");
return;
}
val = val2.TerminalPlacements[num2].UniqueCommands;
if (val.Count == 0)
{
return;
}
Enumerator<CustomTerminalCommand> enumerator2 = val.GetEnumerator();
TERM_Command val3 = default(TERM_Command);
string text = default(string);
string text2 = default(string);
while (enumerator2.MoveNext())
{
CustomTerminalCommand current2 = enumerator2.Current;
if ((int)current2.SpecialCommandRule != 0 || !__instance.TryGetCommand(current2.Command, ref val3, ref text, ref text2) || ((int)val3 != 38 && (int)val3 != 39 && (int)val3 != 40 && (int)val3 != 41 && (int)val3 != 42))
{
continue;
}
ChainedPuzzleInstance OldCPInstance = null;
List<WardenObjectiveEventData> commandEvents = current2.CommandEvents;
for (int i = 0; i < commandEvents.Count && (commandEvents[i].ChainPuzzle == 0 || !__instance.m_terminal.TryGetChainPuzzleForCommand(val3, i, ref OldCPInstance) || !((Object)(object)OldCPInstance != (Object)null)); i++)
{
}
if (!((Object)(object)OldCPInstance == (Object)null))
{
ChainedPuzzleInstance obj = OldCPInstance;
obj.OnPuzzleSolved += Action.op_Implicit((Action)delegate
{
Helper.ResetChainedPuzzle(OldCPInstance);
});
}
}
}
}
}
namespace LEGACY.Utils
{
public static class Helper
{
private static void ResetChild(iChainedPuzzleCore ICore)
{
CP_Bioscan_Core val = ((Il2CppObjectBase)ICore).TryCast<CP_Bioscan_Core>();
if ((Object)(object)val != (Object)null)
{
((Il2CppObjectBase)val.m_spline).Cast<CP_Holopath_Spline>().SetSplineProgress(0f);
((Il2CppObjectBase)val.PlayerScanner).Cast<CP_PlayerScanner>().ResetScanProgression(0f);
return;
}
CP_Cluster_Core val2 = ((Il2CppObjectBase)ICore).TryCast<CP_Cluster_Core>();
if ((Object)(object)val2 == (Object)null)
{
LegacyLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core...");
return;
}
((Il2CppObjectBase)val2.m_spline).Cast<CP_Holopath_Spline>().SetSplineProgress(0f);
foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val2.m_childCores)
{
ResetChild(item);
}
}
public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance)
{
foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)chainedPuzzleInstance.m_chainedPuzzleCores)
{
ResetChild(item);
}
if (SNet.IsMaster)
{
chainedPuzzleInstance.AttemptInteract((eChainedPuzzleInteraction)2);
}
}
public static LG_WardenObjective_Reactor FindReactor(LG_LayerType layer)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
LG_WardenObjective_Reactor val = null;
Enumerator<LayerChainIndex, iWardenObjectiveItem> enumerator = WardenObjectiveManager.Current.m_wardenObjectiveItem.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair<LayerChainIndex, iWardenObjectiveItem> current = enumerator.Current;
if (current.Key.Layer == layer)
{
val = ((Il2CppObjectBase)current.Value).TryCast<LG_WardenObjective_Reactor>();
if (!((Object)(object)val == (Object)null))
{
break;
}
}
}
return val;
}
public static bool TryGetComponent<T>(this GameObject obj, out T comp)
{
comp = obj.GetComponent<T>();
return comp != null;
}
public static bool IsPlayerInLevel(PlayerAgent player)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Invalid comparison between Unknown and I4
return (int)player.Owner.Load<pGameState>().gameState == 10;
}
public static ChainedPuzzleInstance GetChainedPuzzleForCommandOnTerminal(LG_ComputerTerminal terminal, string command)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected I4, but got Unknown
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Invalid comparison between Unknown and I4
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Invalid comparison between Unknown and I4
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Invalid comparison between Unknown and I4
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Invalid comparison between Unknown and I4
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Invalid comparison between Unknown and I4
uint num = 0u;
if (terminal.SpawnNode.m_dimension.IsMainDimension)
{
LG_LayerType layerType = terminal.SpawnNode.LayerType;
switch ((int)layerType)
{
case 0:
num = RundownManager.ActiveExpedition.LevelLayoutData;
break;
case 1:
num = RundownManager.ActiveExpedition.SecondaryLayout;
break;
case 2:
num = RundownManager.ActiveExpedition.ThirdLayout;
break;
default:
LegacyLogger.Error("Unimplemented layer type.");
return null;
}
}
else
{
num = terminal.SpawnNode.m_dimension.DimensionData.LevelLayoutData;
}
LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock(num);
List<CustomTerminalCommand> val = null;
List<LG_ComputerTerminal> terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone;
int num2 = terminalsSpawnedInZone.IndexOf(terminal);
ExpeditionZoneData val2 = null;
Enumerator<ExpeditionZoneData> enumerator = block.Zones.GetEnumerator();
while (enumerator.MoveNext())
{
ExpeditionZoneData current = enumerator.Current;
if (current.LocalIndex == terminal.SpawnNode.m_zone.LocalIndex)
{
val2 = current;
break;
}
}
if (val2 == null)
{
LegacyLogger.Error("Cannot find target zone data.");
return null;
}
if (val2.TerminalPlacements.Count != terminalsSpawnedInZone.Count)
{
LegacyLogger.Error("The numbers of terminal placement and spawn, skipped for the zone terminal.");
return null;
}
val = val2.TerminalPlacements[num2].UniqueCommands;
if (val.Count == 0)
{
return null;
}
List<WardenObjectiveEventData> val3 = null;
TERM_Command val4 = (TERM_Command)0;
Enumerator<CustomTerminalCommand> enumerator2 = val.GetEnumerator();
string text = default(string);
string text2 = default(string);
while (enumerator2.MoveNext())
{
CustomTerminalCommand current2 = enumerator2.Current;
if (current2.Command == command)
{
val3 = current2.CommandEvents;
if (!terminal.m_command.TryGetCommand(current2.Command, ref val4, ref text, ref text2))
{
LegacyLogger.Error("Cannot get TERM_COMMAND for command {0} on the specified terminal.");
}
break;
}
}
if (val3 == null || (int)val4 == 0)
{
return null;
}
if ((int)val4 != 38 && (int)val4 != 39 && (int)val4 != 40 && (int)val4 != 41 && (int)val4 != 42)
{
return null;
}
ChainedPuzzleInstance val5 = null;
for (int i = 0; i < val3.Count && (val3[i].ChainPuzzle == 0 || !terminal.TryGetChainPuzzleForCommand(val4, i, ref val5) || !((Object)(object)val5 != (Object)null)); i++)
{
}
return val5;
}
public static bool TryGetZoneEntranceSecDoor(LG_Zone zone, out LG_SecurityDoor door)
{
if ((Object)(object)zone == (Object)null)
{
door = null;
return false;
}
if ((Object)(object)zone.m_sourceGate == (Object)null)
{
door = null;
return false;
}
if (zone.m_sourceGate.SpawnedDoor == null)
{
door = null;
return false;
}
door = ((Il2CppObjectBase)zone.m_sourceGate.SpawnedDoor).TryCast<LG_SecurityDoor>();
return (Object)(object)door != (Object)null;
}
internal static bool isSecDoorToZoneOpened(LG_Zone zone14)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
LG_SecurityDoor door = null;
if (!TryGetZoneEntranceSecDoor(zone14, out door) || (Object)(object)door == (Object)null)
{
return false;
}
return (int)door.m_sync.GetCurrentSyncState().status == 10;
}
public static List<T> cast<T>(List<T> list)
{
List<T> list2 = new List<T>();
Enumerator<T> enumerator = list.GetEnumerator();
while (enumerator.MoveNext())
{
T current = enumerator.Current;
list2.Add(current);
}
return list2;
}
private static eDimensionIndex GetCurrentDimensionIndex()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (PlayerManager.PlayerAgentsInLevel.Count <= 0)
{
throw new Exception("? You don't have any player agent in level? How could that happen?");
}
return ((Agent)PlayerManager.PlayerAgentsInLevel[0]).DimensionIndex;
}
public static void GetMinLayerAndLocalIndex(out LG_LayerType MinLayer, out eLocalZoneIndex MinLocalIndex)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between I4 and Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between I4 and Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected I4, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected I4, but got Unknown
MinLayer = (LG_LayerType)2;
MinLocalIndex = (eLocalZoneIndex)20;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (IsPlayerInLevel(current))
{
if ((int)MinLayer > (int)current.m_courseNode.LayerType)
{
MinLayer = (LG_LayerType)(int)current.m_courseNode.LayerType;
MinLocalIndex = (eLocalZoneIndex)20;
}
if ((int)MinLocalIndex >= (int)current.m_courseNode.m_zone.LocalIndex)
{
MinLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex;
}
}
}
}
public static void GetMaxLayerAndLocalIndex(out LG_LayerType MaxLayer, out eLocalZoneIndex MaxLocalIndex)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between I4 and Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between I4 and Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected I4, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected I4, but got Unknown
MaxLayer = (LG_LayerType)0;
MaxLocalIndex = (eLocalZoneIndex)0;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (IsPlayerInLevel(current))
{
if ((int)MaxLayer < (int)current.m_courseNode.LayerType)
{
MaxLayer = (LG_LayerType)(int)current.m_courseNode.LayerType;
MaxLocalIndex = (eLocalZoneIndex)0;
}
if ((int)MaxLocalIndex < (int)current.m_courseNode.m_zone.LocalIndex)
{
MaxLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex;
}
}
}
}
public static int GetMinAreaIndex(LG_Zone zone)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)zone == (Object)null)
{
return -1;
}
LG_LayerType type = zone.m_layer.m_type;
eLocalZoneIndex localIndex = zone.LocalIndex;
GetCurrentDimensionIndex();
int num = zone.m_areas.Count;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (current.m_courseNode.LayerType != type || current.m_courseNode.m_zone.LocalIndex != localIndex)
{
continue;
}
int i = 0;
for (List<LG_Area> areas = zone.m_areas; i < areas.Count; i++)
{
if (((Object)((Component)areas[i]).gameObject).GetInstanceID() == ((Object)((Component)current.m_courseNode.m_area).gameObject).GetInstanceID())
{
if (num > i)
{
num = i;
}
break;
}
}
}
return num;
}
public static LG_ComputerTerminal FindTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, int terminalIndex)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = null;
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val) || (Object)(object)val == (Object)null)
{
LegacyLogger.Error($"FindTerminal: Didn't find LG_Zone {dimensionIndex}, {layerType}, {localIndex}");
return null;
}
if (val.TerminalsSpawnedInZone == null || terminalIndex >= val.TerminalsSpawnedInZone.Count)
{
LegacyLogger.Error($"FindTerminal: Invalid terminal index {terminalIndex} - {((val.TerminalsSpawnedInZone != null) ? val.TerminalsSpawnedInZone.Count : 0)} terminals are spawned in {dimensionIndex}, {layerType}, {localIndex}");
return null;
}
if (terminalIndex >= 0)
{
return val.TerminalsSpawnedInZone[terminalIndex];
}
return null;
}
}
internal static class Json
{
private static readonly JsonSerializerOptions _setting;
static Json()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
_setting = new JsonSerializerOptions
{
ReadCommentHandling = JsonCommentHandling.Skip,
IncludeFields = false,
PropertyNameCaseInsensitive = true,
WriteIndented = true,
IgnoreReadOnlyProperties = true
};
_setting.Converters.Add(new JsonStringEnumConverter());
_setting.Converters.Add((JsonConverter)new LocalizedTextConverter());
}
public static T Deserialize<T>(string json)
{
return JsonSerializer.Deserialize<T>(json, _setting);
}
public static object Deserialize(Type type, string json)
{
return JsonSerializer.Deserialize(json, type, _setting);
}
public static string Serialize<T>(T value)
{
return JsonSerializer.Serialize(value, _setting);
}
public static void Load<T>(string filePath, out T config) where T : new()
{
config = Deserialize<T>(File.ReadAllText(filePath));
}
}
public class Vec3
{
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
public Vector3 ToVector3()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(x, y, z);
}
public Quaternion ToQuaternion()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
return Quaternion.Euler(x, y, z);
}
}
internal static class LegacyLogger
{
private static ManualLogSource logger = Logger.CreateLogSource("LEGACYCore");
public static void Log(string format, params object[] args)
{
Log(string.Format(format, args));
}
public static void Log(string str)
{
if (logger != null)
{
logger.Log((LogLevel)8, (object)str);
}
}
public static void Warning(string format, params object[] args)
{
Warning(string.Format(format, args));
}
public static void Warning(string str)
{
if (logger != null)
{
logger.Log((LogLevel)4, (object)str);
}
}
public static void Error(string format, params object[] args)
{
Error(string.Format(format, args));
}
public static void Error(string str)
{
if (logger != null)
{
logger.Log((LogLevel)2, (object)str);
}
}
public static void Debug(string format, params object[] args)
{
Debug(string.Format(format, args));
}
public static void Debug(string str)
{
if (logger != null)
{
logger.Log((LogLevel)32, (object)str);
}
}
}
public class SpawnHibernateEnemiesEvent
{
public eWardenObjectiveEventTrigger Trigger { get; set; }
public int Type { get; set; } = 170;
public eDimensionIndex DimensionIndex { get; set; }
public LG_LayerType Layer { get; set; }
public eLocalZoneIndex LocalIndex { get; set; }
public string WorldEventObjectFilter { get; set; } = "RANDOM";
public uint EnemyID { get; set; }
public int Count { get; set; } = 1;
public float Delay { get; set; }
public float Duration { get; set; } = 2f;
}
public class WeightedAreaSelector
{
private static readonly Dictionary<LG_Zone, WeightedAreaSelector> dict;
private WeightedRandomBag<LG_Area> weightedRandomBag;
public static WeightedAreaSelector Get(LG_Zone zone)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected I4, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
if (!dict.ContainsKey(zone))
{
WeightedAreaSelector weightedAreaSelector = new WeightedAreaSelector();
Enumerator<LG_Area> enumerator = zone.m_areas.GetEnumerator();
while (enumerator.MoveNext())
{
LG_Area current = enumerator.Current;
float num = 0f;
LG_AreaSize size = current.m_size;
switch (size - 1)
{
case 4:
num = 7f;
break;
case 0:
num = 20f;
break;
case 1:
num = 30f;
break;
case 2:
num = 35f;
break;
case 3:
num = 45f;
break;
default:
LegacyLogger.Error($"Unhandled LG_AreaSize: {current.m_size}. Won't build.");
return null;
}
weightedAreaSelector.AddEntry(current, num);
}
dict.Add(zone, weightedAreaSelector);
}
return dict[zone];
}
public static WeightedAreaSelector Get(eDimensionIndex eDimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(eDimensionIndex, layerType, localIndex, ref val) || !Object.op_Implicit((Object)(object)val))
{
return null;
}
return Get(val);
}
private WeightedAreaSelector()
{
weightedRandomBag = new WeightedRandomBag<LG_Area>();
}
private void AddEntry(LG_Area area, float weight)
{
weightedRandomBag.AddEntry(area, weight);
}
public LG_Area GetRandom()
{
return weightedRandomBag.GetRandom();
}
private static void OnBuildDone()
{
}
private static void Clear()
{
dict.Clear();
}
static WeightedAreaSelector()
{
dict = new Dictionary<LG_Zone, WeightedAreaSelector>();
LevelAPI.OnLevelCleanup += dict.Clear;
}
}
public class WeightedRandomBag<T>
{
private struct Entry
{
public double accumulatedWeight;
public T item;
}
private List<Entry> entries = new List<Entry>();
private double accumulatedWeight;
private Random rand = new Random();
public void AddEntry(T item, double weight)
{
if (weight <= 0.0)
{
LegacyLogger.Error("AddEntry: no non-positive weight pls.");
return;
}
accumulatedWeight += weight;
entries.Add(new Entry
{
item = item,
accumulatedWeight = accumulatedWeight
});
}
public T GetRandom()
{
double num = rand.NextDouble() * accumulatedWeight;
foreach (Entry entry in entries)
{
if (entry.accumulatedWeight >= num)
{
return entry.item;
}
}
return default(T);
}
}
}
namespace LEGACY.LegacyOverride
{
internal static class LegacyOverrideManagers
{
internal static readonly string LEGACY_CONFIG_PATH = Path.Combine(MTFOPathAPI.CustomPath, "LegacyOverride");
internal static void Init()
{
ElevatorCargoOverrideManager.Current.Init();
FogBeaconSettingManager.Current.Init();
EnemyTaggerSettingManager.Current.Init();
SecDoorIntTextOverrideManager.Current.Init();
ExpeditionSettingsManager.Current.Init();
}
}
}
namespace LEGACY.LegacyOverride.SecDoorIntText
{
public class DoorToZone
{
public eDimensionIndex DimensionIndex { get; set; }
public LG_LayerType LayerType { get; set; }
public eLocalZoneIndex LocalIndex { get; set; }
public LocalizedText Prefix { get; set; }
public LocalizedText Postfix { get; set; }
public LocalizedText TextToReplace { get; set; }
}
public class LevelSecDoorIntTextOverride
{
public uint MainLevelLayout { get; set; }
public List<DoorToZone> doorToZones { get; set; } = new List<DoorToZone>
{
new DoorToZone()
};
}
internal class SecDoorIntTextOverrideManager
{
public static readonly SecDoorIntTextOverrideManager Current;
private Dictionary<uint, LevelSecDoorIntTextOverride> SecDoorIntTextOverrides = new Dictionary<uint, LevelSecDoorIntTextOverride>();
private LiveEditListener liveEditListener;
private static readonly string CONFIG_PATH;
internal LevelSecDoorIntTextOverride SettingForCurrentLevel { get; private set; }
private void AddOverride(LevelSecDoorIntTextOverride _override)
{
if (_override != null)
{
if (SecDoorIntTextOverrides.ContainsKey(_override.MainLevelLayout))
{
LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout);
SecDoorIntTextOverrides[_override.MainLevelLayout] = _override;
}
else
{
SecDoorIntTextOverrides.Add(_override.MainLevelLayout, _override);
}
}
}
public void Init()
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
if (!Directory.Exists(CONFIG_PATH))
{
Directory.CreateDirectory(CONFIG_PATH);
StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json"));
streamWriter.WriteLine(Json.Serialize(new LevelSecDoorIntTextOverride()));
streamWriter.Flush();
streamWriter.Close();
return;
}
foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories))
{
Json.Load<LevelSecDoorIntTextOverride>(item, out var config);
AddOverride(config);
}
LevelAPI.OnBuildStart += UpdateSetting;
liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true);
liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged);
}
private void FileChanged(LiveEditEventArgs e)
{
LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath);
LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content)
{
LevelSecDoorIntTextOverride @override = Json.Deserialize<LevelSecDoorIntTextOverride>(content);
AddOverride(@override);
if (GameStateManager.IsInExpedition)
{
UpdateSetting();
}
});
}
private void UpdateSetting()
{
uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData;
SettingForCurrentLevel = (SecDoorIntTextOverrides.ContainsKey(levelLayoutData) ? SecDoorIntTextOverrides[levelLayoutData] : null);
}
private SecDoorIntTextOverrideManager()
{
}
static SecDoorIntTextOverrideManager()
{
CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "SecDoorIntText");
Current = new SecDoorIntTextOverrideManager();
}
}
}
namespace LEGACY.LegacyOverride.Patches
{
[HarmonyPatch]
internal class DimensionPortal
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_DimensionPortal), "Setup")]
private static void Pre_DimensionPortal_Setup(LG_DimensionPortal __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0041: Unknown result type (might be due to invalid IL or missing references)
eDimensionIndex dimensionIndex = __instance.SpawnNode.m_dimension.DimensionIndex;
LG_LayerType layerType = __instance.SpawnNode.LayerType;
eLocalZoneIndex localIndex = __instance.SpawnNode.m_zone.LocalIndex;
uint num = ((InstanceManager<LG_DimensionPortal>)DimensionPortalInstanceManager.Current).Register(__instance);
PortalCustomization definition = ((InstanceDefinitionManager<PortalCustomization>)DimensionPortalDefinitionManager.Current).GetDefinition(dimensionIndex, layerType, localIndex, num);
if (definition != null)
{
LegacyLogger.Debug($"DimensionPortal: found custom setup, {((GlobalZoneIndex)definition).GlobalZoneIndexTuple()}");
__instance.PortalChainPuzzle = definition.ChainedPuzzleOnPortalActive;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_DimensionPortal), "Setup")]
private static void Post_DimensionPortal_Setup(LG_DimensionPortal __instance)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
eDimensionIndex dimensionIndex = __instance.SpawnNode.m_dimension.DimensionIndex;
LG_LayerType layerType = __instance.SpawnNode.LayerType;
eLocalZoneIndex localIndex = __instance.SpawnNode.m_zone.LocalIndex;
uint zoneInstanceIndex = ((InstanceManager<LG_DimensionPortal>)DimensionPortalInstanceManager.Current).GetZoneInstanceIndex(__instance);
PortalCustomization def = ((InstanceDefinitionManager<PortalCustomization>)DimensionPortalDefinitionManager.Current).GetDefinition(dimensionIndex, layerType, localIndex, zoneInstanceIndex);
if (def == null)
{
return;
}
__instance.OnPortalKeyInsertSequenceDone += Action<LG_DimensionPortal>.op_Implicit((Action<LG_DimensionPortal>)delegate
{
def.EventsOnScanDone.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
});
ChainedPuzzleInstance portalChainPuzzleInstance = __instance.m_portalChainPuzzleInstance;
portalChainPuzzleInstance.OnPuzzleSolved += Action.op_Implicit((Action)delegate
{
def.EventsOnScanDone.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
});
}
}
[HarmonyPatch]
internal class Patch_Customize_SecDoor_Interaction_Text
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_SecurityDoor_Locks), "OnDoorState")]
private static void Post_Customize_SecDoor_Interaction_Text(pDoorState state, LG_SecurityDoor_Locks __instance)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Invalid comparison between Unknown and I4
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
LevelSecDoorIntTextOverride settingForCurrentLevel = SecDoorIntTextOverrideManager.Current.SettingForCurrentLevel;
if (settingForCurrentLevel == null || ((int)state.status != 9 && (int)state.status != 5))
{
return;
}
int num = settingForCurrentLevel.doorToZones.FindIndex((DoorToZone door) => door.DimensionIndex == __instance.m_door.Gate.DimensionIndex && door.LayerType == __instance.m_door.LinksToLayerType && door.LocalIndex == __instance.m_door.LinkedToZoneData.LocalIndex);
if (num != -1)
{
DoorToZone doorToZone = settingForCurrentLevel.doorToZones[num];
_ = __instance.m_door;
Interact_Timed intOpenDoor = __instance.m_intOpenDoor;
string text = LocalizedText.op_Implicit(doorToZone.Prefix);
string text2 = LocalizedText.op_Implicit(doorToZone.Postfix);
string text3 = LocalizedText.op_Implicit(doorToZone.TextToReplace);
if (string.IsNullOrEmpty(text))
{
text = string.Empty;
}
if (string.IsNullOrEmpty(text2))
{
text2 = string.Empty;
}
if (string.IsNullOrEmpty(text3))
{
text3 = intOpenDoor.InteractionMessage;
}
intOpenDoor.InteractionMessage = text + "\n" + text3 + "\n" + text2;
LegacyLogger.Debug($"SecDoorIntTextOverride: Override IntText. {doorToZone.LocalIndex}, {doorToZone.LayerType}, {doorToZone.DimensionIndex}");
}
}
}
[HarmonyPatch]
internal class Patch_ElevatorCargoOverride
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ElevatorCargoCage), "SpawnObjectiveItemsInLandingArea")]
private static bool Pre_ElevatorCargoOverride(ElevatorCargoCage __instance)
{
LevelElevatorCargo levelElevatorCargoItems = ElevatorCargoOverrideManager.Current.GetLevelElevatorCargoItems(RundownManager.ActiveExpedition.LevelLayoutData);
if (levelElevatorCargoItems == null)
{
return true;
}
if (levelElevatorCargoItems.ForceDisable)
{
ElevatorRide.Current.m_cargoCageInUse = false;
return false;
}
return true;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ElevatorCargoCage), "SpawnObjectiveItemsInLandingArea")]
private static void Post_ElevatorCargoOverride(ElevatorCargoCage __instance)
{
LevelElevatorCargo levelElevatorCargoItems = ElevatorCargoOverrideManager.Current.GetLevelElevatorCargoItems(RundownManager.ActiveExpedition.LevelLayoutData);
if (levelElevatorCargoItems == null || levelElevatorCargoItems.ElevatorCargoItems.Count < 1 || levelElevatorCargoItems.ForceDisable)
{
return;
}
foreach (ElevatorCargoItem elevatorCargoItem in levelElevatorCargoItems.ElevatorCargoItems)
{
LG_PickupItem val = LG_PickupItem.SpawnGenericPickupItem(ElevatorShaftLanding.CargoAlign);
val.SpawnNode = Builder.GetElevatorArea().m_courseNode;
switch (elevatorCargoItem.ItemType)
{
case ItemType.Consumable:
val.SetupAsConsumable(Random.Range(0, int.MaxValue), elevatorCargoItem.ItemID);
break;
case ItemType.BigPickup:
val.SetupAsBigPickupItem(Random.Range(0, int.MaxValue), elevatorCargoItem.ItemID, false, 0);
break;
default:
LegacyLogger.Error($"Undefined Item Type {elevatorCargoItem.ItemType}");
continue;
}
__instance.m_itemsToMoveToCargo.Add(((Component)val).transform);
ElevatorRide.Current.m_cargoCageInUse = true;
}
}
}
[HarmonyPatch]
internal class Patch_SetupBigPickupItemWithItemId
{
private static void SetupAsObserver(LG_PickupItem __instance)
{
EnemyTaggerSetting setting = EnemyTaggerSettingManager.Current.SettingForCurrentLevel;
CarryItemPickup_Core componentInChildren = ((Component)__instance.m_root).GetComponentInChildren<CarryItemPickup_Core>();
Interact_Pickup_PickupItem interact = ((Il2CppObjectBase)componentInChildren.m_interact).Cast<Interact_Pickup_PickupItem>();
LG_PickupItem_Sync obj = ((Il2CppObjectBase)componentInChildren.m_sync).Cast<LG_PickupItem_Sync>();
EnemyTaggerComponent tagger = ((Component)componentInChildren).gameObject.AddComponent<EnemyTaggerComponent>();
tagger.Parent = componentInChildren;
((Component)tagger).gameObject.SetActive(true);
((Interact_Timed)interact).InteractDuration = setting.TimeToPickup;
tagger.MaxTagPerScan = setting.MaxTagPerScan;
tagger.TagInterval = setting.TagInterval;
tagger.TagRadius = setting.TagRadius;
tagger.WarmupTime = setting.WarmupTime;
obj.OnSyncStateChange += Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>.op_Implicit((Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>)delegate(ePickupItemStatus status, pPickupPlacement placement, PlayerAgent playerAgent, bool isRecall)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Invalid comparison between Unknown and I4
if ((int)status != 0)
{
if ((int)status == 1)
{
((Component)tagger).gameObject.SetActive(true);
tagger.PickedByPlayer = playerAgent;
tagger.ChangeState((!setting.TagWhenHold) ? eEnemyTaggerState.Inactive : eEnemyTaggerState.Active_Warmup);
((Interact_Timed)interact).InteractDuration = setting.TimeToPlace;
}
}
else
{
tagger.PickedByPlayer = null;
tagger.ChangeState((!setting.TagWhenPlaced) ? eEnemyTaggerState.Inactive : eEnemyTaggerState.Active_Warmup);
((Interact_Timed)interact).InteractDuration = setting.TimeToPickup;
}
});
}
private static void SetupAsFogBeacon(LG_PickupItem __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Expected O, but got Unknown
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Expected O, but got Unknown
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
FogRepeller_Sphere val = new GameObject("FogInstance_Beacon_Fake").AddComponent<FogRepeller_Sphere>();
val.InfiniteDuration = false;
val.LifeDuration = 99999f;
val.GrowDuration = 99999f;
val.ShrinkDuration = 99999f;
val.Range = 1f;
FogBeaconSetting setting = FogBeaconSettingManager.Current.SettingForCurrentLevel;
FogRepeller_Sphere fogRepHold = new GameObject("FogInstance_Beacon_SmallLayer").AddComponent<FogRepeller_Sphere>();
fogRepHold.InfiniteDuration = setting.RSHold.InfiniteDuration;
fogRepHold.GrowDuration = setting.RSHold.GrowDuration;
fogRepHold.ShrinkDuration = setting.RSHold.ShrinkDuration;
fogRepHold.Range = setting.RSHold.Range;
fogRepHold.Offset = Vector3.zero;
FogRepeller_Sphere fogRepPlaced = new GameObject("FogInstance_Beacon_BigLayer").AddComponent<FogRepeller_Sphere>();
fogRepPlaced.InfiniteDuration = setting.RSPlaced.InfiniteDuration;
fogRepPlaced.GrowDuration = setting.RSPlaced.GrowDuration;
fogRepPlaced.ShrinkDuration = setting.RSPlaced.ShrinkDuration;
fogRepPlaced.Range = setting.RSPlaced.Range;
fogRepPlaced.Offset = Vector3.zero;
CarryItemPickup_Core componentInChildren = ((Component)__instance.m_root).GetComponentInChildren<CarryItemPickup_Core>();
HeavyFogRepellerPickup val2 = ((Il2CppObjectBase)componentInChildren).Cast<HeavyFogRepellerPickup>();
iCarryItemWithGlobalState val3 = default(iCarryItemWithGlobalState);
byte byteId = default(byte);
if (CarryItemWithGlobalStateManager.TryCreateItemInstance((eCarryItemWithGlobalStateType)0, __instance.m_root, ref val3, ref byteId))
{
pItemData_Custom customData = ((Item)val2).GetCustomData();
customData.byteId = byteId;
pItemData_Custom val4 = customData;
((Item)val2).SetCustomData(val4, true);
}
HeavyFogRepellerGlobalState val5 = ((Il2CppObjectBase)val3).Cast<HeavyFogRepellerGlobalState>();
((Component)fogRepHold).transform.SetParent(((Component)val5).transform, false);
((Component)fogRepPlaced).transform.SetParent(((Component)val5).transform, false);
val5.m_repellerSphere = val;
fogRepHold.m_sphereAllocator = new FogSphereAllocator();
fogRepPlaced.m_sphereAllocator = new FogSphereAllocator();
Interact_Pickup_PickupItem interact = ((Il2CppObjectBase)componentInChildren.m_interact).Cast<Interact_Pickup_PickupItem>();
((Interact_Timed)interact).InteractDuration = setting.TimeToPickup;
val5.CallbackOnStateChange += Action<pCarryItemWithGlobalState_State, pCarryItemWithGlobalState_State, bool>.op_Implicit((Action<pCarryItemWithGlobalState_State, pCarryItemWithGlobalState_State, bool>)delegate(pCarryItemWithGlobalState_State oldState, pCarryItemWithGlobalState_State newState, bool isRecall)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
eHeavyFogRepellerStatus val6 = (eHeavyFogRepellerStatus)newState.status;
if ((int)val6 != 1)
{
if ((int)val6 == 2)
{
FogRepeller_Sphere obj = fogRepHold;
if (obj != null)
{
obj.StopRepelling();
}
FogRepeller_Sphere obj2 = fogRepPlaced;
if (obj2 != null)
{
obj2.StartRepelling();
}
((Interact_Timed)interact).InteractDuration = setting.TimeToPickup;
}
}
else
{
FogRepeller_Sphere obj3 = fogRepHold;
if (obj3 != null)
{
obj3.StartRepelling();
}
if (oldState.status != 0)
{
FogRepeller_Sphere obj4 = fogRepPlaced;
if (obj4 != null)
{
obj4.StopRepelling();
}
}
((Interact_Timed)interact).InteractDuration = setting.TimeToPlace;
}
if (isRecall)
{
FogRepeller_Sphere obj5 = fogRepHold;
if (obj5 != null)
{
obj5.KillRepellerInstantly();
}
FogRepeller_Sphere obj6 = fogRepPlaced;
if (obj6 != null)
{
obj6.KillRepellerInstantly();
}
}
});
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_PickupItem), "SetupBigPickupItemWithItemId")]
private static void Post_SetupBigPickupItemWithItemId(LG_PickupItem __instance, uint itemId)
{
switch (itemId)
{
case 233u:
SetupAsFogBeacon(__instance);
break;
case 234u:
case 235u:
SetupAsObserver(__instance);
break;
}
}
}
}
namespace LEGACY.LegacyOverride.FogBeacon
{
public class RepellerSphereSetting
{
public bool InfiniteDuration { get; set; }
public float GrowDuration { get; set; } = 10f;
public float ShrinkDuration { get; set; } = 10f;
public float Range { get; set; } = 11f;
}
public class FogBeaconSetting
{
public uint MainLevelLayout { get; set; }
public float TimeToPickup { get; set; } = 1f;
public float TimeToPlace { get; set; } = 1f;
public RepellerSphereSetting RSHold { get; set; } = new RepellerSphereSetting();
public RepellerSphereSetting RSPlaced { get; set; } = new RepellerSphereSetting();
}
internal class FogBeaconSettingManager
{
public static readonly FogBeaconSettingManager Current;
private Dictionary<uint, FogBeaconSetting> fogBeaconSettings = new Dictionary<uint, FogBeaconSetting>();
private LiveEditListener liveEditListener;
private static readonly string CONFIG_PATH;
internal FogBeaconSetting SettingForCurrentLevel { get; private set; }
private void AddOverride(FogBeaconSetting _override)
{
if (_override != null)
{
if (fogBeaconSettings.ContainsKey(_override.MainLevelLayout))
{
LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout);
fogBeaconSettings[_override.MainLevelLayout] = _override;
}
else
{
fogBeaconSettings.Add(_override.MainLevelLayout, _override);
}
}
}
public void Init()
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
if (!Directory.Exists(CONFIG_PATH))
{
Directory.CreateDirectory(CONFIG_PATH);
StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json"));
streamWriter.WriteLine(Json.Serialize(new FogBeaconSetting()));
streamWriter.Flush();
streamWriter.Close();
return;
}
foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories))
{
Json.Load<FogBeaconSetting>(item, out var config);
AddOverride(config);
}
LevelAPI.OnBuildStart += UpdateSetting;
liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true);
liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged);
}
private void FileChanged(LiveEditEventArgs e)
{
LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath);
LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content)
{
FogBeaconSetting @override = Json.Deserialize<FogBeaconSetting>(content);
AddOverride(@override);
if (GameStateManager.IsInExpedition)
{
UpdateSetting();
}
});
}
private void UpdateSetting()
{
uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData;
SettingForCurrentLevel = (fogBeaconSettings.ContainsKey(levelLayoutData) ? fogBeaconSettings[levelLayoutData] : null);
LegacyLogger.Debug($"FogBeaconSettingManager: updated setting for level with main level layout id {levelLayoutData}");
}
private FogBeaconSettingManager()
{
}
static FogBeaconSettingManager()
{
CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "FogBeaconSetting");
Current = new FogBeaconSettingManager();
}
}
}
namespace LEGACY.LegacyOverride.ExtraExpeditionSettings
{
public class ExpeditionSettings
{
public uint MainLevelLayout { get; set; }
}
internal class ExpeditionSettingsManager
{
public static ExpeditionSettingsManager Current;
private Dictionary<uint, ExpeditionSettings> expSettings = new Dictionary<uint, ExpeditionSettings>();
private LiveEditListener liveEditListener;
private static readonly string CONFIG_PATH;
private void AddOverride(ExpeditionSettings _override)
{
if (_override != null)
{
if (expSettings.ContainsKey(_override.MainLevelLayout))
{
LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout);
expSettings[_override.MainLevelLayout] = _override;
}
else
{
expSettings.Add(_override.MainLevelLayout, _override);
}
}
}
public void Init()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
if (!Directory.Exists(CONFIG_PATH))
{
Directory.CreateDirectory(CONFIG_PATH);
StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json"));
streamWriter.WriteLine(Json.Serialize(new ExpeditionSettings()));
streamWriter.Flush();
streamWriter.Close();
return;
}
foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories))
{
Json.Load<ExpeditionSettings>(item, out var config);
AddOverride(config);
}
liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true);
liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged);
}
private void FileChanged(LiveEditEventArgs e)
{
LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath);
LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content)
{
ExpeditionSettings @override = Json.Deserialize<ExpeditionSettings>(content);
AddOverride(@override);
});
}
private void OnBuildDone()
{
if (expSettings.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData))
{
_ = expSettings[RundownManager.ActiveExpedition.LevelLayoutData];
}
}
private void OnBuildStart()
{
}
private void OnLevelCleanup()
{
}
private void OnEnterLevel()
{
}
private ExpeditionSettingsManager()
{
}
static ExpeditionSettingsManager()
{
CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "ExpeditionSettings");
Current = new ExpeditionSettingsManager();
LevelAPI.OnBuildStart += Current.OnBuildStart;
LevelAPI.OnEnterLevel += Current.OnEnterLevel;
LevelAPI.OnBuildDone += Current.OnBuildDone;
LevelAPI.OnLevelCleanup += Current.OnLevelCleanup;
}
}
}
namespace LEGACY.LegacyOverride.EnemyTagger
{
public enum eEnemyTaggerState
{
Uninitialized,
Inactive,
Active_Warmup,
Active_Tagging
}
public class EnemyTaggerComponent : MonoBehaviour
{
private const float INACTIVE_SOUND_UPDATE_INTERVAL = 1f;
internal int MaxTagPerScan = 12;
internal float TagInterval = 3f;
internal float TagRadius = 12f;
internal float WarmupTime = 3f;
private eEnemyTaggerState CurrentState;
private CellSoundPlayer m_sound = new CellSoundPlayer();
private List<EnemyAgent> TaggableEnemies = new List<EnemyAgent>();
private float UpdateTime;
internal CarryItemPickup_Core Parent { get; set; }
internal PlayerAgent PickedByPlayer { get; set; }
internal Vector3 Position
{
get
{
//IL_003e: 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_0027: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Parent == (Object)null))
{
if (!((Object)(object)PickedByPlayer == (Object)null))
{
return ((Component)PickedByPlayer).transform.position;
}
return ((Component)Parent).transform.position;
}
return Vector3.zero;
}
}
public void ChangeState(eEnemyTaggerState newState)
{
if (CurrentState == newState)
{
return;
}
switch (newState)
{
case eEnemyTaggerState.Uninitialized:
LegacyLogger.Error("Enemy Tagger changed to state 'uninitialized'?");
return;
case eEnemyTaggerState.Inactive:
UpdateTime = 0f;
TaggableEnemies.Clear();
m_sound.Post(EVENTS.BULKHEAD_BUTTON_CLOSE, true);
break;
case eEnemyTaggerState.Active_Warmup:
UpdateTime = 0f;
m_sound.Post(EVENTS.BUTTONGENERICDEACTIVATE, true);
break;
case eEnemyTaggerState.Active_Tagging:
if (CurrentState != eEnemyTaggerState.Active_Warmup)
{
UpdateTime = 0f;
}
break;
default:
LegacyLogger.Error($"Enemy Tagger: Undefined state {CurrentState}");
return;
}
CurrentState = newState;
}
private bool UpdateTaggableEnemies()
{
//IL_0056: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
TaggableEnemies.Clear();
bool result = false;
Enumerator<EnemyAgent> enumerator = AIG_CourseGraph.GetReachableEnemiesInNodes(((Object)(object)PickedByPlayer == (Object)null) ? ((ItemInLevel)Parent).m_courseNode : ((Agent)PickedByPlayer).CourseNode, 2).GetEnumerator();
while (enumerator.MoveNext())
{
EnemyAgent current = enumerator.Current;
if (!((Agent)current).Alive)
{
continue;
}
Vector3 val = ((Component)current).transform.position - Position;
if (!(((Vector3)(ref val)).magnitude > TagRadius))
{
result = true;
if (!current.IsTagged)
{
TaggableEnemies.Add(current);
}
if (TaggableEnemies.Count >= MaxTagPerScan)
{
break;
}
}
}
return result;
}
private void StartTagging()
{
if (!(UpdateTime >= TagInterval))
{
return;
}
if (SNet.IsMaster)
{
UpdateTaggableEnemies();
foreach (EnemyAgent taggableEnemy in TaggableEnemies)
{
ToolSyncManager.WantToTagEnemy(taggableEnemy);
}
}
m_sound.Post(EVENTS.MARKERGUNACTIVATE, true);
UpdateTime = 0f;
}
private void StopTagging()
{
if (UpdateTime >= 1f)
{
m_sound.Post(EVENTS.BUTTONGENERICDEACTIVATE, true);
UpdateTime = 0f;
}
}
private void Warmup()
{
if (UpdateTime >= WarmupTime)
{
ChangeState(eEnemyTaggerState.Active_Tagging);
UpdateTime = TagInterval;
}
}
private void Update()
{
//IL_003b: 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)
if (CurrentState == eEnemyTaggerState.Uninitialized)
{
return;
}
if ((Object)(object)Parent == (Object)null)
{
LegacyLogger.Error("EnemyTagger: null parent");
return;
}
UpdateTime += Time.deltaTime;
m_sound.UpdatePosition(Position);
switch (CurrentState)
{
case eEnemyTaggerState.Active_Warmup:
Warmup();
break;
case eEnemyTaggerState.Active_Tagging:
StartTagging();
break;
case eEnemyTaggerState.Inactive:
StopTagging();
break;
}
}
private void OnDestroy()
{
StopTagging();
TaggableEnemies.Clear();
TaggableEnemies = null;
if (m_sound != null)
{
m_sound.Stop();
m_sound.Recycle();
m_sound = null;
}
Parent = null;
}
}
public class EnemyTaggerSetting
{
public uint MainLevelLayout { get; set; }
public float TimeToPickup { get; set; } = 1f;
public float TimeToPlace { get; set; } = 1f;
public float WarmupTime { get; set; } = 5f;
public int MaxTagPerScan { get; set; } = 12;
public float TagInterval { get; set; } = 3f;
public float TagRadius { get; set; } = 12f;
public bool TagWhenPlaced { get; set; } = true;
public bool TagWhenHold { get; set; }
}
internal class EnemyTaggerSettingManager
{
public static readonly EnemyTaggerSettingManager Current;
private Dictionary<uint, EnemyTaggerSetting> enemyTaggerSettingSettings = new Dictionary<uint, EnemyTaggerSetting>();
private LiveEditListener liveEditListener;
private static readonly string CONFIG_PATH;
private static readonly EnemyTaggerSetting DEFAULT;
internal EnemyTaggerSetting SettingForCurrentLevel { get; private set; } = DEFAULT;
private void AddOverride(EnemyTaggerSetting _override)
{
if (_override != null)
{
if (enemyTaggerSettingSettings.ContainsKey(_override.MainLevelLayout))
{
LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout);
enemyTaggerSettingSettings[_override.MainLevelLayout] = _override;
}
else
{
enemyTaggerSettingSettings.Add(_override.MainLevelLayout, _override);
}
}
}
public void Init()
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
if (!Directory.Exists(CONFIG_PATH))
{
Directory.CreateDirectory(CONFIG_PATH);
StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json"));
streamWriter.WriteLine(Json.Serialize(new EnemyTaggerSetting()));
streamWriter.Flush();
streamWriter.Close();
return;
}
foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories))
{
Json.Load<EnemyTaggerSetting>(item, out var config);
AddOverride(config);
}
LevelAPI.OnBuildStart += UpdateSetting;
ClassInjector.RegisterTypeInIl2Cpp<EnemyTaggerComponent>();
liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true);
liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged);
}
private void FileChanged(LiveEditEventArgs e)
{
LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath);
LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content)
{
EnemyTaggerSetting @override = Json.Deserialize<EnemyTaggerSetting>(content);
AddOverride(@override);
if (GameStateManager.IsInExpedition)
{
UpdateSetting();
}
});
}
private void UpdateSetting()
{
uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData;
SettingForCurrentLevel = (enemyTaggerSettingSettings.ContainsKey(levelLayoutData) ? enemyTaggerSettingSettings[levelLayoutData] : DEFAULT);
LegacyLogger.Debug($"EnemyTaggerSettingManager: updated setting for level with main level layout id {levelLayoutData}");
}
private EnemyTaggerSettingManager()
{
}
static EnemyTaggerSettingManager()
{
CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "EnemyTaggerSetting");
DEFAULT = new EnemyTaggerSetting();
Current = new EnemyTaggerSettingManager();
}
}
}
namespace LEGACY.LegacyOverride.ElevatorCargo
{
internal class ElevatorCargoOverrideManager
{
public static readonly ElevatorCargoOverrideManager Current;
private Dictionary<uint, LevelElevatorCargo> elevatorCargos = new Dictionary<uint, LevelElevatorCargo>();
private LiveEditListener liveEditListener;
private static readonly string CONFIG_PATH;
private void AddOverride(LevelElevatorCargo _override)
{
if (_override != null)
{
if (elevatorCargos.ContainsKey(_override.MainLevelLayout))
{
LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout);
elevatorCargos[_override.MainLevelLayout] = _override;
}
else
{
elevatorCargos.Add(_override.MainLevelLayout, _override);
}
}
}
public void Init()
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
if (!Directory.Exists(CONFIG_PATH))
{
Directory.CreateDirectory(CONFIG_PATH);
StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json"));
streamWriter.WriteLine(Json.Serialize(new LevelElevatorCargo()));
streamWriter.Flush();
streamWriter.Close();
return;
}
foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories))
{
Json.Load<LevelElevatorCargo>(item, out var config);
AddOverride(config);
}
liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true);
liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged);
}
private void FileChanged(LiveEditEventArgs e)
{
LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath);
LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content)
{
LevelElevatorCargo @override = Json.Deserialize<LevelElevatorCargo>(content);
AddOverride(@override);
});
}
internal LevelElevatorCargo GetLevelElevatorCargoItems(uint MainLevelLayout)
{
if (!elevatorCargos.ContainsKey(MainLevelLayout))
{
return null;
}
return elevatorCargos[MainLevelLayout];
}
private ElevatorCargoOverrideManager()
{
}
static ElevatorCargoOverrideManager()
{
CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "ElevatorCargoOverride");
Current = new ElevatorCargoOverrideManager();
}
}
public enum ItemType
{
Consumable,
BigPickup
}
public class ElevatorCargoItem
{
public uint ItemID { get; set; }
public ItemType ItemType { get; set; }
}
public class LevelElevatorCargo
{
public uint MainLevelLayout { get; set; }
public bool ForceDisable { get; set; }
public List<ElevatorCargoItem> ElevatorCargoItems { get; set; } = new List<ElevatorCargoItem>();
}
}
namespace LEGACY.LegacyOverride.DimensionPortal
{
public class DimensionPortalInstanceManager : InstanceManager<LG_DimensionPortal>
{
public static DimensionPortalInstanceManager Current { get; private set; }
public override (eDimensionIndex dim, LG_LayerType layer, eLocalZoneIndex zone) GetGlobalZoneIndex(LG_DimensionPortal instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
return (instance.SpawnNode.m_dimension.DimensionIndex, instance.SpawnNode.LayerType, instance.SpawnNode.m_zone.LocalIndex);
}
private DimensionPortalInstanceManager()
{
}
static DimensionPortalInstanceManager()
{
Current = new DimensionPortalInstanceManager();
}
}
public class DimensionPortalDefinitionManager : InstanceDefinitionManager<PortalCustomization>
{
public static DimensionPortalDefinitionManager Current { get; private set; }
protected override string DEFINITION_NAME => "DimensionPortal";
private DimensionPortalDefinitionManager()
{
}
static DimensionPortalDefinitionManager()
{
Current = new DimensionPortalDefinitionManager();
}
}
public class PortalCustomization : BaseInstanceDefinition
{
public uint ChainedPuzzleOnPortalActive { get; set; } = 4u;
public List<WardenObjectiveEventData> EventsOnScanActive { get; set; } = new List<WardenObjectiveEventData>();
public List<WardenObjectiveEventData> EventsOnScanDone { get; set; } = new List<WardenObjectiveEventData>();
}
}
namespace LEGACY.ExtraEvents
{
internal static class LegacyExtraEvents
{
private static bool initialized;
private static void AlertEnemiesInArea(LG_Area area)
{
//IL_00c1: 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)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0059: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_0088: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
AIG_CourseNode courseNode = area.m_courseNode;
if (courseNode.m_enemiesInNode.Count > 0)
{
EnemyAgent obj = courseNode.m_enemiesInNode[0];
PlayerAgent val = null;
if (PlayerManager.TryGetClosestAlivePlayerAgent(((Agent)obj).CourseNode, ref val) && (Object)(object)val != (Object)null)
{
Vector3 position = courseNode.m_enemiesInNode[0].Position;
NoiseManager.MakeNoise(new NM_NoiseData
{
noiseMaker = null,
position = position,
radiusMin = 50f,
radiusMax = 120f,
yScale = 1f,
node = courseNode,
type = (NM_NoiseType)0,
includeToNeightbourAreas = true,
raycastFirstNode = false
});
}
else
{
LegacyLogger.Error($"AlertEnemies: failed to alert enemies in area in Zone_{area.m_zone.LocalIndex}, {area.m_zone.m_layer.m_type}, {area.m_zone.DimensionIndex}");
}
}
}
private static void AlertEnemiesInZone(WardenObjectiveEventData e)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(e.DimensionIndex, e.Layer, e.LocalIndex, ref val) || (Object)(object)val == (Object)null)
{
LegacyLogger.Error($"AlertEnemiesInZone: zone not found, {(e.DimensionIndex, e.Layer, e.LocalIndex)}");
return;
}
LegacyLogger.Debug($"AlertEnemiesInZone: {e.LocalIndex}, {e.Layer}, {e.DimensionIndex}");
Enumerator<LG_Area> enumerator = val.m_areas.GetEnumerator();
while (enumerator.MoveNext())
{
AlertEnemiesInArea(enumerator.Current);
}
}
private static void AlertEnemiesInArea(WardenObjectiveEventData e)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(e.DimensionIndex, e.Layer, e.LocalIndex, ref val) || (Object)(object)val == (Object)null)
{
LegacyLogger.Error($"AlertEnemiesInArea: zone not found, {(e.DimensionIndex, e.Layer, e.LocalIndex)}");
}
else if (e.Count >= val.m_areas.Count && e.Count < 0)
{
LegacyLogger.Error($"AlertEnemiesInArea: invalid area index {e.Count} (specified by 'Count')");
}
else
{
AlertEnemiesInArea(val.m_areas[e.Count]);
}
}
private static void ActivateChainedPuzzle(WardenObjectiveEventData e)
{
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
uint chainPuzzle = e.ChainPuzzle;
CP_Bioscan_Core bioscanCore = PuzzleOverrideManager.Current.GetBioscanCore(chainPuzzle);
CP_Cluster_Core clusterCore = PuzzleOverrideManager.Current.GetClusterCore(chainPuzzle);
iChainedPuzzleOwner val;
if ((Object)(object)bioscanCore != (Object)null)
{
val = PuzzleOverrideManager.Current.ChainedPuzzleInstanceOwner(bioscanCore);
}
else
{
if (!((Object)(object)clusterCore != (Object)null))
{
LegacyLogger.Error($"ActivateChainedPuzzle: Cannot find puzzle with puzzle override index {chainPuzzle}!");
return;
}
val = clusterCore.m_owner;
}
ChainedPuzzleInstance val2 = ((Il2CppObjectBase)val).TryCast<ChainedPuzzleInstance>();
if ((Object)(object)val2 == (Object)null)
{
LegacyLogger.Error("ActivateChainedPuzzle: Cannot find ChainedPuzzleInstance!");
return;
}
if (SNet.IsMaster)
{
val2.AttemptInteract((eChainedPuzzleInteraction)0);
}
LegacyLogger.Debug($"ActivateChainedPuzzle: puzzle override index: {chainPuzzle}");
LegacyLogger.Debug($"ChainedPuzzleZone: Dim {val2.m_sourceArea.m_zone.DimensionIndex}, {val2.m_sourceArea.m_zone.m_layer.m_type}, Zone {val2.m_sourceArea.m_zone.Alias}");
LegacyLogger.Debug("ChainedPuzzle Alarm name: " + val2.Data.PublicAlarmName);
}
internal static IEnumerator AddReqItem(WardenObjectiveEventData e, float currentDuration)
{
uint puzzleOverrideIndex = e.ChainPuzzle;
int count = e.Count;
CarryItemPickup_Core itemToAdd = PuzzleReqItemManager.Current.GetBigPickupItem(count);
if ((Object)(object)itemToAdd == (Object)null)
{
LegacyLogger.Error($"AddReqItem: Cannot find BigPickup Item with index {count}");
yield break;
}
CP_Bioscan_Core bioscanCore = PuzzleOverrideManager.Current.GetBioscanCore(puzzleOverrideIndex);
CP_Cluster_Core clusterCore = PuzzleOverrideManager.Current.GetClusterCore(puzzleOverrideIndex);
if ((Object)(object)bioscanCore != (Object)null)
{
float num = Mathf.Max(e.Delay - currentDuration, 0f);
if (num > 0f)
{
yield return (object)new WaitForSeconds(num);
}
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);
string text = ((Object)e.SoundSubtitle).ToString();
if (!string.IsNullOrWhiteSpace(text))
{
GuiManager.PlayerLayer.ShowMultiLineSubtitle(text);
}
}
if ((double)e.Duration > 0.0 && (double)e.Duration < 1.0)
{
float duration = e.Duration;
CP_PlayerScanner scanner = ((Il2CppObjectBase)bioscanCore.m_playerScanner).TryCast<CP_PlayerScanner>();
if ((Object)(object)scanner != (Object)null)
{
float CheckInterval = (((double)e.FogTransitionDuration > 0.0) ? e.FogTransitionDuration : 0.5f);
LegacyLogger.Debug($"AddReqItem: item would be added on scan progression: {duration}, progression check interval: {CheckInterval} (seconds)");
while (scanner.m_scanProgression < e.Duration)
{
yield return (object)new WaitForSeconds(CheckInterval);
}
}
else
{
LegacyLogger.Error("AddReqItem: Failed to get scanner for the CP_Bioscan_Core");
}
}
bioscanCore.AddRequiredItems(Il2CppReferenceArray<iWardenObjectiveItem>.op_Implicit((iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1]
{
new iWardenObjectiveItem(((Il2CppObjectBase)itemToAdd).Pointer)
}));
LegacyLogger.Debug($"AddReqItem: puzzle override index: {puzzleOverrideIndex}");
LegacyLogger.Debug("Item name: " + ((Item)itemToAdd).ItemDataBlock.publicName);
}
else if ((Object)(object)clusterCore != (Object)null)
{
float num2 = Mathf.Max(e.Delay - currentDuration, 0f);
if (num2 > 0f)
{
yield return (object)new WaitForSeconds(num2);
}
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);
string text2 = ((Object)e.SoundSubtitle).ToString();
if (!string.IsNullOrWhiteSpace(text2))
{
GuiManager.PlayerLayer.ShowMultiLineSubtitle(text2);
}
}
iWardenObjectiveItem[] array = (iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1]
{
new iWardenObjectiveItem(((Il2CppObjectBase)itemToAdd).Pointer)
};
foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)clusterCore.m_childCores)
{
item.AddRequiredItems(Il2CppReferenceArray<iWardenObjectiveItem>.op_Implicit(array));
}
LegacyLogger.Debug($"AddReqItem: puzzle override index: {puzzleOverrideIndex}");
LegacyLogger.Debug("Item name: " + ((Item)itemToAdd).ItemDataBlock.publicName);
}
else
{
LegacyLogger.Error($"AddReqItem: cannot find puzzle core with index {puzzleOverrideIndex}");
}
}
internal static IEnumerator RemoveReqItem(WardenObjectiveEventData e, float currentDuration)
{
uint puzzleOverrideIndex = e.ChainPuzzle;
int count = e.Count;
CarryItemPickup_Core itemToRemove = PuzzleReqItemManager.Current.GetBigPickupItem(count);
if ((Object)(object)itemToRemove == (Object)null)
{
LegacyLogger.Error($"RemoveReqItem: Cannot find BigPickup Item with index {count}");
yield break;
}
CP_Bioscan_Core bioscanCore = PuzzleOverrideManager.Current.GetBioscanCore(puzzleOverrideIndex);
CP_Cluster_Core clusterCore = PuzzleOverrideManager.Current.GetClusterCore(puzzleOverrideIndex);
if ((Object)(object)bioscanCore != (Object)null)
{
float num = Mathf.Max(e.Delay - currentDuration, 0f);
if (num > 0f)
{
yield return (object)new WaitForSeconds(num);
}
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);
string text = ((Object)e.SoundSubtitle).ToString();
if (!string.IsNullOrWhiteSpace(text))
{
GuiManager.PlayerLayer.ShowMultiLineSubtitle(text);
}
}
if ((double)e.Duration > 0.0 && (double)e.Duration < 1.0)
{
float duration = e.Duration;
CP_PlayerScanner scanner = ((Il2CppObjectBase)bioscanCore.m_playerScanner).TryCast<CP_PlayerScanner>();
if ((Object)(object)scanner != (Object)null)
{
float CheckInterval = (((double)e.FogTransitionDuration > 0.0) ? e.FogTransitionDuration : 0.5f);
LegacyLogger.Debug($"RemoveReqItem: item would be added on scan progression: {duration}, progression check interval: {CheckInterval} (seconds)");
while (scanner.m_scanProgression < e.Duration)
{
yield return (object)new WaitForSeconds(CheckInterval);
}
}
else
{
LegacyLogger.Error("RemoveReqItem: Failed to get scanner for the CP_Bioscan_Core");
}
}
bioscanCore.RemoveRequiredItems((iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1]
{
new iWardenObjectiveItem(((Il2CppObjectBase)itemToRemove).Pointer)
});
LegacyLogger.Debug($"RemoveReqItem: puzzle override index: {puzzleOverrideIndex}");
LegacyLogger.Debug("Removed Item name: " + ((Item)itemToRemove).ItemDataBlock.publicName);
}
else if ((Object)(object)clusterCore != (Object)null)
{
float num2 = Mathf.Max(e.Delay - currentDuration, 0f);
if (num2 > 0f)
{
yield return (object)new WaitForSeconds(num2);
}
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);
string text2 = ((Object)e.SoundSubtitle).ToString();
if (!string.IsNullOrWhiteSpace(text2))
{
GuiManager.PlayerLayer.ShowMultiLineSubtitle(text2);
}
}
iWardenObjectiveItem[] array = (iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1]
{
new iWardenObjectiveItem(((Il2CppObjectBase)itemToRemove).Pointer)
};
foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)clusterCore.m_childCores)
{
item.RemoveRequiredItems(array);
}
LegacyLogger.Debug($"RemoveReqItem: puzzle override index: {puzzleOverrideIndex}");
LegacyLogger.Debug("Removed Item name: " + ((Item)itemToRemove).ItemDataBlock.publicName);
}
else
{
LegacyLogger.Error($"RemoveReqItem: cannot find puzzle core with index {puzzleOverrideIndex}");
}
}
internal static void Init()
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
if (!initialized)
{
LegacyLogger.Log("Adding Legacy warden event definitions...");
EOSWardenEventManager.Current.AddEventDefinition(EventType.CloseSecurityDoor_Custom.ToString(), 100u, (Action<WardenObjectiveEventData>)CloseSecurityDoor);
EOSWardenEventManager.Current.AddEventDefinition(EventType.SetTimerTitle.ToString(), 102u, (Action<WardenObjectiveEventData>)SetTimerTitle);
EOSWardenEventManager current = EOSWardenEventManager.Current;
eWardenObjectiveEventType val = (eWardenObjectiveEventType)21;
current.AddEventDefinition(((object)(eWardenObjectiveEventType)(ref val)).ToString(), 21u, (Action<WardenObjectiveEventData>)SetTerminalCommand_Custom);
EOSWardenEventManager.Current.AddEventDefinition(EventType.AlertEnemiesInArea.ToString(), 108u, (Action<WardenObjectiveEventData>)AlertEnemiesInArea);
EOSWardenEventManager.Current.AddEventDefinition(EventType.AlertEnemiesInZone.ToString(), 107u, (Action<WardenObjectiveEventData>)AlertEnemiesInZone);
EOSWardenEventManager.Current.AddEventDefinition(EventType.KillEnemiesInArea.ToString(), 140u, (Action<WardenObjectiveEventData>)KillEnemiesInArea);
EOSWardenEventManager.Current.AddEventDefinition(EventType.KillEnemiesInZone.ToString(), 141u, (Action<WardenObjectiveEventData>)KillEnemiesInZone);
EOSWardenEventManager.Current.AddEventDefinition(EventType.KillEnemiesInDimension.ToString(), 142u, (Action<WardenObjectiveEventData>)KillEnemiesInDimension);
EOSWardenEventManager.Current.AddEventDefinition(EventType.SpawnHibernate.ToString(), 170u, (Action<WardenObjectiveEventData>)SpawnHibernate);
EOSWardenEventManager.Current.AddEventDefinition(EventType.Info_ZoneHibernate.ToString(), 250u, (Action<WardenObjectiveEventData>)Info_ZoneHibernate);
EOSWardenEventManager.Current.AddEventDefinition(EventType.Info_LevelHibernate.ToString(), 251u, (Action<WardenObjectiveEventData>)Info_LevelEnemies);
EOSWardenEventManager.Current.AddEventDefinition(EventType.Output_LevelHibernateSpawnEvent.ToString(), 252u, (Action<WardenObjectiveEventData>)Output_LevelHibernateSpawnEvent);
EOSWardenEventManager.Current.AddEventDefinition(EventType.PlayGCEndSequence.ToString(), 180u, (Action<WardenObjectiveEventData>)PlayGCEndSequence);
EOSWardenEventManager current2 = EOSWardenEventManager.Current;
val = (eWardenObjectiveEventType)22;
current2.AddEventDefinition(((object)(eWardenObjectiveEventType)(ref val)).ToString(), 22u, (Action<WardenObjectiveEventData>)ActivateChainedPuzzle);
EOSWardenEventManager.Current.AddEventDefinition(EventType.Terminal_ShowTerminalInfoInZone.ToString(), 130u, (Action<WardenObjectiveEventData>)ShowTerminalInfoInZone);
LegacyLogger.Log("Legacy warden event definitions setup completed");
initialized = true;
}
}
private static IEnumerator Play(WardenObjectiveEventData e)
{
List<LG_PowerGenerator_Core> gcInZone = ((InstanceManager<LG_PowerGenerator_Core>)(object)PowerGeneratorInstanceManager.Current).GetInstancesInZone(e.DimensionIndex, e.Layer, e.LocalIndex);
yield return (object)new WaitForSeconds(4f);
CellSound.Post(EVENTS.DISTANT_EXPLOSION_SEQUENCE);
yield return (object)new WaitForSeconds(2f);
EnvironmentStateManager.AttemptSetExpeditionLightMode(false);
CellSound.Post(EVENTS.LIGHTS_OFF_GLOBAL);
yield return (object)new WaitForSeconds(3f);
int g = 0;
while (g < gcInZone.Count)
{
gcInZone[g].TriggerPowerFailureSequence();
yield return (object)new WaitForSeconds(Random.Range(0.3f, 1f));
int num = g + 1;
g = num;
}
yield return (object)new WaitForSeconds(4f);
EnvironmentStateManager.AttemptSetExpeditionLightMode(true);
}
private static void PlayGCEndSequence(WardenObjectiveEventData e)
{
Coroutine val = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Play(e)), (Action)null);
WorldEventManager.m_worldEventEventCoroutines.Add(val);
}
private static void KillEnemiesInArea(LG_Area area)
{
//IL_0042: 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)
foreach (EnemyAgent item in area.m_courseNode.m_enemiesInNode.ToArray())
{
if ((Object)(object)item != (Object)null && (Object)(object)item.Damage != (Object)null)
{
item.Damage.MeleeDamage(float.MaxValue, (Agent)null, Vector3.zero, Vector3.up, 0, 1f, 1f, 1f, 1f, false, (DamageNoiseLevel)0, 0u);
}
}
}
private static void KillEnemiesInArea(WardenObjectiveEventData e)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(e.DimensionIndex, e.Layer, e.LocalIndex, ref val) || (Object)(object)val == (Object)null)
{
LegacyLogger.Error($"KillEnemiesInArea - Failed to find {(e.DimensionIndex, e.Layer, e.LocalIndex)}");
}
else if (e.Count < 0 || e.Count >= val.m_areas.Count)
{
LegacyLogger.Error($"KillEnemiesInArea - invalid area index {e.Count} (specified by 'Count')");
}
else
{
KillEnemiesInArea(val.m_areas[e.Count]);
}
}
private static void KillEnemiesInZone(WardenObjectiveEventData e)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if (!SNet.IsMaster)
{
return;
}
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(e.DimensionIndex, e.Layer, e.LocalIndex, ref val) || (Object)(object)val == (Object)null)
{
LegacyLogger.Error($"KillEnemiesInArea - Failed to find {(e.DimensionIndex, e.Layer, e.LocalIndex)}");
}
else
{
Enumerator<LG_Area> enumerator = val.m_areas.GetEnumerator();
while (enumerator.MoveNext())
{
KillEnemiesInArea(enumerator.Current);
}
}
}
private static void KillEnemiesInDimension(WardenObjectiveEventData e)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_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_009a: Invalid comparison between Unknown and I4
if (!SNet.IsMaster)
{
return;
}
Dimension val = default(Dimension);
if (!Dimension.GetDimension(e.DimensionIndex, ref val))
{
LegacyLogger.Error($"KillEnemiesInDimension: invalid dimension index {e.DimensionIndex}");
return;
}
for (int i = 0; i < val.Layers.Count; i++)
{
LG_Layer val2 = val.Layers[i];
for (int j = 0; j < val2.m_zones.Count; j++)
{
LG_Zone val3 = val2.m_zones[j];
Helper.TryGetZoneEntranceSecDoor(val3, out var door);
if (j == 0 || ((Object)(object)door != (Object)null && (int)door.m_sync.GetCurrentSyncState().status == 10))
{
Enumerator<LG_Area> enumerator = val3.m_areas.GetEnumerator();
while (enumerator.MoveNext())
{
KillEnemiesInArea(enumerator.Current);
}
}
}
}
}
private static void CloseSecurityDoor(WardenObjectiveEventData e)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)