using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using AIGraph; using AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using BoosterImplants; using CellMenu; using ChainedPuzzles; using EOSExt.Reactor.Managers; using Enemies; using ExtraObjectiveSetup; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.ExtendedWardenEvents; using ExtraObjectiveSetup.Instances; using ExtraObjectiveSetup.Utils; using FloLib.Infos; using FloLib.Networks.Replications; using GTFO.API; using GTFO.API.JSON.Converters; using GTFO.API.Utilities; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LEGACY.ExtraEvents; using LEGACY.LegacyOverride; using LEGACY.LegacyOverride.DummyVisual; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation.AnimationConfig; using LEGACY.LegacyOverride.DummyVisual.VisualSequenceType; using LEGACY.LegacyOverride.ElevatorCargo; using LEGACY.LegacyOverride.EnemyTagger; using LEGACY.LegacyOverride.EventScan; using LEGACY.LegacyOverride.ExpeditionIntelNotification; using LEGACY.LegacyOverride.ExpeditionSuccessPage; using LEGACY.LegacyOverride.FogBeacon; using LEGACY.LegacyOverride.ForceFail; using LEGACY.LegacyOverride.Music; using LEGACY.LegacyOverride.ResourceStations; using LEGACY.Utils; using LEGACY.VanillaFix; using LevelGeneration; using Localization; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using ScanPosOverride.Managers; using StateMachines; using TMPro; using ThermalSights; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("LEGACY")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LEGACY")] [assembly: AssemblyTitle("LEGACY")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")] internal static class Patch_WatermarkUpdateWatermark { private static void Postfix(PUI_Watermark __instance) { string text = "4.6.2+git44e73d7-dirty-main".Remove("x.x.x".Length); ((TMP_Text)__instance.m_watermarkText).SetText("MODDED " + text + "\nThe R'lyeh Text", true); } } namespace LEGACY { internal static class Assets { public static GameObject CircleSensor { get; private set; } public static GameObject MovableSensor { get; private set; } public static GameObject OBSVisual { get; private set; } public static GameObject ObjectiveMarker { get; private set; } public static GameObject EventScan { get; private set; } internal static GameObject DummyScan { get; private set; } internal static GameObject DummySensor { get; private set; } internal static GameObject AmmoStation { get; private set; } internal static GameObject MediStation { get; private set; } internal static GameObject ToolStation { get; private set; } public static void Init() { CircleSensor = AssetAPI.GetLoadedAsset("Assets/SecuritySensor/CircleSensor.prefab"); MovableSensor = AssetAPI.GetLoadedAsset("Assets/SecuritySensor/MovableSensor.prefab"); OBSVisual = AssetAPI.GetLoadedAsset("Assets/SecuritySensor/OBSVisual.prefab"); ObjectiveMarker = AssetAPI.GetLoadedAsset("Assets/SecuritySensor/ObjectiveMarker.prefab"); EventScan = AssetAPI.GetLoadedAsset("Assets/EventObjects/EventScan.prefab"); DummyScan = AssetAPI.GetLoadedAsset("Assets/DummyVisual/DummyScan.prefab"); DummySensor = AssetAPI.GetLoadedAsset("Assets/DummyVisual/DummySensor.prefab"); AmmoStation = AssetAPI.GetLoadedAsset("Assets/Misc/AmmoStation.prefab"); MediStation = AssetAPI.GetLoadedAsset("Assets/Misc/MediStation.prefab"); ToolStation = AssetAPI.GetLoadedAsset("Assets/Misc/ToolStation.prefab"); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("Localia.TeammatesIgnoreBullets")] [BepInIncompatibility("com.Chaxi.StrongerPrisoner")] [BepInIncompatibility("Hikaria.InLevelCarryOnBack")] [BepInPlugin("Inas.LEGACY", "LEGACY", "4.3.3")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string RUNDOWN_NAME = "LEGACY"; public const string VERSION = "4.3.3"; public const bool TESTING = false; public const string TEST_STRING = "TESTING"; private Harmony m_Harmony; public override void Load() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown m_Harmony = new Harmony("LEGACY"); m_Harmony.PatchAll(); LegacyOverrideManagers.Init(); LegacyExtraEvents.Init(); LEGACY.VanillaFix.Debugger.Current.Init(); AssetAPI.OnAssetBundlesLoaded += Assets.Init; EventAPI.OnManagersSetup += delegate { AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)MainMenuGuiLayer.Current.PageRundownNew.SetupCustomTutorialButton); }; } } } namespace LEGACY.Reactor { [HarmonyPatch] internal class Patch_ReactorShutdown { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected I4, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || oldState.status == newState.status) { return; } WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorShutdown: "); LegacyLogger.Error("Failed to get warden objective"); } else if ((int)val.Type == 2 && !val.OnActivateOnSolveItem) { eWardenObjectiveEventTrigger val2 = (eWardenObjectiveEventTrigger)0; eReactorStatus status = newState.status; switch (status - 7) { default: return; case 0: val2 = (eWardenObjectiveEventTrigger)1; break; case 1: val2 = (eWardenObjectiveEventTrigger)2; break; case 2: val2 = (eWardenObjectiveEventTrigger)3; break; } _ = __instance.SpawnNode.LayerType; WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val.EventsOnActivate, val2, false, 0f, (Il2CppStructArray)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("" + __instance.m_currentWaveData.VerificationTerminalSerial + "") }), (ePUIMessageStyle)3, false, "", ""); return false; } } [HarmonyPatch] internal class Patch_ReactorStartup_ExtraEventsExecution { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_ExecuteOnNoneEventsOnDefenseStart(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if (oldState.status != newState.status && (int)newState.status == 3) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)0, false, 0f, (Il2CppStructArray)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)null); }); } } } [HarmonyPatch] internal class Patch_ReactorStartup_OverwriteGUIBehaviour { private static HashSet ForceDisableLevels; [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static bool Pre_HideReactorMessageForInfiniteWave(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected I4, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if (oldState.status == newState.status) { return true; } if ((int)newState.status != 2 && (int)newState.status != 3 && (int)newState.status != 4) { return true; } if (ForceDisable()) { if (oldState.stateCount != newState.stateCount) { __instance.OnStateCountUpdate(newState.stateCount); } if (oldState.stateProgress != newState.stateProgress) { __instance.OnStateProgressUpdate(newState.stateProgress); } __instance.ReadyForVerification = false; eReactorStatus status = newState.status; switch (status - 2) { case 0: { WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorStartup_OverwriteGUIBehaviour: "); LegacyLogger.Error("Failed to get warden objective datablock"); break; } __instance.m_lightCollection.SetMode(val.LightsOnDuringIntro); __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_lightsBlinking = false; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.m_alarmCountdownPlayed = false; __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Warmup : __instance.m_currentWaveData.WarmupFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)1, false, 0f, (Il2CppStructArray)null); if (__instance.m_currentWaveCount == 1) { Debug.LogError(Object.op_Implicit("Reactor IDLE START")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_LOOP, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } else { Debug.LogError(Object.op_Implicit("Reactor REACTOR_POWER_DOWN")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_2_TO_1_TRANSITION, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } break; } case 1: __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_spawnEnemies = true; __instance.m_currentEnemyWaveIndex = 0; __instance.m_alarmCountdownPlayed = false; __instance.m_progressUpdateEnabled = true; __instance.m_currentDuration = __instance.m_currentWaveData.Wave; __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_TO_3_TRANSITION, true); break; case 2: __instance.m_lightCollection.ResetUpdateValues(false); __instance.lcReset = true; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.ReadyForVerification = true; Debug.Log(Object.op_Implicit("Wait for verify! newState.verifyFailed? " + newState.verifyFailed)); __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Verify : __instance.m_currentWaveData.VerifyFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)2, false, 0f, (Il2CppStructArray)null); break; } __instance.m_currentState = newState; return false; } return true; } private static bool ForceDisable() { return ForceDisableLevels.Contains(RundownManager.ActiveExpedition.LevelLayoutData); } static Patch_ReactorStartup_OverwriteGUIBehaviour() { ForceDisableLevels = new HashSet(); LevelLayoutDataBlock block = GameDataBlockBase.GetBlock("Legacy_L3E2_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase)(object)block).persistentID); } block = GameDataBlockBase.GetBlock("Legacy_L1E1_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase)(object)block).persistentID); } } } } namespace LEGACY.HardcodedBehaviours { [HarmonyPatch] internal class Patch_PickupItem_Hardcoded { [HarmonyPrefix] [HarmonyPatch(typeof(LG_Distribute_PickupItemsPerZone), "Build")] private static void Pre_LG_Distribute_PickupItemsPerZone(LG_Distribute_PickupItemsPerZone __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 LevelLayoutDataBlock block = GameDataBlockBase.GetBlock("LAYOUT_O4_1_L1"); if (block == null || RundownManager.ActiveExpedition.LevelLayoutData != ((GameDataBlockBase)(object)block).persistentID) { return; } eLocalZoneIndex localIndex = __instance.m_zone.LocalIndex; if ((int)localIndex != 1) { if ((int)localIndex == 5) { __instance.m_zonePlacementWeights.Start = 0f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 100000f; } } else if ((int)__instance.m_pickupType == 1) { __instance.m_zonePlacementWeights.Start = 100000f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 0f; } } } } namespace LEGACY.VanillaFix { [HarmonyPatch] internal class Patch_FixScoutFreeze { [HarmonyPrefix] [HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")] private static bool Prefix_Debug(ES_ScoutScream __instance) { if (((AgentAI)((ES_Base)__instance).m_ai).Target == null) { return false; } return true; } } [HarmonyPatch] internal class Patch_LG_SecurityDoor_Fix_EventsOnUnlockDoor_Powergenerator { [HarmonyPrefix] [HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")] private static void Pre_OnSyncDoorStatusChange(LG_SecurityDoor __instance, pDoorState state, bool isRecall) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 eDoorStatus status = state.status; if ((status - 4 <= 1 || (int)status == 9) && (int)__instance.m_lastState.status == 6 && !isRecall) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.LinkedToZoneData.EventsOnUnlockDoor, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray)null); } } } [HarmonyPatch] internal class Patch_LockSecurityDoor_FixCustomText { [HarmonyPostfix] [HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })] private static void Post_LG_SecurityDoor_Locks_Setup(LG_SecurityDoor door, LG_SecurityDoor_Locks __instance) { LocalizedText customText = door.LinkedToZoneData.ProgressionPuzzleToEnter.CustomText; __instance.m_lockedWithNoKeyInteractionText = customText; } } [HarmonyPatch] internal class Debugger { public static Debugger Current { get; private set; } = new Debugger(); public bool DEBUGGING { get; private set; } private Debugger() { } internal void Init() { _ = DEBUGGING; } private void f1(int k, out string v) { if (k < 2) { v = "2"; } v = null; } private void f2(int k, ref string v) { if (k < 2) { v = "2"; } } } } namespace LEGACY.Utils { public delegate float EasingFunction(float t, float b, float c, float d); public delegate bool BoolCheck(); internal static class CoroutineEase { [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 sourcePos; public Vector3 targetPos; public Action onDone; private bool 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !5__2) { 5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localPosition = Vector3.Lerp(sourcePos, targetPos, num); <>2__current = null; <>1__state = 1; return true; } trans.localPosition = targetPos; if (!5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 sourceEuler; public Vector3 targetEuler; public Action onDone; private bool 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !5__2) { 5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, num); <>2__current = null; <>1__state = 1; return true; } trans.localEulerAngles = targetEuler; if (!5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__0 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 startScale; public Vector3 targetScale; public Action onDone; private bool 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !5__2) { 5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localScale = Vector3.Lerp(startScale, targetScale, num); <>2__current = null; <>1__state = 1; return true; } trans.localScale = targetScale; if (!5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(d__0))] private static IEnumerator DoEaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(0) { trans = trans, startScale = startScale, targetScale = targetScale, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } [IteratorStateMachine(typeof(d__1))] private static IEnumerator DoEaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { trans = trans, sourcePos = sourcePos, targetPos = targetPos, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } [IteratorStateMachine(typeof(d__2))] private static IEnumerator DoEaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { trans = trans, sourceEuler = sourceEuler, targetEuler = targetEuler, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } internal static Coroutine EaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalScale(trans, startScale, targetScale, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalPos(trans, sourcePos, targetPos, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalRot(trans, sourceEuler, targetEuler, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } } public static class Helper { private static void ResetChild(iChainedPuzzleCore ICore) { CP_Bioscan_Core val = ((Il2CppObjectBase)ICore).TryCast(); if ((Object)(object)val != (Object)null) { ((Il2CppObjectBase)val.m_spline).Cast(); ((Il2CppObjectBase)val.PlayerScanner).Cast().ResetScanProgression(0f); val.Deactivate(); return; } CP_Cluster_Core val2 = ((Il2CppObjectBase)ICore).TryCast(); 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(); foreach (iChainedPuzzleCore item in (Il2CppArrayBase)(object)val2.m_childCores) { ResetChild(item); } val2.Deactivate(); } public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (chainedPuzzleInstance.Data.DisableSurvivalWaveOnComplete) { chainedPuzzleInstance.m_sound = new CellSoundPlayer(chainedPuzzleInstance.m_parent.position); } foreach (iChainedPuzzleCore item in (Il2CppArrayBase)(object)chainedPuzzleInstance.m_chainedPuzzleCores) { ResetChild(item); } if (SNet.IsMaster) { pChainedPuzzleState state = chainedPuzzleInstance.m_stateReplicator.State; pChainedPuzzleState val = default(pChainedPuzzleState); val.status = (eChainedPuzzleStatus)0; val.currentSurvivalWave_EventID = state.currentSurvivalWave_EventID; val.isSolved = false; val.isActive = false; pChainedPuzzleState val2 = val; chainedPuzzleInstance.m_stateReplicator.InteractWithState(val2, new pChainedPuzzleInteraction { type = (eChainedPuzzleInteraction)2 }); } } public static List ToManagedList(this List il2cppList) { List list = new List(); Enumerator enumerator = il2cppList.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list.Add(current); } return list; } public static bool TryGetComponent(this GameObject obj, out T comp) { comp = obj.GetComponent(); 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().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.GetBlock(num); List val = null; List terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone; int num2 = terminalsSpawnedInZone.IndexOf(terminal); ExpeditionZoneData val2 = null; Enumerator 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 val3 = null; TERM_Command val4 = (TERM_Command)0; Enumerator 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(); 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 cast(List list) { List list2 = new List(); Enumerator 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 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 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 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 areas = zone.m_areas; i < areas.Count; i++) { if (((Object)((Component)areas[i]).gameObject).GetInstanceID() == ((Object)((Component)current.m_courseNode.m_area).gameObject).GetInstanceID()) { if (num > i) { num = i; } break; } } } return num; } public static LG_ComputerTerminal FindTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, int terminalIndex) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = null; if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error($"FindTerminal: Didn't find LG_Zone {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (val.TerminalsSpawnedInZone == null || terminalIndex >= val.TerminalsSpawnedInZone.Count) { LegacyLogger.Error($"FindTerminal: Invalid terminal index {terminalIndex} - {((val.TerminalsSpawnedInZone != null) ? val.TerminalsSpawnedInZone.Count : 0)} terminals are spawned in {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (terminalIndex >= 0) { return val.TerminalsSpawnedInZone[terminalIndex]; } return null; } public static AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) AIG_GeomorphNodeVolume val = default(AIG_GeomorphNodeVolume); AIG_VoxelNodePillar val2 = default(AIG_VoxelNodePillar); AIG_INode val3 = default(AIG_INode); AIG_NodeCluster result = default(AIG_NodeCluster); if (!AIG_GeomorphNodeVolume.TryGetGeomorphVolume(0, dimensionIndex, position, ref val) || !((AIG_NodeVolume)val).m_voxelNodeVolume.TryGetPillar(position, ref val2) || !val2.TryGetVoxelNode(position.y, ref val3) || !AIG_NodeCluster.TryGetNodeCluster(val3.ClusterID, ref result)) { LegacyLogger.Error("TryWarpTo : Position is not valid, try again inside an area."); return null; } return result; } } internal static class Json { private static readonly JsonSerializerOptions _setting; static Json() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown _setting = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, IncludeFields = false, PropertyNameCaseInsensitive = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; _setting.Converters.Add(new JsonStringEnumConverter()); _setting.Converters.Add((JsonConverter)new LocalizedTextConverter()); } public static T Deserialize(string json) { return JsonSerializer.Deserialize(json, _setting); } public static object Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize(T value) { return JsonSerializer.Serialize(value, _setting); } public static void Load(string filePath, out T config) where T : new() { config = Deserialize(File.ReadAllText(filePath)); } } internal static class LegacyLogger { private static ManualLogSource logger = Logger.CreateLogSource("LEGACYCore"); public static void Log(string format, params object[] args) { Log(string.Format(format, args)); } public static void Log(string str) { if (logger != null) { logger.Log((LogLevel)8, (object)str); } } public static void Warning(string format, params object[] args) { Warning(string.Format(format, args)); } public static void Warning(string str) { if (logger != null) { logger.Log((LogLevel)4, (object)str); } } public static void Error(string format, params object[] args) { Error(string.Format(format, args)); } public static void Error(string str) { if (logger != null) { logger.Log((LogLevel)2, (object)str); } } public static void Debug(string format, params object[] args) { Debug(string.Format(format, args)); } public static void Debug(string str) { if (logger != null) { logger.Log((LogLevel)32, (object)str); } } } public class SpawnHibernateEnemiesEvent { public eWardenObjectiveEventTrigger Trigger { get; set; } public int Type { get; set; } = 170; public eDimensionIndex DimensionIndex { get; set; } public LG_LayerType Layer { get; set; } public eLocalZoneIndex LocalIndex { get; set; } public string WorldEventObjectFilter { get; set; } = "RANDOM"; public uint EnemyID { get; set; } public int Count { get; set; } = 1; public float Delay { get; set; } public float Duration { get; set; } = 2f; } public class WeightedAreaSelector { private static readonly Dictionary dict; private WeightedRandomBag 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 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(); } 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(); LevelAPI.OnLevelCleanup += dict.Clear; } } public class WeightedRandomBag { private struct Entry { public double accumulatedWeight; public T item; } private List entries = new List(); private double accumulatedWeight; private Random rand = new Random(); public void AddEntry(T item, double weight) { if (weight <= 0.0) { LegacyLogger.Error("AddEntry: no non-positive weight pls."); return; } accumulatedWeight += weight; entries.Add(new Entry { item = item, accumulatedWeight = accumulatedWeight }); } public T GetRandom() { double num = rand.NextDouble() * accumulatedWeight; foreach (Entry entry in entries) { if (entry.accumulatedWeight >= num) { return entry.item; } } return default(T); } } } namespace LEGACY.LegacyOverride { internal class NavMarkerManager { private Dictionary markerVisuals = new Dictionary(); private Dictionary navMarkers = new Dictionary(); private List arbitraryNavMarkers = new List(); public static NavMarkerManager Current { get; private set; } = new NavMarkerManager(); private GameObject InstantiateMarkerVisual() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate(Assets.ObjectiveMarker); float num = 0.16216217f; Transform transform = obj.transform; transform.localPosition += Vector3.up * num; return obj; } public void EnableMarkerAt(string markerName, GameObject target, float scale) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { NavMarker val = GuiManager.NavMarkerLayer.PrepareGenericMarker(target); if ((Object)(object)val != (Object)null) { val.SetColor(new Color(0.855f, 0.482f, 0.976f)); val.SetStyle((eNavMarkerStyle)14); val.SetVisible(true); navMarkers[markerName] = val; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } GameObject val2 = null; if (markerVisuals.ContainsKey(markerName)) { val2 = markerVisuals[markerName]; } else { val2 = InstantiateMarkerVisual(); val2.transform.localScale = new Vector3(scale, scale, scale); val2.transform.SetPositionAndRotation(target.transform.position, Quaternion.identity); markerVisuals[markerName] = val2; } CoroutineManager.BlinkIn(val2, 0f); LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } public void EnableArbitraryMarkerAt(string markerName, Vector3 Position) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { GameObject val = new GameObject(markerName); val.transform.SetPositionAndRotation(Position, Quaternion.identity); arbitraryNavMarkers.Add(val); NavMarker val2 = GuiManager.NavMarkerLayer.PrepareGenericMarker(val); if ((Object)(object)val2 != (Object)null) { val2.SetColor(new Color(0.855f, 0.482f, 0.976f)); val2.SetStyle((eNavMarkerStyle)14); val2.SetVisible(true); navMarkers[markerName] = val2; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } internal (GameObject markerVisual, NavMarker navMakrer) GetMarkerVisuals(string markerName) { if (!markerVisuals.TryGetValue(markerName, out var value) || !navMarkers.TryGetValue(markerName, out var value2)) { return (null, null); } return (value, value2); } public void DisableMakrer(string markerName) { if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(false); } if (markerVisuals.ContainsKey(markerName)) { GameObject val = markerVisuals[markerName]; if (val.active) { CoroutineManager.BlinkOut(val, 0f); } LegacyLogger.Debug("DisableMakrer: marker " + markerName + " disabled"); } } public void Clear() { foreach (GameObject value in markerVisuals.Values) { Object.Destroy((Object)(object)value); } arbitraryNavMarkers.ForEach((Action)Object.Destroy); markerVisuals.Clear(); navMarkers.Clear(); arbitraryNavMarkers.Clear(); } private NavMarkerManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } } internal static class LegacyOverrideManagers { internal static readonly string LEGACY_CONFIG_PATH = Path.Combine(MTFOPathAPI.CustomPath, "LegacyOverride"); internal static void Init() { ElevatorCargoOverrideManager.Current.Init(); BigPickupFogBeaconSettingManager.Current.Init(); EnemyTaggerSettingManager.Current.Init(); ForceFailManager.Current.Init(); ((GenericExpeditionDefinitionManager)ExpeditionIntelNotifier.Current).Init(); ((GenericExpeditionDefinitionManager)EventScanManager.Current).Init(); ((GenericExpeditionDefinitionManager)VisualManager.Current).Init(); ((GenericExpeditionDefinitionManager)MusicStateOverrider.Current).Init(); ((ZoneDefinitionManager)LevelSpawnedFogBeaconManager.Current).Init(); ((GenericExpeditionDefinitionManager)SuccessPageCustomizationManager.Current).Init(); ((GenericExpeditionDefinitionManager)ResourceStationManager.Current).Init(); } } } namespace LEGACY.LegacyOverride.ResourceStations { public sealed class ToolStation : ResourceStation { public override string ItemKey => $"Tool_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase.GetBlock("InGame.InteractionPrompt.ToolStation"); Interact.InteractionMessage = ((block == null) ? "TOOL STATION" : Text.Get(((GameDataBlockBase)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.Tool - ammoStorage.ClassAmmo.RelInPack, def.SupplyEfficiency.Tool)); player.GiveAmmoRel((PlayerAgent)null, 0f, 0f, num); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } public static ToolStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.TOOL) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate(Assets.ToolStation); return new ToolStation(def, gO); } private ToolStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static ToolStation() { } } public sealed class MediStation : ResourceStation { public const float VANILLA_MAX_HEALTH = 25f; public override string ItemKey => $"Health_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase.GetBlock("InGame.InteractionPrompt.MediStation"); Interact.InteractionMessage = ((block == null) ? "HEALTH STATION" : Text.Get(((GameDataBlockBase)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { float health = ((Dam_SyncedDamageBase)player.Damage).Health; float num = def.SupplyUplimit.Medi * 25f; if (!(health >= num)) { player.GiveHealth((PlayerAgent)null, Math.Min(def.SupplyEfficiency.Medi, (num - health) / 25f)); player.Sound.Post(EVENTS.MEDPACK_APPLY, true); } } public static MediStation Instantiate(ResourceStationDefinition def) { if (def.StationType != 0) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate(Assets.MediStation); return new MediStation(def, gO); } private MediStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static MediStation() { } } public abstract class ResourceStation { [CompilerGenerated] private sealed class d__61 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ResourceStation <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown int num = <>1__state; ResourceStation resourceStation = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } resourceStation.StationMarkerGO.SetActive(!resourceStation.StationMarkerGO.active); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const int UNLIMITED_USE_TIME = int.MaxValue; private Coroutine m_blinkMarkerCoroutine; public virtual GameObject GameObject { get; protected set; } public GameObject InteractGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(3)).gameObject : null) ?? null; } } public GameObject StationMarkerGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(2)).gameObject : null) ?? null; } } public virtual Interact_Timed Interact { get; protected set; } public virtual ResourceStationDefinition def { get; protected set; } public RSTimer Timer { get; protected set; } public StateReplicator StateReplicator { get; protected set; } public RSStateStruct State => StateReplicator?.State ?? new RSStateStruct(); public LG_GenericTerminalItem TerminalItem { get; protected set; } public AIG_CourseNode SpawnNode { get { return TerminalItem.SpawnNode; } set { TerminalItem.SpawnNode = value; } } protected int SerialNumber { get; private set; } public virtual string ItemKey => $"Resource_Station_{SerialNumber}"; public bool Enabled => State.Enabled; protected virtual bool InCooldown { get { if (State.RemainingUseTime <= 0) { return State.CurrentCooldownTime > 0f; } return false; } } public virtual bool HasUnlimitedUseTime => def.AllowedUseTimePerCooldown == int.MaxValue; public virtual void Destroy() { if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; } Object.Destroy((Object)(object)GameObject); StateReplicator?.Unload(); Interact = null; def = null; StateReplicator = null; } protected virtual bool CanInteract() { if (Enabled) { return !InCooldown; } return false; } protected abstract void Replenish(PlayerAgent player); protected virtual void SetInteractionText() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) string text = Text.Format(827u, (Object[])(object)new Object[1] { Object.op_Implicit(InputMapper.GetBindingName(((Interact_Base)Interact).InputAction)) }); TextDataBlock block = GameDataBlockBase.GetBlock("InGame.OnAdditionalInteractionText.ResourceStation"); string text2 = ((block == null) ? "TO REPLENISH" : Text.Get(((GameDataBlockBase)(object)block).persistentID)); string text3 = (HasUnlimitedUseTime ? string.Empty : $"({State.RemainingUseTime}/{def.AllowedUseTimePerCooldown})"); GuiManager.InteractionLayer.SetInteractPrompt(Interact.InteractionMessage, text + text2 + text3, (ePUIMessageStyle)0); } protected virtual void OnTriggerInteraction(PlayerAgent player) { RSStateStruct state = State; int num = (HasUnlimitedUseTime ? int.MaxValue : Math.Max(state.RemainingUseTime - 1, 0)); int num2 = player.Owner.PlayerSlotIndex(); if (num2 < 0 || num2 >= ((Il2CppArrayBase)(object)SNet.Slots.PlayerSlots).Count) { LegacyLogger.Error($"ResourceStation_OnTriggerInteraction: player {player.PlayerName} has invalid slot index: {num2}"); } else { StateReplicator?.SetState(new RSStateStruct { LastInteractedPlayer = num2, RemainingUseTime = num, CurrentCooldownTime = ((num == 0) ? def.CooldownTime : 0f), Enabled = true }); } } protected virtual void OnInteractionSelected(PlayerAgent agent, bool selected) { if (selected) { SetInteractionText(); } } protected virtual void SetupInteraction() { Interact.InteractDuration = def.InteractDuration; Interact_Timed interact = Interact; interact.ExternalPlayerCanInteract += Func.op_Implicit((Func)((PlayerAgent _) => CanInteract())); Interact_Timed interact2 = Interact; interact2.OnInteractionSelected += Action.op_Implicit((Action)OnInteractionSelected); Interact_Timed interact3 = Interact; interact3.OnInteractionTriggered += Action.op_Implicit((Action)OnTriggerInteraction); } protected virtual void SetupTerminalItem() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error("ResourceStation: Cannot find spawn node!"); return; } if (def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count) { LegacyLogger.Error("ResourceStation: Cannot find spawn node - Area index is invalid!"); return; } TerminalItem.Setup(ItemKey, val.m_areas[def.AreaIndex].m_courseNode); if (SpawnNode != null) { TerminalItem.FloorItemLocation = SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7); } TerminalItem.FloorItemStatus = (eFloorInventoryObjectStatus)0; } protected virtual void OnStateChanged(RSStateStruct oldState, RSStateStruct newState, bool isRecall) { if (isRecall) { return; } int lastInteractedPlayer = newState.LastInteractedPlayer; if (lastInteractedPlayer < 0 || lastInteractedPlayer >= ((Il2CppArrayBase)(object)SNet.Slots.PlayerSlots).Count) { return; } if (((Interact_Base)Interact).IsSelected) { SetInteractionText(); } if (!SNet.IsMaster) { return; } LegacyLogger.Warning($"ResourceStation OnStateChanged: replenish for player {lastInteractedPlayer}, remaining use time: {newState.RemainingUseTime}"); if (oldState.RemainingUseTime > 0) { SNet_Player playerInSlot = SNet.Slots.GetPlayerInSlot(lastInteractedPlayer); if ((Object)(object)playerInSlot != (Object)null) { Replenish(((Il2CppObjectBase)playerInSlot.m_playerAgent).Cast()); } else { LegacyLogger.Error($"playerSlot_{lastInteractedPlayer} has no player agent!"); } } if (newState.RemainingUseTime == 0) { LegacyLogger.Warning("ResourceStation OnStateChanged: cooldown timer starts!"); OnCoolDownStart(); } } protected virtual void OnCoolDownStart() { Timer.StartTimer(def.CooldownTime); if (m_blinkMarkerCoroutine == null) { m_blinkMarkerCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(BlinkMarker()), (Action)null); } } protected virtual void OnCoolDownTimerProgress(float progress) { } protected virtual void OnCoolDownEnd() { LegacyLogger.Warning("ResourceStation OnCoolDownEnd"); if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; StationMarkerGO.SetActive(true); } if (SNet.IsMaster) { LegacyLogger.Warning("ResourceStation OnCoolDownEnd: master reset state!"); StateReplicator.SetState(new RSStateStruct { LastInteractedPlayer = -1, RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = 0f, Enabled = true }); } } protected virtual void SetupReplicator() { if (StateReplicator == null) { uint num = EOSNetworking.AllotReplicatorID(); if (num == 0) { LegacyLogger.Error("ResourceStation: replicatorID depleted, cannot setup replicator!"); return; } StateReplicator = StateReplicator.Create(num, new RSStateStruct { RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = -1f, Enabled = true }, (LifeTimeType)1, (IStateReplicatorHolder)null); StateReplicator.OnStateChanged += OnStateChanged; } } protected virtual void SetupRSTimer() { if ((Object)(object)Timer == (Object)null) { Timer = RSTimer.Instantiate(OnCoolDownTimerProgress, OnCoolDownEnd); } } [IteratorStateMachine(typeof(d__61))] private IEnumerator BlinkMarker() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__61(0) { <>4__this = this }; } protected ResourceStation(ResourceStationDefinition def, GameObject GO) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) this.def = def; GameObject = GO; GameObject.transform.SetPositionAndRotation(def.Position.ToVector3(), def.Rotation.ToQuaternion()); Interact = InteractGO.GetComponent(); SerialNumber = SerialGenerator.GetUniqueSerialNo(); if ((Object)(object)Interact == (Object)null) { LegacyLogger.Error("ResourceStation: Interact Comp not found!"); } else { SetupInteraction(); } TerminalItem = GO.GetComponent(); if ((Object)(object)TerminalItem == (Object)null) { LegacyLogger.Error("ResourceStation: TerminalItem not found!"); } else { SetupTerminalItem(); } SetupReplicator(); SetupRSTimer(); } static ResourceStation() { } } public sealed class AmmoStation : ResourceStation { public override string ItemKey => $"Ammunition_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase.GetBlock("InGame.InteractionPrompt.AmmoStation"); Interact.InteractionMessage = ((block == null) ? "AMMUNITION STATION" : Text.Get(((GameDataBlockBase)(object)block).persistentID)); } public static AmmoStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.AMMO) { LegacyLogger.Error($"Trying to instantiate AmmoStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate(Assets.AmmoStation); return new AmmoStation(def, gO); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoStandard - ammoStorage.StandardAmmo.RelInPack, def.SupplyEfficiency.AmmoStandard)); float num2 = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoSpecial - ammoStorage.SpecialAmmo.RelInPack, def.SupplyEfficiency.AmmoSpecial)); player.GiveAmmoRel((PlayerAgent)null, num, num2, 0f); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } private AmmoStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static AmmoStation() { } } public enum StationType { MEDI, AMMO, TOOL } public class SupplyUplimit { public float Medi { get; set; } = 0.6f; public float AmmoStandard { get; set; } = 1f; public float AmmoSpecial { get; set; } = 1f; public float Tool { get; set; } } public class SupplyEfficiency { public float Medi { get; set; } = 0.2f; public float AmmoStandard { get; set; } = 0.15f; public float AmmoSpecial { get; set; } = 0.15f; public float Tool { get; set; } } public class ResourceStationDefinition : GlobalZoneIndex { public int AreaIndex { get; set; } public string WorldEventObjectFilter { get; set; } = string.Empty; public StationType StationType { get; set; } = StationType.AMMO; public Vec3 Position { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); public float InteractDuration { get; set; } = 2.5f; public SupplyEfficiency SupplyEfficiency { get; set; } = new SupplyEfficiency(); public SupplyUplimit SupplyUplimit { get; set; } = new SupplyUplimit(); public int AllowedUseTimePerCooldown { get; set; } = int.MaxValue; public float CooldownTime { get; set; } = 3f; } public class ResourceStationManager : GenericExpeditionDefinitionManager { public static ResourceStationManager Current { get; private set; } protected override string DEFINITION_NAME => "ResourceStation"; private Dictionary Stations { get; } = new Dictionary(); private void Build(ResourceStationDefinition def) { if (Stations.ContainsKey(def.WorldEventObjectFilter)) { LegacyLogger.Error("ResourceStationManager: WorldEventObjectFilter '" + def.WorldEventObjectFilter + "' is already used"); return; } ResourceStation resourceStation = null; switch (def.StationType) { case StationType.MEDI: resourceStation = MediStation.Instantiate(def); break; case StationType.AMMO: resourceStation = AmmoStation.Instantiate(def); break; case StationType.TOOL: resourceStation = ToolStation.Instantiate(def); break; default: LegacyLogger.Error($"ResourceStation {def.StationType} is unimplemented"); return; } if (resourceStation != null) { Stations[def.WorldEventObjectFilter] = resourceStation; LegacyLogger.Debug("ResourceStation '" + def.WorldEventObjectFilter + "' instantiated"); } } private void BuildStations() { if (base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value)) { value.Definitions.ForEach(Build); } } private void Clear() { foreach (ResourceStation value in Stations.Values) { value.Destroy(); } Stations.Clear(); } private ResourceStationManager() { LevelAPI.OnBuildStart += delegate { Clear(); }; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnBuildDone += BuildStations; } static ResourceStationManager() { Current = new ResourceStationManager(); } } public struct RSStateStruct { public int LastInteractedPlayer; public int RemainingUseTime; public float CurrentCooldownTime; public bool Enabled; public RSStateStruct() { LastInteractedPlayer = 0; RemainingUseTime = 0; CurrentCooldownTime = 0f; Enabled = false; } } public class RSTimer : MonoBehaviour { private float startTime; private float endTime; private bool hasOnGoingTimer; private Action OnProgress; private Action OnTimerEnd; public float RemainingTime { get { if (!hasOnGoingTimer) { return 0f; } return Math.Max(endTime - Clock.Time, 0f); } } private static List TimerGOs { get; } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName == 10 && hasOnGoingTimer) { float time = Clock.Time; if (OnProgress != null) { OnProgress((time - startTime) / (endTime - startTime)); } if (!(time < endTime)) { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd?.Invoke(); } } } public void StartTimer(float time) { if (time <= 0f) { LegacyLogger.Error("StartTimer: time is not positive!"); return; } if (hasOnGoingTimer) { LegacyLogger.Error("StartTimer: this timer is yet ended!"); return; } startTime = Clock.Time; endTime = startTime + time; hasOnGoingTimer = true; } private void OnDestroy() { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd = null; } public static RSTimer Instantiate(Action onProgress, Action actionOnEnd) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown GameObject val = new GameObject(); RSTimer rSTimer = val.AddComponent(); rSTimer.OnProgress = onProgress; rSTimer.OnTimerEnd = actionOnEnd; TimerGOs.Add(val); return rSTimer; } public static void DestroyAll() { TimerGOs.ForEach((Action)Object.Destroy); TimerGOs.Clear(); } private RSTimer() { } static RSTimer() { TimerGOs = new List(); ClassInjector.RegisterTypeInIl2Cpp(); LevelAPI.OnBuildStart += DestroyAll; LevelAPI.OnLevelCleanup += DestroyAll; } } } namespace LEGACY.LegacyOverride.EnemyTargeting { internal class EnemyTargetingPrioritizer : MonoBehaviour { public const float UPDATE_INTERVAL = 3f; private float nextUpdateTime = float.NaN; internal EnemyAgent enemy; private Dam_EnemyDamageBase damage { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return obj.Damage; } } private AgentTarget target { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return ((AgentAI)obj.AI).Target; } } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((int)GameStateManager.CurrentStateName != 10 || !SNet.IsMaster) { return; } if (float.IsNaN(nextUpdateTime)) { nextUpdateTime = Clock.Time + 3f; } else if (!(Clock.Time < nextUpdateTime) && !((Object)(object)enemy == (Object)null)) { nextUpdateTime = Clock.Time + 3f; if ((int)((AgentAI)enemy.AI).Mode == 1 && target != null && !(((Il2CppObjectBase)target.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) && PlayerManager.PlayerAgentsInLevel.Count > 1 && ((Agent)PlayerManager.PlayerAgentsInLevel[0]).CourseNode.m_dimension.DimensionIndex == ((Agent)enemy).CourseNode.m_dimension.DimensionIndex) { TryPrioritizeCloserTarget(); } } } internal void TryPrioritizeCloserTarget() { _ = target; Agent val = null; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (((Agent)current).Alive && ((Il2CppObjectBase)((Agent)current).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) { val = (Agent)(object)current; break; } } if ((Object)(object)val == (Object)null) { enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current2 = enumerator.Current; if (((Agent)current2).Alive && ((Il2CppObjectBase)((Agent)current2).CourseNode.m_zone).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode.m_zone).Pointer) { val = (Agent)(object)current2; break; } } } if ((Object)(object)val != (Object)null) { ((AgentAI)enemy.AI).SetTarget(val); } } private void OnDestroy() { enemy = null; } static EnemyTargetingPrioritizer() { ClassInjector.RegisterTypeInIl2Cpp(); } } } namespace LEGACY.LegacyOverride.Patches { [HarmonyPatch] internal static class ExpeditionSuccessPage { [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")] private static void Post_CM_PageExpeditionSuccess_OnEnable(CM_PageExpeditionSuccess __instance) { if (!((Object)(object)__instance == (Object)null)) { SuccessPageCustomization currentCustomization = SuccessPageCustomizationManager.Current.CurrentCustomization; if (currentCustomization != null) { ((TMP_Text)__instance.m_header).SetText(LocalizedText.op_Implicit(currentCustomization.PageHeader), true); __instance.m_overrideSuccessMusic = currentCustomization.OverrideSuccessMusic; LegacyLogger.Warning("Post_CM_PageExpeditionSuccess_OnEnable: " + ((Object)currentCustomization.PageHeader).ToString()); } } } } [HarmonyPatch] internal static class LevelSpawnFogBeacon_BugFix { [HarmonyPostfix] [HarmonyPatch(typeof(HeavyFogRepellerGlobalState), "AttemptInteract")] private static void Post_HeavyFogRepellerGlobalState_AttemptInteract(HeavyFogRepellerGlobalState __instance) { LevelSpawnedFogBeaconSettings lSFBDef = LevelSpawnedFogBeaconManager.Current.GetLSFBDef(__instance); if (lSFBDef != null) { __instance.m_repellerSphere.Range = lSFBDef.Range; } } } [HarmonyPatch] internal class PrioritizeEnemyTargeting { private static bool s_patch = true; [HarmonyPostfix] [HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")] private static void UpdateTracking(EnemyCourseNavigation __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 if (!s_patch) { return; } int count = PlayerManager.PlayerAgentsInLevel.Count; if (!SNet.IsMaster || count <= 1) { return; } EnemyAgent owner = __instance.m_owner; if ((int)((StateMachine)(object)owner.Locomotion).m_currentState.m_stateEnum == 14 || ((Il2CppObjectBase)__instance.m_targetRef.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { return; } PlayerAgent val = null; int num = Random.RandomRangeInt(0, count); for (int i = 0; i < count; i++) { PlayerAgent val2 = PlayerManager.PlayerAgentsInLevel[num]; if (((Agent)val2).Alive && ((Il2CppObjectBase)((Agent)val2).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { val = val2; break; } num = (num + 1) % count; } if ((Object)(object)val != (Object)null) { s_patch = false; ((AgentAI)owner.AI).SetTarget((Agent)(object)val); s_patch = true; } } } [HarmonyPatch] internal class RundownSelectionCustomization { [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CM_PageRundown_New p; public bool hosting; public Transform guixSurfaceTransform; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Expected O, but got Unknown //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Expected O, but got Unknown //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Expected O, but got Unknown //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Expected O, but got Unknown //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Expected O, but got Unknown //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Expected O, but got Unknown //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = p.m_tierSpacing * 5f * p.m_tierSpaceToArrowScale; if (hosting) { CoroutineManager.BlinkIn(p.m_buttonConnect, 0f, (Transform)null); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } goto IL_00ed; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.24f); <>1__state = 2; return true; case 2: <>1__state = -1; ((RectTransformComp)p.m_buttonConnect).SetVisible(false); goto IL_00ed; case 3: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 4; return true; case 4: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_SHRINK, ""); CoroutineEase.EaseLocalScale(p.m_textRundownHeader.transform, Vector3.one, new Vector3(0.6f, 0.6f, 0.6f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>2__current = CoroutineEase.EaseLocalScale(guixSurfaceTransform, Vector3.one, new Vector3(0.2f, 0.2f, 0.2f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 6; return true; case 6: <>1__state = -1; CoroutineEase.EaseLocalPos(p.m_textRundownHeader.transform, p.m_textRundownHeader.transform.localPosition, p.m_rundownHeaderPos, 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); CoroutineManager.BlinkIn(p.m_rundownIntelButton, 0f, (Transform)null); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 7; return true; case 7: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_TURN, ""); <>2__current = CoroutineEase.EaseLocalRot(guixSurfaceTransform, Vector3.zero, new Vector3(70f, 0f, 0f), 0.3f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 8; return true; case 8: <>1__state = -1; p.m_verticalArrow.SetActive(true); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 9; return true; case 9: <>1__state = -1; CoroutineManager.BlinkIn(((Component)p.m_tierMarkerSectorSummary).gameObject, 0f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 10; return true; case 10: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_START, ""); CoroutineEase.EaseLocalScale(p.m_verticalArrow.transform, new Vector3(1f, 0f, 1f), new Vector3(1f, 5__2, 1f), 4.3f, (EasingFunction)Easing.LinearTween, (Action)delegate { CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_STOP, ""); }, (BoolCheck)null); 5__3 = 0.6f; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 11; return true; case 11: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_3, ""); ((Component)p.m_guix_Tier3).gameObject.SetActive(true); for (int k = 0; k < p.m_expIconsTier3.Count; k++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier3[k]).gameObject, (float)k * 0.1f); } if (p.m_expIconsTier3.Count > 0) { p.m_tierMarker3.SetVisible(true, 5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 12; return true; } case 12: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); ((Component)p.m_guix_Tier5).gameObject.SetActive(true); for (int i = 0; i < p.m_expIconsTier5.Count; i++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier5[i]).gameObject, (float)i * 0.1f); } if (p.m_expIconsTier5.Count > 0) { p.m_tierMarker5.SetVisible(true, 5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 13; return true; } case 13: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_4, ""); ((Component)p.m_guix_Tier4).gameObject.SetActive(true); for (int m = 0; m < p.m_expIconsTier4.Count; m++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier4[m]).gameObject, (float)m * 0.1f); } if (p.m_expIconsTier4.Count > 0) { p.m_tierMarker4.SetVisible(true, 5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 14; return true; } case 14: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_2, ""); ((Component)p.m_guix_Tier2).gameObject.SetActive(true); for (int l = 0; l < p.m_expIconsTier2.Count; l++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier2[l]).gameObject, (float)l * 0.1f); } if (p.m_expIconsTier2.Count > 0) { p.m_tierMarker2.SetVisible(true, 5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 15; return true; } case 15: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_1, ""); ((Component)p.m_guix_Tier1).gameObject.SetActive(true); for (int j = 0; j < p.m_expIconsTier1.Count; j++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier1[j]).gameObject, (float)j * 0.1f); } if (p.m_expIconsTier1.Count > 0) { p.m_tierMarker1.SetVisible(true, 5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 16; return true; } case 16: { <>1__state = -1; ((Component)p.m_joinOnServerIdText).gameObject.SetActive(true); CoroutineManager.BlinkIn(p.m_aboutTheRundownButton, 0f, (Transform)null); CoroutineManager.BlinkIn(p.m_discordButton, 0.1f, (Transform)null); if (SNet.IsMaster || !SNet.IsInLobby) { CoroutineManager.BlinkIn(p.m_matchmakeAllButton, 0.2f, (Transform)null); } p.m_selectionIsRevealed = true; p.CheckClipboard(); return false; } IL_00ed: CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_MOVE_UP, ""); <>2__current = CoroutineEase.EaseLocalPos(guixSurfaceTransform, Vector3.zero, new Vector3(0f, 650f, 0f), 0.5f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static uint r1TitleID; private static uint r2TitleID; [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageRundown_New), "Setup")] private static void Post_CM_PageRundown_New(CM_PageRundown_New __instance) { //IL_003f: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) GameSetupDataBlock block = GameDataBlockBase.GetBlock(1u); if (block.RundownIdsToLoad.Count > 1 && block.RundownIdsToLoad.Count == 2) { ((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions)[0] = new Vector3(-320f, 75f, 0f); ((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions)[1] = new Vector3(320f, 0f, 0f); Vector3 zero = Vector3.zero; for (int i = block.RundownIdsToLoad.Count; i < ((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions).Count; i++) { zero = ((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions)[i]; ((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions)[i] = new Vector3(zero.x, -10000f, zero.z); } zero = __instance.m_textRundownHeaderTop.transform.position; __instance.m_textRundownHeaderTop.transform.position = new Vector3(zero.x, -350f, zero.z); } } private static void SetSelectionScale(CM_PageRundown_New p) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) GameSetupDataBlock block = GameDataBlockBase.GetBlock(1u); if (block.RundownIdsToLoad.Count > 1 && block.RundownIdsToLoad.Count == 2) { CM_RundownSelection obj = p.m_rundownSelections[0]; CM_RundownSelection val = p.m_rundownSelections[1]; ((Component)obj).transform.localScale = new Vector3(2f, 2f, 2f) * 1.625f; ((Component)val).transform.localScale = new Vector3(1.25f, 1.25f, 1.25f) * 1.5f; Transform transform = obj.m_rundownText.transform; Quaternion localRotation = (val.m_rundownText.transform.localRotation = Quaternion.AngleAxis(45f, Vector3.right)); transform.localRotation = localRotation; obj.m_rundownText.transform.localPosition = Vector3.up * 60f + Vector3.right * 20f; val.m_rundownText.transform.localPosition = Vector3.up * 85f + Vector3.left * 25f; Transform transform2 = ((Component)obj).transform; localRotation = (((Component)val).transform.localRotation = Quaternion.AngleAxis(-45f, Vector3.right)); transform2.localRotation = localRotation; ((TMP_Text)obj.m_rundownText).text = ((r1TitleID != 0) ? Text.Get(r1TitleID) : "[ LEGACY ]"); ((TMP_Text)val.m_rundownText).text = ((r2TitleID != 0) ? Text.Get(r2TitleID) : "[ L-OMNI ]"); DestroyAltText(obj); DestroyAltText(val); } static void DestroyAltText(CM_RundownSelection s) { if ((Object)(object)s.m_altText != (Object)null) { Object.Destroy((Object)(object)((Component)s.m_altText).gameObject); s.m_altText = null; } } } [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageRundown_New), "UpdateRundownSelectionButton")] private static void Post_UpdateRundownSelectionButton(CM_PageRundown_New __instance) { InitTitle(); SetSelectionScale(__instance); } private static void InitTitle() { if (r1TitleID == 0) { TextDataBlock block = GameDataBlockBase.GetBlock("LEGACY_Title"); if (block != null) { r1TitleID = ((GameDataBlockBase)(object)block).persistentID; } block = GameDataBlockBase.GetBlock("LEGACY-Omni_Title"); if (block != null) { r2TitleID = ((GameDataBlockBase)(object)block).persistentID; } } } [IteratorStateMachine(typeof(d__6))] private static IEnumerator reverseReveal(CM_PageRundown_New p, bool hosting, Transform guixSurfaceTransform) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0) { p = p, hosting = hosting, guixSurfaceTransform = guixSurfaceTransform }; } } [HarmonyPatch] internal class DisableExpeditionFailPageArtifactDisplay { private class CustomExpeditionFailedSequence { [CompilerGenerated] private sealed class d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CustomExpeditionFailedSequence <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Expected O, but got Unknown int num = <>1__state; CustomExpeditionFailedSequence customExpeditionFailedSequence = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; ((Component)customExpeditionFailedSequence.page.m_bgCortex_text).gameObject.SetActive(false); customExpeditionFailedSequence.page.m_bgCortex_textBoxSmall.SetActive(false); customExpeditionFailedSequence.page.m_bgCortex_textBoxLarge.SetActive(false); ((Component)customExpeditionFailedSequence.page.m_returnToLobby_text).gameObject.SetActive(false); CM_PageBase.PostSound(EVENTS.PLAY_01_FIRST_TEXT_APPEAR, ""); <>2__current = CoroutineManager.BlinkIn(customExpeditionFailedSequence.page.m_bgCortex_logo, 0f); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 3; return true; case 3: <>1__state = -1; CM_PageBase.PostSound(EVENTS.PLAY_01_FIRST_TEXT_APPEAR, ""); <>2__current = CoroutineManager.BlinkIn(customExpeditionFailedSequence.page.m_bgCortex_text, 0f, (Transform)null); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.4f); <>1__state = 5; return true; case 5: <>1__state = -1; CoroutineManager.BlinkIn(customExpeditionFailedSequence.page.m_bgCortex_textBoxSmall, 0f); CoroutineManager.BlinkIn(customExpeditionFailedSequence.page.m_bgCortex_textBoxLarge, 0.15f); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = CoroutineManager.BlinkOut(customExpeditionFailedSequence.page.m_bgCortex_textBoxLarge, 0f); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = CoroutineManager.BlinkOut(customExpeditionFailedSequence.page.m_bgCortex_textBoxSmall, 0f); <>1__state = 8; return true; case 8: <>1__state = -1; ((Component)customExpeditionFailedSequence.page.m_bgCortex_text).gameObject.SetActive(false); <>2__current = CoroutineManager.BlinkOut(customExpeditionFailedSequence.page.m_bgCortex_logo, 0f); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 10; return true; case 10: <>1__state = -1; CM_PageBase.PostSound(EVENTS.PLAY_06_MAIN_MENU_LAUNCH, ""); ((Component)customExpeditionFailedSequence.page.m_bgScare).gameObject.SetActive(true); customExpeditionFailedSequence.page.m_bgScare.Play(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 11; return true; case 11: <>1__state = -1; ((Component)customExpeditionFailedSequence.page.m_bgScare).gameObject.SetActive(false); <>2__current = CoroutineManager.BlinkIn(((Component)customExpeditionFailedSequence.page.m_missionFailed_text).gameObject, 0f); <>1__state = 12; return true; case 12: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 13; return true; case 13: <>1__state = -1; <>2__current = CoroutineManager.BlinkIn(((Component)customExpeditionFailedSequence.page.m_returnToLobby_text).gameObject, 0f); <>1__state = 14; return true; case 14: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private CM_PageExpeditionFail page; public CustomExpeditionFailedSequence(CM_PageExpeditionFail page) { this.page = page; } [IteratorStateMachine(typeof(d__2))] public IEnumerator CustomFailedSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { <>4__this = this }; } } [HarmonyPrefix] [HarmonyPatch(typeof(CM_PageExpeditionFail), "OnEnable")] private static bool Pre_CM_PageExpeditionFail(CM_PageExpeditionFail __instance) { if (((CM_PageBase)__instance).m_isSetup) { CellSound.StopAll(); CellSound.AllSoundsStoppedThisSession = true; CM_PageBase.PostSound(EVENTS.MUSIC_EXPEDITION_FAILED, ""); ((RectTransformComp)__instance.m_ArtifactInventoryDisplay).Setup(); __instance.m_ArtifactInventoryDisplay.SetArtifactValuesFromInventory(BoosterImplantManager.ArtifactInventory); ((Component)__instance.m_missionFailed_text).gameObject.SetActive(false); ((Component)__instance.m_artifactInfo_text).gameObject.SetActive(false); __instance.m_btnRestartCheckpoint.SetText(Text.Get(916u)); if (SNet.IsMaster) { __instance.m_btnRestartCheckpoint.SetButtonEnabled(true); __instance.m_btnGoToLobby.SetButtonEnabled(true); __instance.m_btnGoToLobby.SetText(Text.Get(917u)); } else { __instance.m_btnRestartCheckpoint.SetButtonEnabled(false); __instance.m_btnGoToLobby.SetButtonEnabled(false); __instance.m_btnGoToLobby.SetText(Text.Get(918u)); } ((Component)__instance.m_btnGoToLobby).gameObject.SetActive(false); ((Component)__instance.m_btnRestartCheckpoint).gameObject.SetActive(false); __instance.m_lobbyButtonVisible = false; __instance.m_showLobbybuttonTimer = Clock.Time + 3f; ((RectTransformComp)__instance.m_ArtifactInventoryDisplay).SetVisible(false); ((CM_PageBase)__instance).StartPageTransitionRoutine(CollectionExtensions.WrapToIl2Cpp(new CustomExpeditionFailedSequence(__instance).CustomFailedSequence())); } return false; } } [HarmonyPatch] internal class SetupBigPickupItemWithItemId { 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(); val.InfiniteDuration = false; val.LifeDuration = 99999f; val.GrowDuration = 99999f; val.ShrinkDuration = 99999f; val.Range = 1f; BigPickupFogBeaconSetting setting = BigPickupFogBeaconSettingManager.Current.SettingForCurrentLevel; FogRepeller_Sphere fogRepHold = new GameObject("FogInstance_Beacon_SmallLayer").AddComponent(); 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(); 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(); HeavyFogRepellerPickup val2 = ((Il2CppObjectBase)componentInChildren).Cast(); 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(); ((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_Timed)interact).InteractDuration = setting.TimeToPickup; val5.CallbackOnStateChange += Action.op_Implicit((Action)delegate(pCarryItemWithGlobalState_State oldState, pCarryItemWithGlobalState_State newState, bool isRecall) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (isRecall) { FogRepeller_Sphere obj = fogRepHold; if (obj != null) { obj.KillRepellerInstantly(); } FogRepeller_Sphere obj2 = fogRepPlaced; if (obj2 != null) { obj2.KillRepellerInstantly(); } } else { eHeavyFogRepellerStatus val6 = (eHeavyFogRepellerStatus)newState.status; if ((int)val6 != 1) { if ((int)val6 == 2) { FogRepeller_Sphere obj3 = fogRepHold; if (obj3 != null) { obj3.StopRepelling(); } FogRepeller_Sphere obj4 = fogRepPlaced; if (obj4 != null) { obj4.StartRepelling(); } ((Interact_Timed)interact).InteractDuration = setting.TimeToPickup; } } else { FogRepeller_Sphere obj5 = fogRepHold; if (obj5 != null) { obj5.StartRepelling(); } if (oldState.status != 0) { FogRepeller_Sphere obj6 = fogRepPlaced; if (obj6 != null) { obj6.StopRepelling(); } } ((Interact_Timed)interact).InteractDuration = setting.TimeToPlace; } } }); } [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: case 236u: case 237u: EnemyTaggerSettingManager.Current.SetupAsObserver(__instance); break; } } static SetupBigPickupItemWithItemId() { } } [HarmonyPatch] internal class 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; } } } } namespace LEGACY.LegacyOverride.Music { public class MusicOverride { public string WorldEventObjectFilter { get; set; } = string.Empty; public uint StartID { get; set; } public uint StopID { get; set; } public uint VolumeRTPC { get; set; } public float Duration { get; set; } = -1f; public MusicOverride() { } public MusicOverride(string MusicName, uint StartID, uint StopID, uint VolumeRTPC, float Duration = -1f) { WorldEventObjectFilter = MusicName; this.StartID = StartID; this.StopID = StopID; this.VolumeRTPC = VolumeRTPC; this.Duration = Duration; } } public class MusicStateOverrider : GenericExpeditionDefinitionManager { public const uint DEF_ID = 0u; public const int MAX_PLAYING_MUSIC_COUNT = 5; private Dictionary musicStartID = new Dictionary(); private HashSet musicPlaying = new HashSet(); public static MusicStateOverrider Current { get; private set; } = new MusicStateOverrider(); protected override string DEFINITION_NAME => "MusicState"; private CellSoundPlayer Sound => MusicManager.Current.m_machine.Sound; public bool MCSStateLocked { get; internal set; } private Dictionary Musics { get; } = new Dictionary(); public StateReplicator StateReplicator { get; private set; } internal void PlayMusic(string worldEventObjectFilter) { if (musicPlaying.Count >= 5) { LegacyLogger.Error("PlayMusic: There're 5 music playing now, cannot start playing more!"); return; } if (!Musics.ContainsKey(worldEventObjectFilter)) { LegacyLogger.Error("Music " + worldEventObjectFilter + " is not config-ed."); return; } if (musicPlaying.Contains(worldEventObjectFilter)) { LegacyLogger.Error("Music " + worldEventObjectFilter + " is already playing"); return; } DoPlayMusic(worldEventObjectFilter); LegacyLogger.Debug("Play music " + worldEventObjectFilter); } private void DoPlayMusic(string worldEventObjectFilter) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) musicPlaying.Add(worldEventObjectFilter); MusicOverride musicOverride = Musics[worldEventObjectFilter]; Sound.Post(musicOverride.StartID, true); CellSound.SetGlobalRTPCValue(musicOverride.VolumeRTPC, CellSettingsManager.SettingsData.Audio.MusicVolume.Value * 100f); MusicManager.Current.m_machine.ChangeState((MUS_State)14); if (SNet.IsMaster) { MusicSyncStruct state = new MusicSyncStruct(StateReplicator.State); if (state.Id0 == 0) { state.Id0 = musicOverride.StartID; } else if (state.Id1 == 0) { state.Id1 = musicOverride.StartID; } else if (state.Id2 == 0) { state.Id2 = musicOverride.StartID; } else if (state.Id3 == 0) { state.Id3 = musicOverride.StartID; } else if (state.Id4 == 0) { state.Id4 = musicOverride.StartID; } StateReplicator.SetState(state); } } internal void StopMusic(string worldEventObjectFilter) { if (!Musics.ContainsKey(worldEventObjectFilter)) { LegacyLogger.Error("Music " + worldEventObjectFilter + " is not config-ed."); return; } if (!musicPlaying.Contains(worldEventObjectFilter)) { LegacyLogger.Error("Music " + worldEventObjectFilter + " is not playing"); return; } DoStopMusic(worldEventObjectFilter); LegacyLogger.Debug("Stop music " + worldEventObjectFilter); } private void DoStopMusic(string worldEventObjectFilter) { musicPlaying.Remove(worldEventObjectFilter); MusicOverride musicOverride = Musics[worldEventObjectFilter]; Sound.Post(musicOverride.StopID, true); if (SNet.IsMaster) { MusicSyncStruct state = new MusicSyncStruct(StateReplicator.State); if (state.Id0 == musicOverride.StartID) { state.Id0 = 0u; } if (state.Id1 == musicOverride.StartID) { state.Id1 = 0u; } if (state.Id2 == musicOverride.StartID) { state.Id2 = 0u; } if (state.Id3 == musicOverride.StartID) { state.Id3 = 0u; } if (state.Id4 == musicOverride.StartID) { state.Id4 = 0u; } StateReplicator.SetState(state); } } public bool ShouldOverrideMusicState(MUS_State currentState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName != 10) { return false; } return musicPlaying.Count > 0; } internal void OnApplicationFocus(bool focus) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) float num = (focus ? CellSettingsManager.SettingsData.Audio.MusicVolume.Value : 0f); foreach (string item in musicPlaying) { CellSound.SetGlobalRTPCValue(Musics[item].VolumeRTPC, num * 100f); } } internal void OnMusicVolumeSettingChange() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) foreach (string item in musicPlaying) { CellSound.SetGlobalRTPCValue(Musics[item].VolumeRTPC, CellSettingsManager.SettingsData.Audio.MusicVolume.Value * 100f); } } private void UpdateOverrideSetting() { if (!base.definitions.ContainsKey(0u)) { LegacyLogger.Error($"Didn't find global definition, ('MainLevelLayout' {0})"); return; } Musics.Clear(); foreach (MusicOverride definition in base.definitions[0u].Definitions) { string worldEventObjectFilter = definition.WorldEventObjectFilter; if (worldEventObjectFilter != null && worldEventObjectFilter.Length == 0) { LegacyLogger.Debug("WorldEventObjectFilter(Music name) unspecified, won't load"); continue; } if (definition.StartID == 0) { LegacyLogger.Debug("StartID unspecified (could not be 0)"); continue; } if (definition.StopID == 0) { LegacyLogger.Error("StopID == 0: MusicStateOverrider doesn't implement un-looped sound!"); } Musics[definition.WorldEventObjectFilter] = definition; musicStartID[definition.StartID] = definition; } } protected override void FileChanged(LiveEditEventArgs e) { base.FileChanged(e); UpdateOverrideSetting(); } private void Reset() { MCSStateLocked = false; musicPlaying.Clear(); } private void OnStateChanged(MusicSyncStruct oldState, MusicSyncStruct newState, bool isRecall) { if (isRecall) { Reset(); TryPlay(newState.Id0); TryPlay(newState.Id1); TryPlay(newState.Id2); TryPlay(newState.Id3); TryPlay(newState.Id4); } void TryPlay(uint StartID) { if (StartID != 0 && musicStartID.TryGetValue(StartID, out var value)) { PlayMusic(value.WorldEventObjectFilter); } } } public override void Init() { base.Init(); EventAPI.OnAssetsLoaded += delegate { if (StateReplicator == null) { uint num = EOSNetworking.AllotForeverReplicatorID(); if (num == 0) { LegacyLogger.Error("PlayMusic: failed to setup state replicator!"); } StateReplicator = StateReplicator.Create(num, new MusicSyncStruct(), (LifeTimeType)0, (IStateReplicatorHolder)null); StateReplicator.OnStateChanged += OnStateChanged; } }; } private MusicStateOverrider() { UpdateOverrideSetting(); LevelAPI.OnBuildStart += Reset; LevelAPI.OnLevelCleanup += Reset; } } public struct MusicSyncStruct { public uint Id0; public uint Id1; public uint Id2; public uint Id3; public uint Id4; public MusicSyncStruct() { Id0 = 0u; Id1 = 0u; Id2 = 0u; Id3 = 0u; Id4 = 0u; } public MusicSyncStruct(MusicSyncStruct o) { Id0 = o.Id0; Id1 = o.Id1; Id2 = o.Id2; Id3 = o.Id3; Id4 = o.Id4; } } [HarmonyPatch] internal class Patches { [HarmonyPrefix] [HarmonyPatch(typeof(MusicMachine), "ChangeState")] private static bool Pre_MusicMachine_ChangeState(MusicMachine __instance, ref MUS_State state) { if (MusicStateOverrider.Current.ShouldOverrideMusicState(state)) { if (MusicStateOverrider.Current.MCSStateLocked) { return false; } LegacyLogger.Debug("Music State overriden and locked"); state = (MUS_State)14; MusicStateOverrider.Current.MCSStateLocked = true; return true; } if (MusicStateOverrider.Current.MCSStateLocked) { LegacyLogger.Debug("Music State un-overriden"); } MusicStateOverrider.Current.MCSStateLocked = false; return true; } [HarmonyPostfix] [HarmonyPatch(typeof(CellSettingsManager), "OnApplicationFocus")] private static void Post_OnApplicationFocus(CellSettingsManager __instance, bool focus) { MusicStateOverrider.Current.OnApplicationFocus(focus); } [HarmonyPostfix] [HarmonyPatch(typeof(CellSettings_Audio), "ApplyAllValues")] private static void Post_ApplyAllValues(CellSettingsManager __instance) { MusicStateOverrider.Current.OnMusicVolumeSettingChange(); } } } namespace LEGACY.LegacyOverride.GearFunctions { [HarmonyPatch] internal static class Patch_BulletWeapon { private static uint GLUE_GUN_PID = 400u; [HarmonyPostfix] [HarmonyPatch(typeof(BulletWeapon), "Fire")] private static void Post_BulletHit(BulletWeapon __instance) { //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) if (((GameDataBlockBase)(object)((ItemEquippable)__instance).ArchetypeData).persistentID != GLUE_GUN_PID) { return; } RaycastHit rayHit = Weapon.s_weaponRayData.rayHit; GameObject gameObject = ((Component)((RaycastHit)(ref rayHit)).collider).gameObject; if ((Object)(object)gameObject == (Object)null) { return; } IDamageable val = null; BulletWeapon.s_tempColliderInfo = gameObject.GetComponent(); if ((Object)(object)BulletWeapon.s_tempColliderInfo != (Object)null) { val = BulletWeapon.s_tempColliderInfo.Damageable; } if (val == null) { val = gameObject.GetComponent(); } if (val != null) { Agent baseAgent = val.GetBaseAgent(); EnemyAgent val2 = ((baseAgent != null) ? ((Il2CppObjectBase)baseAgent).TryCast() : null); if ((Object)(object)val2 != (Object)null && val2.Damage.AttachedGlueRel < 1f) { val.GlueDamage(100f); } } } } } namespace LEGACY.LegacyOverride.ExpeditionIntelNotification { public class ExpeditionIntel { public bool BlinkInContent { get; set; } = true; public float BlinkTimeInterval { get; set; } = 0.2f; public LocalizedText Header { get; set; } public LocalizedText Text { get; set; } } public class ExpeditionIntelNotifier : GenericExpeditionDefinitionManager { public static ExpeditionIntelNotifier Current { get; private set; } private Random rand { get; } = new Random(); protected override string DEFINITION_NAME => "ExpeditionIntel"; private void ShowIntelForExpedition(ExpeditionIntel intel) { //IL_0000: 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_0011: 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_002e: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown GlobalPopupMessageManager.ShowPopup(new PopupMessage { BlinkInContent = intel.BlinkInContent, BlinkTimeInterval = intel.BlinkTimeInterval, Header = LocalizedText.op_Implicit(intel.Header), UpperText = LocalizedText.op_Implicit(intel.Text), PopupType = (PopupType)3, OnCloseCallback = Action.op_Implicit((Action)delegate { }) }); } internal void OnLevelSelected(ExpeditionInTierData expData) { if (base.definitions.ContainsKey(expData.LevelLayoutData) && base.definitions[expData.LevelLayoutData].Definitions.Count > 0) { List definitions = base.definitions[expData.LevelLayoutData].Definitions; ShowIntelForExpedition(definitions[rand.Next(0, definitions.Count)]); LegacyLogger.Warning("ShowIntelForExpedition"); } } private ExpeditionIntelNotifier() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown LevelAPI.OnLevelSelected += (LevelSelectedEvent)delegate(eRundownTier _, int _, ExpeditionInTierData e) { OnLevelSelected(e); }; } static ExpeditionIntelNotifier() { Current = new ExpeditionIntelNotifier(); } } } namespace LEGACY.LegacyOverride.ForceFail { public class FFPlayerGroup { public const int MAX_PLAYER_CNT = 4; private List isPlayerInGroup = new List(); private StateReplicator stateReplicator; public bool enabled { get; private set; } public ImmutableList IsPlayerInGroup => isPlayerInGroup.ToImmutableList(); public bool PlayerInGroup(int playerSlotIndex) { if (playerSlotIndex < 0 || playerSlotIndex >= 4) { LegacyLogger.Error($"Invalid player slot index, should be in [0, {4}), but got {playerSlotIndex}"); return false; } return isPlayerInGroup[playerSlotIndex]; } public int NumPlayersInGroup() { return isPlayerInGroup.Sum((bool b) => b ? 1 : 0); } public void Toggle(bool enabled) { this.enabled = enabled; Sync(); } public void SetPlayerInGroup(int playerSlotIndex, bool inGroup) { if (playerSlotIndex < 0 || playerSlotIndex >= 4) { LegacyLogger.Error($"Invalid player slot index, should be in [0, {4}), but got {playerSlotIndex}"); return; } int num = NumPlayersInGroup(); isPlayerInGroup[playerSlotIndex] = inGroup; int num2 = NumPlayersInGroup(); if (num == 0 && num2 > 0) { enabled = true; } else if (num > 0 && num2 == 0) { enabled = false; } Sync(); } public void ResetSynced() { Reset(); Sync(); } public void ResetUnsynced() { Reset(); stateReplicator.SetStateUnsynced(GetSyncStruct()); } private void Reset() { enabled = false; for (int i = 0; i < isPlayerInGroup.Count; i++) { isPlayerInGroup[i] = false; } } private void Sync() { stateReplicator.SetState(GetSyncStruct()); } private void OnStateChanged(FFReplicationStruct oldState, FFReplicationStruct newState, bool isRecall) { if (isRecall) { enabled = newState.enabled; isPlayerInGroup[0] = newState.checkP1; isPlayerInGroup[1] = newState.checkP2; isPlayerInGroup[2] = newState.checkP3; isPlayerInGroup[3] = newState.checkP4; } } internal FFReplicationStruct GetSyncStruct() { FFReplicationStruct result = new FFReplicationStruct(); result.enabled = enabled; result.checkP1 = isPlayerInGroup[0]; result.checkP2 = isPlayerInGroup[1]; result.checkP3 = isPlayerInGroup[2]; result.checkP4 = isPlayerInGroup[3]; return result; } internal static FFPlayerGroup Instantiate() { uint num = EOSNetworking.AllotForeverReplicatorID(); if (num == 0) { LegacyLogger.Error("ForceFailManager: cannot instantiate replicator - id depleted"); return null; } FFPlayerGroup fFPlayerGroup = new FFPlayerGroup(); fFPlayerGroup.stateReplicator = StateReplicator.Create(num, new FFReplicationStruct(), (LifeTimeType)0, (IStateReplicatorHolder)null); fFPlayerGroup.stateReplicator.OnStateChanged += fFPlayerGroup.OnStateChanged; fFPlayerGroup.Setup(); return fFPlayerGroup; } private void Setup() { for (int i = 0; i < 4; i++) { isPlayerInGroup.Add(item: false); } LevelAPI.OnBuildStart += ResetUnsynced; LevelAPI.OnLevelCleanup += ResetUnsynced; } private FFPlayerGroup() { } } public struct FFReplicationStruct { public bool enabled; public bool checkP1; public bool checkP2; public bool checkP3; public bool checkP4; public FFReplicationStruct() { enabled = false; checkP1 = false; checkP2 = false; checkP3 = false; checkP4 = false; } public FFReplicationStruct(FFReplicationStruct o) { enabled = false; checkP1 = false; checkP2 = false; checkP3 = false; checkP4 = false; o.enabled = enabled; o.checkP1 = checkP1; o.checkP2 = checkP2; o.checkP3 = checkP3; o.checkP4 = checkP4; } public FFReplicationStruct(bool enabled, bool checkP1, bool checkP2, bool checkP3, bool checkP4) { this.enabled = false; this.checkP1 = false; this.checkP2 = false; this.checkP3 = false; this.checkP4 = false; this.enabled = enabled; this.checkP1 = checkP1; this.checkP2 = checkP2; this.checkP3 = checkP3; this.checkP4 = checkP4; } } public class ForceFailManager { public const int MAX_FF_GROUP_CNT = 4; private List playerGroups = new List(); public static ForceFailManager Current { get; private set; } public void AddPlayerToGroup(int playerSlotIndex, int checkGroupIndex) { if (checkGroupIndex < 0 || checkGroupIndex >= playerGroups.Count) { LegacyLogger.Error($"FFManager: check group index should be non-negative and less than {playerGroups.Count} - got {checkGroupIndex}"); } else { playerGroups[checkGroupIndex].SetPlayerInGroup(playerSlotIndex, inGroup: true); } } public void ResetSynced() { playerGroups.ForEach(delegate(FFPlayerGroup pg) { pg.ResetSynced(); }); } public void ResetUnSynced() { playerGroups.ForEach(delegate(FFPlayerGroup pg) { pg.ResetUnsynced(); }); } public void ResetGroupSynced(int groupIndex) { if (groupIndex < 0 || groupIndex >= playerGroups.Count) { LegacyLogger.Error($"FFManager: check group index should be non-negative and less than {playerGroups.Count} - got {groupIndex}"); } else { playerGroups[groupIndex].ResetSynced(); } } public void ToggleCheck(bool enabled) { playerGroups.ForEach(delegate(FFPlayerGroup pg) { pg.Toggle(enabled); }); } public bool IsCheckEnabled() { foreach (FFPlayerGroup playerGroup in playerGroups) { if (playerGroup.enabled && playerGroup.NumPlayersInGroup() > 0) { return true; } } return false; } public bool ToggleCheckOnGroup(int groupIndex, bool enabled) { if (groupIndex < 0 || groupIndex >= playerGroups.Count) { LegacyLogger.Error($"FFManager: group index should be non-negative and less than {playerGroups.Count} - got {groupIndex}"); return false; } playerGroups[groupIndex].Toggle(enabled); return true; } public void SetExpeditionFailedText(string text) { ((TMP_Text)MainMenuGuiLayer.Current.PageExpeditionFail.m_missionFailed_text).SetText(text, true); } public void ResetExpeditionFailedText() { string text = Text.Get(962u); ((TMP_Text)MainMenuGuiLayer.Current.PageExpeditionFail.m_missionFailed_text).SetText(text, true); } internal bool CheckLevelForceFailed() { bool result = false; foreach (FFPlayerGroup playerGroup in playerGroups) { if (!playerGroup.enabled) { continue; } bool flag = false; int num = 0; Enumerator enumerator2 = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator2.MoveNext()) { PlayerAgent current2 = enumerator2.Current; if (playerGroup.PlayerInGroup(current2.PlayerSlotIndex)) { flag = ((Agent)current2).Alive || flag; num++; } } if (flag) { if (num != playerGroup.NumPlayersInGroup()) { result = true; break; } continue; } result = true; break; } return result; } public void Init() { } private void Setup() { for (int i = 0; i < 4; i++) { FFPlayerGroup fFPlayerGroup = FFPlayerGroup.Instantiate(); if (fFPlayerGroup != null) { playerGroups.Add(fFPlayerGroup); continue; } LegacyLogger.Error($"Instantiated player group num: {playerGroups.Count}"); break; } } private ForceFailManager() { LevelAPI.OnBuildStart += ResetUnSynced; LevelAPI.OnLevelCleanup += ResetUnSynced; LevelAPI.OnBuildStart += ResetExpeditionFailedText; LevelAPI.OnBuildDone += ResetExpeditionFailedText; EventAPI.OnManagersSetup += Setup; } static ForceFailManager() { Current = new ForceFailManager(); } } } namespace LEGACY.LegacyOverride.FogBeacon { public class LevelSpawnedFogBeacon { public static uint LSFB_ITEM_DB_ID { get; private set; } public static bool HasFogBeaconItemDBDefinition => LSFB_ITEM_DB_ID != 0; public string WorldEventObjectFilter => def?.WorldEventObjectFilter ?? string.Empty; public LevelSpawnedFogBeaconSettings def { get; private set; } public HeavyFogRepellerGlobalState GlobalState { get; private set; } public LG_PickupItem LG_PickupItem { get; private set; } public NavMarker NavMarker { get; private set; } public Vector3 Position { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) LG_PickupItem lG_PickupItem = LG_PickupItem; if (lG_PickupItem == null) { return Vector3.zero; } return ((Component)lG_PickupItem).transform.position; } } public Color NAV_MARKER_COLOR { get; } = new Color(1f, 0.75686276f, 0.14509805f); public static LevelSpawnedFogBeacon Instantiate(eDimensionIndex dimensionIndex, LG_LayerType layer, eLocalZoneIndex localIndex, LevelSpawnedFogBeaconSettings def) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0063: Unknown result type (might be due to invalid IL or missing references) if (!HasFogBeaconItemDBDefinition) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: ItemDatablock Definition of vanilla Fog Repeller Turbine is not found..."); return null; } LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layer, localIndex, ref val) || (Object)(object)val == (Object)null || def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count) { LegacyLogger.Error($"LevelSpawnedFogBeacon: cannot find {(dimensionIndex, layer, localIndex)}, Area_{(ushort)(65 + def.AreaIndex)}"); return null; } AIG_CourseNode courseNode = val.m_areas[def.AreaIndex].m_courseNode; return new LevelSpawnedFogBeacon(def, courseNode) { def = def }; } internal void Destroy() { Object.Destroy((Object)(object)((Component)LG_PickupItem.m_root).gameObject); GlobalState = null; LG_PickupItem = null; def = null; } private LevelSpawnedFogBeacon(LevelSpawnedFogBeaconSettings def, AIG_CourseNode node) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) this.def = def; GameObject val = new GameObject($"LSBF_{def.WorldEventObjectFilter}-Area_{(ushort)(65 + def.AreaIndex)}"); val.transform.SetPositionAndRotation(def.Position.ToVector3(), Quaternion.identity); LG_PickupItem = LG_PickupItem.SpawnGenericPickupItem(val.transform); LG_PickupItem.SpawnNode = node; int count = ((Il2CppArrayBase>)(object)CarryItemWithGlobalStateManager.Current.m_carryItemGlobalStatesInstancesPerType)[0].Count; LG_PickupItem.SetupAsBigPickupItem(1, LSFB_ITEM_DB_ID, false, -1); CarryItemPickup_Core componentInChildren = ((Component)LG_PickupItem.m_root).GetComponentInChildren(); LG_PickupItem_Sync val2 = ((Il2CppObjectBase)componentInChildren.m_sync).Cast(); if ((Object)(object)val2 != (Object)null) { pPickupItemState state = val2.m_stateReplicator.State; ((pCourseNode)(ref state.placement.node)).Set(LG_PickupItem.SpawnNode); } ((Component)((Il2CppObjectBase)componentInChildren.m_interact).Cast()).gameObject.SetActive(false); iTerminalItem componentInChildren2 = ((Component)LG_PickupItem).GetComponentInChildren(); if (componentInChildren2 != null) { LG_LevelInteractionManager.DeregisterTerminalItem(componentInChildren2); } NavMarker = GuiManager.NavMarkerLayer.PrepareGenericMarker(((Component)LG_PickupItem).gameObject); if ((Object)(object)NavMarker != (Object)null) { NavMarker.SetColor(NAV_MARKER_COLOR); NavMarker.SetStyle((eNavMarkerStyle)14); NavMarker.SetVisible(false); } iCarryItemWithGlobalState val3 = default(iCarryItemWithGlobalState); if (!CarryItemWithGlobalStateManager.TryGetItemInstance((eCarryItemWithGlobalStateType)0, (byte)count, ref val3)) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: Didn't find GlobalState of '" + def.WorldEventObjectFilter + "'"); return; } GlobalState = ((Il2CppObjectBase)val3).Cast(); FogRepeller_Sphere repellerSphere = GlobalState.m_repellerSphere; repellerSphere.GrowDuration = def.GrowDuration; repellerSphere.ShrinkDuration = def.ShrinkDuration; repellerSphere.Range = def.Range; HeavyFogRepellerGlobalState globalState = GlobalState; globalState.CallbackOnStateChange += Action.op_Implicit((Action)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_0019: Expected I4, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0070: Expected O, but got Unknown eHeavyFogRepellerStatus val4 = (eHeavyFogRepellerStatus)newState.status; switch ((int)val4) { case 0: case 2: NavMarker.SetVisible(false); break; case 1: NavMarker.SetVisible(true); if (isRecall) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(new WardenObjectiveEventData { Type = (eWardenObjectiveEventType)222, WorldEventObjectFilter = WorldEventObjectFilter, Enabled = true, Delay = 1.1f }, (eWardenObjectiveEventTrigger)0, true, 0f); } break; } }); } private static void FindFogTurbineItemDBID() { if (!HasFogBeaconItemDBDefinition) { LSFB_ITEM_DB_ID = ((GameDataBlockBase)(object)GameDataBlockBase.GetBlock("Carry_HeavyFogRepeller"))?.persistentID ?? 0; if (LSFB_ITEM_DB_ID == 0) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: ItemDatablock Definition of vanilla Fog Repeller Turbine is not found..."); } } } static LevelSpawnedFogBeacon() { FindFogTurbineItemDBID(); LevelAPI.OnBuildStart += FindFogTurbineItemDBID; } } public class LevelSpawnedFogBeaconSettings { public int AreaIndex { get; set; } public float GrowDuration { get; set; } = 10f; public float ShrinkDuration { get; set; } = 10f; public float Range { get; set; } = 11f; public string WorldEventObjectFilter { get; set; } = string.Empty; public Vec3 Position { get; set; } = new Vec3(); } public class LevelSpawnedFogBeaconDefinition : GlobalZoneIndex { public List SpawnedBeaconsInZone { get; set; } = new List { new LevelSpawnedFogBeaconSettings() }; } public class LevelSpawnedFogBeaconManager : ZoneDefinitionManager { private Dictionary LSFBGlobalStatesSet = new Dictionary(); public static LevelSpawnedFogBeaconManager Current { get; } private Dictionary LevelSpawnedFogBeacons { get; } = new Dictionary(); protected override string DEFINITION_NAME => "LevelSpawnedFogBeacon"; private void Build(LevelSpawnedFogBeaconDefinition def) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) foreach (LevelSpawnedFogBeaconSettings item in def.SpawnedBeaconsInZone) { if (item.WorldEventObjectFilter == null || item.WorldEventObjectFilter == string.Empty || LevelSpawnedFogBeacons.ContainsKey(item.WorldEventObjectFilter)) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: WorldEventObjectFilter '" + item.WorldEventObjectFilter + "' is either unassigned or has already been assigned."); continue; } LevelSpawnedFogBeacon levelSpawnedFogBeacon = LevelSpawnedFogBeacon.Instantiate(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, item); if (levelSpawnedFogBeacon != null) { LevelSpawnedFogBeacons[item.WorldEventObjectFilter] = levelSpawnedFogBeacon; LSFBGlobalStatesSet[((Il2CppObjectBase)levelSpawnedFogBeacon.GlobalState).Pointer] = item; LegacyLogger.Debug($"LevelSpawnedFogBeaconManager: spawned '{item.WorldEventObjectFilter}' in {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}, Area_{(ushort)(65 + item.AreaIndex)}"); } } } internal LevelSpawnedFogBeaconSettings GetLSFBDef(HeavyFogRepellerGlobalState h) { if (!LSFBGlobalStatesSet.TryGetValue(((Il2CppObjectBase)h).Pointer, out var value)) { return null; } return value; } public void ToggleLSFBState(string worldEventgObjectFilter, bool enable) { //IL_0035: 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_0054: 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_005e: Unknown result type (might be due to invalid IL or missing references) if (!LevelSpawnedFogBeacons.TryGetValue(worldEventgObjectFilter, out var value)) { LegacyLogger.Error("ToggleLSFBState: '" + worldEventgObjectFilter + "' is not defined"); } else if (SNet.IsMaster) { value.GlobalState.AttemptInteract(new pCarryItemWithGlobalState_Interaction { type = (byte)((!enable) ? 1 : 0), owner = (eCarryItemWithGlobalStateOwner)2, staticPosition = value.Position }); } } private void Clear() { foreach (LevelSpawnedFogBeacon value in LevelSpawnedFogBeacons.Values) { value.Destroy(); } LSFBGlobalStatesSet.Clear(); LevelSpawnedFogBeacons.Clear(); } private void BuildLevelSpawnedFogBeacons() { if (base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { base.definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions.ForEach(Build); } } private LevelSpawnedFogBeaconManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnBuildDone += BuildLevelSpawnedFogBeacons; } static LevelSpawnedFogBeaconManager() { Current = new LevelSpawnedFogBeaconManager(); } } 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 BigPickupFogBeaconSetting { 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 BigPickupFogBeaconSettingManager { private Dictionary fogBeaconSettings = new Dictionary(); private LiveEditListener liveEditListener; private static readonly string CONFIG_PATH; public static readonly BigPickupFogBeaconSetting DEDFAULT_SETTING; public static BigPickupFogBeaconSettingManager Current { get; private set; } internal BigPickupFogBeaconSetting SettingForCurrentLevel { get; private set; } = DEDFAULT_SETTING; private void AddOverride(BigPickupFogBeaconSetting _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 BigPickupFogBeaconSetting())); streamWriter.Flush(); streamWriter.Close(); return; } foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories)) { Json.Load(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)delegate(string content) { BigPickupFogBeaconSetting @override = Json.Deserialize(content); AddOverride(@override); if (GameStateManager.IsInExpedition) { UpdateSetting(); } }); } private void UpdateSetting() { uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData; SettingForCurrentLevel = (fogBeaconSettings.ContainsKey(levelLayoutData) ? fogBeaconSettings[levelLayoutData] : DEDFAULT_SETTING); LegacyLogger.Debug($"FogBeaconSettingManager: updated setting for level with main level layout id {levelLayoutData}"); } private BigPickupFogBeaconSettingManager() { } static BigPickupFogBeaconSettingManager() { CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "FogBeaconSetting"); DEDFAULT_SETTING = new BigPickupFogBeaconSetting(); Current = new BigPickupFogBeaconSettingManager(); } } } namespace LEGACY.LegacyOverride.ExpeditionSuccessPage { public struct StateSync { public int index; public StateSync() { index = 0; } } public class SuccessPageCustomization { public string WorldEventObjectFilter { get; set; } = string.Empty; public LocalizedText PageHeader { get; set; } public uint OverrideSuccessMusic { get; set; } public bool SetAsDefaultCustomization { get; set; } } public class SuccessPageCustomizationManager : GenericExpeditionDefinitionManager { public static SuccessPageCustomizationManager Current { get; } private StateReplicator StateReplicator { get; set; } protected override string DEFINITION_NAME => "ExpeditionSuccessPage"; public SuccessPageCustomization CurrentCustomization { get; private set; } public void ApplyCustomization(string WorldEventObjectFilter) { if (!base.definitions.ContainsKey(base.CurrentMainLevelLayout)) { LegacyLogger.Error($"SuccessPageCustomization: definition not found for main level layout {base.CurrentMainLevelLayout}"); return; } List definitions = base.definitions[base.CurrentMainLevelLayout].Definitions; int num = definitions.FindIndex((SuccessPageCustomization def) => def.WorldEventObjectFilter.Equals(WorldEventObjectFilter)); if (num == -1) { LegacyLogger.Error("SuccessPageCustomization: customization WorldEventObjectFilter '" + WorldEventObjectFilter + "' is not found"); return; } CurrentCustomization = definitions[num]; LegacyLogger.Debug("SuccessPageCustomization: customization with WorldEventObjectFilter '" + WorldEventObjectFilter + "' applied"); if (SNet.IsMaster) { StateReplicator?.SetState(new StateSync { index = num }); } } private void SetDefaultCustomization() { if (!base.definitions.ContainsKey(base.CurrentMainLevelLayout)) { LegacyLogger.Error($"SuccessPageCustomization: definition not found for main level layout {base.CurrentMainLevelLayout}"); return; } List definitions = base.definitions[base.CurrentMainLevelLayout].Definitions; int num = definitions.FindIndex((SuccessPageCustomization def) => def.SetAsDefaultCustomization); if (num != -1) { CurrentCustomization = definitions[num]; LegacyLogger.Debug("SuccessPageCustomization: default customization with WorldEventObjectFilter '" + CurrentCustomization.WorldEventObjectFilter + "' applied"); if (SNet.IsMaster) { StateReplicator?.SetState(new StateSync { index = num }); } } } private void OnStateChanged(StateSync oldState, StateSync newState, bool isRecall) { if (isRecall && base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value) && 0 <= newState.index && newState.index < value.Definitions.Count) { CurrentCustomization = value.Definitions[newState.index]; } } private void Clear() { CurrentCustomization = null; } private SuccessPageCustomizationManager() { LevelAPI.OnEnterLevel += SetDefaultCustomization; LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; EventAPI.OnAssetsLoaded += delegate { uint num = EOSNetworking.AllotForeverReplicatorID(); if (num == 0) { LegacyLogger.Error("SuccessPageCustomizationManager: Cannot allot replicator!"); } else { StateReplicator = StateReplicator.Create(num, new StateSync { index = 0 }, (LifeTimeType)0, (IStateReplicatorHolder)null); StateReplicator.OnStateChanged += OnStateChanged; } }; } static SuccessPageCustomizationManager() { Current = new SuccessPageCustomizationManager(); } } } namespace LEGACY.LegacyOverride.EventScan { internal class EventScanComponent : MonoBehaviour { public const float UPDATE_INTERVAL = 0.3f; public const string VANILLA_CP_PREFAB_PATH = "Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_sustained_RequireAll.prefab"; private float time = float.NaN; private float m_colorLerpDelta; private const float LERP_DURATION = 0.5f; public GameObject Cylinder => ((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(0)).gameObject; public GameObject Visual => ((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(1)).gameObject; public GameObject Information => ((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(2)).gameObject; public GameObject TextMeshProGO => ((Component)Information.transform.GetChild(0)).gameObject; public Renderer VisualRenderer { get; private set; } public TextMeshPro DisplayText { get; private set; } private Vector3 Position => ((Component)this).gameObject.transform.position; public StateReplicator StateReplicator { get; private set; } public EventScanDefinition def { get; internal set; } public Color Color_Waiting { get; private set; } public Color Color_Active { get; private set; } public void Setup() { //IL_0029: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) if (def == null) { LegacyLogger.Error("EventScan Setup: assign a EventScanDefinition before calling Setup()!"); return; } ((Component)this).gameObject.transform.SetPositionAndRotation(def.Position.ToVector3(), Quaternion.identity); ((Component)this).gameObject.SetActiveRecursively(true); GameObject loadedAsset = AssetAPI.GetLoadedAsset("Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_sustained_RequireAll.prefab"); if ((Object)(object)loadedAsset != (Object)null) { GameObject val = Object.Instantiate(((Component)loadedAsset.transform.GetChild(0).GetChild(1)).gameObject.gameObject); val.transform.SetParent(((Component)this).gameObject.transform, false); val.transform.localScale = new Vector3(1f / def.Radius, 1f / def.Radius, 1f / def.Radius); DisplayText = val.GetComponentInChildren(); if ((Object)(object)DisplayText != (Object)null) { ((TMP_Text)DisplayText).SetText(LocalizedText.op_Implicit(def.DisplayText), true); ((TMP_Text)DisplayText).ForceMeshUpdate(false, false); } else { LegacyLogger.Error("EventScan: instantiation error - cannot find TMPPro from vanilla CP!"); } } else { LegacyLogger.Error("EventScan: instantiation error - cannot instantiate vanilla CP!"); } Vec3 waiting = def.ColorSetting.Waiting; Vec3 active = def.ColorSetting.Active; Color_Waiting = new Color(waiting.x, waiting.y, waiting.z); Color_Active = new Color(active.x, active.y, active.z); float num = 0.16216217f; ((Component)this).gameObject.transform.localScale = new Vector3(def.Radius, def.Radius, def.Radius); Transform transform = ((Component)this).gameObject.transform; transform.localPosition += Vector3.up * num; VisualRenderer = Visual.gameObject.GetComponentInChildren(); VisualRenderer.material.SetColor("_ColorA", Color_Waiting); uint num2 = EOSNetworking.AllotReplicatorID(); if (num2 == 0) { LegacyLogger.Error("EventScan: Replicator ID depleted, cannot setup"); return; } StateReplicator = StateReplicator.Create(num2, new EventScanStatus { Status = EventScanState.Waiting }, (LifeTimeType)1, (IStateReplicatorHolder)null); StateReplicator.OnStateChanged += OnStateChange; } private void OnStateChange(EventScanStatus oldState, EventScanStatus newState, bool isRecall) { LegacyLogger.Warning($"EventScan: {oldState.Status} => {newState.Status}"); switch (newState.Status) { case EventScanState.Disabled: { m_colorLerpDelta = 0f; TextMeshPro displayText2 = DisplayText; if (displayText2 != null) { ((Component)displayText2).gameObject.SetActive(false); } Cylinder.SetActive(false); CoroutineManager.BlinkOut(Visual, 0f); break; } case EventScanState.Waiting: if (!Visual.active) { CoroutineManager.BlinkIn(Visual, 0f); Cylinder.SetActive(true); TextMeshPro displayText3 = DisplayText; if (displayText3 != null) { ((Component)displayText3).gameObject.SetActive(true); } } if (!isRecall && oldState.Status == EventScanState.Active) { def.EventsOnDeactivate.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); } break; case EventScanState.Active: if (!Visual.active) { CoroutineManager.BlinkIn(Visual, 0f); Cylinder.SetActive(true); TextMeshPro displayText = DisplayText; if (displayText != null) { ((Component)displayText).gameObject.SetActive(true); } } if (!isRecall && oldState.Status == EventScanState.Waiting) { def.EventsOnActivate.ForEach(delegate(WardenObjectiveEventData e) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f); }); } break; } } public void ChangeToState(EventScanState newState) { ChangedToStateUnsynced(newState); if (SNet.IsMaster) { StateReplicator.SetState(new EventScanStatus { Status = newState }); } } private void ChangedToStateUnsynced(EventScanState newState) { } private void Update() { //IL_003c: 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_0057: 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_006d: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Invalid comparison between Unknown and I4 //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) EventScanState status = StateReplicator.State.Status; if (status == EventScanState.Disabled) { return; } float num = Clock.Delta / 0.5f; if (status == EventScanState.Waiting) { num = 0f - num; } m_colorLerpDelta = Mathf.Clamp01(m_colorLerpDelta + num); Color val = Color.Lerp(Color_Waiting, Color_Active, Mathf.Pow(m_colorLerpDelta, 5f)); VisualRenderer.sharedMaterial.SetColor("_ColorA", val); if (!float.IsNaN(time) && Clock.Time < time + 0.3f) { return; } time = Clock.Time + 0.3f; if (def.ActiveCondition.RequiredPlayerCount == 0 && def.ActiveCondition.RequiredBigPickupIndices.Count == 0) { return; } bool flag = false; bool flag2 = false; Vector3 val2; if (def.ActiveCondition.RequiredPlayerCount > 0) { int num2 = 0; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; val2 = Position - ((Agent)current).Position; if (((Vector3)(ref val2)).magnitude < def.Radius) { num2++; if (num2 >= def.ActiveCondition.RequiredPlayerCount) { flag = true; break; } } } } else { flag = true; } if (flag) { List requiredBigPickupIndices = def.ActiveCondition.RequiredBigPickupIndices; if (requiredBigPickupIndices.Count > 0) { int num3 = 0; foreach (int item in requiredBigPickupIndices) { CarryItemPickup_Core bigPickupItem = PuzzleReqItemManager.Current.GetBigPickupItem(item); if ((Object)(object)bigPickupItem == (Object)null) { num3++; continue; } pPickupItemState currentState = bigPickupItem.m_sync.GetCurrentState(); Vector3 zero = Vector3.zero; ePickupItemStatus status2 = currentState.status; if ((int)status2 != 0) { if ((int)status2 != 1) { LegacyLogger.Error($"Item has invalid state: {currentState.status}"); continue; } zero = ((Component)bigPickupItem.PickedUpByPlayer).transform.position; } else { zero = ((Component)bigPickupItem).transform.position; } val2 = Position - zero; if (((Vector3)(ref val2)).magnitude < def.Radius) { num3++; } } flag2 = num3 >= requiredBigPickupIndices.Count; } else { flag2 = true; } } switch (status) { case EventScanState.Waiting: if (flag && flag2) { ChangeToState(EventScanState.Active); } break; case EventScanState.Active: if (!flag || !flag2) { ChangeToState(EventScanState.Waiting); } break; } } private void OnDestroy() { def = null; VisualRenderer = null; DisplayText = null; StateReplicator = null; } static EventScanComponent() { ClassInjector.RegisterTypeInIl2Cpp(); } } public class ColorSetting { public Vec3 Waiting { get; set; } = new Vec3 { x = 0.5294f, y = 0.8078f, z = 0.9215f }; public Vec3 Active { get; set; } = new Vec3 { x = 1f, y = 0.7529f, z = 0.145f }; } public class ActiveCondition { public int RequiredPlayerCount { get; set; } public List RequiredBigPickupIndices { get; set; } = new List(); } public class EventScanDefinition { public string WorldEventObjectFilter { get; set; } = string.Empty; public Vec3 Position { get; set; } = new Vec3(); public float Radius { get; set; } = 3.2f; public ColorSetting ColorSetting { get; set; } = new ColorSetting(); public LocalizedText DisplayText { get; set; } public ActiveCondition ActiveCondition { get; set; } = new ActiveCondition(); public List EventsOnActivate { get; set; } = new List(); public List EventsOnDeactivate { get; set; } = new List(); } internal class EventScanManager : GenericExpeditionDefinitionManager { private Dictionary> eventScans = new Dictionary>(); public static EventScanManager Current { get; private set; } protected override string DEFINITION_NAME => "EventScan"; private void BuildEventScan(EventScanDefinition def) { //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) if (!(def.Position.ToVector3() == Vector3.zero)) { EventScanComponent eventScanComponent = Object.Instantiate(Assets.EventScan).AddComponent(); eventScanComponent.def = def; eventScanComponent.Setup(); List list = null; if (eventScans.ContainsKey(def.WorldEventObjectFilter)) { list = eventScans[def.WorldEventObjectFilter]; } else { list = new List(); eventScans[def.WorldEventObjectFilter] = list; } list.Add(eventScanComponent); } } public void ToggleEventScanState(string WorldEventObjectFilter, bool active = true) { if (!eventScans.ContainsKey(WorldEventObjectFilter)) { LegacyLogger.Error("ToggleEventScanState: " + WorldEventObjectFilter + " does not correspond to any event scans!"); return; } foreach (EventScanComponent item in eventScans[WorldEventObjectFilter]) { if (!active && item.StateReplicator.State.Status != 0) { item.ChangeToState(EventScanState.Disabled); } else if (active && item.StateReplicator.State.Status == EventScanState.Disabled) { item.ChangeToState(EventScanState.Waiting); } } } private void Build() { if (base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { base.definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions.ForEach(BuildEventScan); } } private void Clear() { foreach (List value in eventScans.Values) { foreach (EventScanComponent item in value) { Object.Destroy((Object)(object)((Component)item).gameObject); } } eventScans.Clear(); } static EventScanManager() { Current = new EventScanManager(); } private EventScanManager() { LevelAPI.OnBuildDone += Build; LevelAPI.OnLevelCleanup += Clear; } } public enum EventScanState { Disabled, Waiting, Active } public struct EventScanStatus { public EventScanState Status; } } namespace LEGACY.LegacyOverride.EnemyTagger { public enum eEnemyTaggerState { Uninitialized, Inactive, Active_Warmup, Active_Tagging } public class EnemyTaggerComponent : MonoBehaviour { private const float INACTIVE_SOUND_UPDATE_INTERVAL = 4f; 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 TaggableEnemies = new List(); 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 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); } } UpdateTime = 0f; } private void StopTagging() { if (UpdateTime >= 4f) { 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; } static EnemyTaggerComponent() { ClassInjector.RegisterTypeInIl2Cpp(); } } 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; } public bool UseVisual { get; set; } } internal class EnemyTaggerSettingManager { public static readonly EnemyTaggerSettingManager Current; private Dictionary enemyTaggerSettingSettings = new Dictionary(); private LiveEditListener liveEditListener; private static readonly string CONFIG_PATH; private static readonly EnemyTaggerSetting DEFAULT; private List obsVisuals = new List(); internal EnemyTaggerSetting SettingForCurrentLevel { get; private set; } = DEFAULT; public IEnumerable OBSVisuals => obsVisuals; 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_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 EnemyTaggerSetting())); streamWriter.Flush(); streamWriter.Close(); return; } foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories)) { Json.Load(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)delegate(string content) { EnemyTaggerSetting @override = Json.Deserialize(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}"); } public void SetupAsObserver(LG_PickupItem __instance) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) EnemyTaggerSetting setting = SettingForCurrentLevel; CarryItemPickup_Core core = ((Component)__instance.m_root).GetComponentInChildren(); Interact_Pickup_PickupItem interact = ((Il2CppObjectBase)core.m_interact).Cast(); LG_PickupItem_Sync obj = ((Il2CppObjectBase)core.m_sync).Cast(); EnemyTaggerComponent tagger = ((Component)core).gameObject.AddComponent(); tagger.Parent = core; ((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; GameObject obsVisual = null; if (setting.UseVisual) { obsVisual = Object.Instantiate(Assets.OBSVisual, ((Component)__instance).transform); obsVisual.transform.localScale = new Vector3(setting.TagRadius, setting.TagRadius, setting.TagRadius); obsVisual.SetActive(false); obsVisuals.Add(obsVisual); } obj.OnSyncStateChange += Action.op_Implicit((Action)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 //IL_006a: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) 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; if ((Object)(object)obsVisual != (Object)null && obsVisual.active) { CoroutineManager.BlinkOut(obsVisual, 0f); } } } else { tagger.PickedByPlayer = null; tagger.ChangeState((!setting.TagWhenPlaced) ? eEnemyTaggerState.Inactive : eEnemyTaggerState.Active_Warmup); ((Interact_Timed)interact).InteractDuration = setting.TimeToPickup; if ((Object)(object)obsVisual != (Object)null) { obsVisual.gameObject.transform.SetPositionAndRotation(placement.position, placement.rotation); if (isRecall) { if (((ItemInLevel)core).CanWarp) { CoroutineManager.BlinkIn(obsVisual, tagger.WarmupTime); } } else if (!obsVisual.active && setting.TagWhenPlaced) { CoroutineManager.BlinkIn(obsVisual, tagger.WarmupTime); } } } }); } private void AddOBSVisualRenderers() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown foreach (GameObject oBSVisual in OBSVisuals) { Renderer componentInChildren = oBSVisual.GetComponentInChildren(); float @float = componentInChildren.material.GetFloat("_Intensity"); float behindWallIntensity = -1f; TSAManager.Current.RegisterPuzzleVisual(new PuzzleVisualWrapper { GO = oBSVisual, Renderer = componentInChildren, Intensity = @float, BehindWallIntensity = behindWallIntensity }); } } private void Clear() { obsVisuals.Clear(); } private EnemyTaggerSettingManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnEnterLevel += AddOBSVisualRenderers; } 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 elevatorCargos = new Dictionary(); 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(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)delegate(string content) { LevelElevatorCargo @override = Json.Deserialize(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 ElevatorCargoItems { get; set; } = new List(); } } namespace LEGACY.LegacyOverride.DummyVisual { public enum VisualTemplateType { SENSOR, SCAN } public class VisualGroup { [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <>c__DisplayClass22_0 { public List gos; } [CompilerGenerated] private sealed class d__23 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float InitialDelay; public List gos; public BlinkConfig conf; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (InitialDelay >= 0f) { <>2__current = (object)new WaitForSeconds(InitialDelay); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } foreach (GameObject go in gos) { bool active = go.active; go.SetActive(!active); } <>2__current = (object)new WaitForSeconds(conf.ShowHideTime); <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__22 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public List gos; public float InitialDelay; public DirectionalConfig conf; private <>c__DisplayClass22_0 <>8__1; private int 5__2; private int 5__3; private LinkedList 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = default(<>c__DisplayClass22_0); 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1.gos = gos; if (InitialDelay >= 0f) { <>2__current = (object)new WaitForSeconds(InitialDelay); <>1__state = 1; return true; } goto IL_0061; case 1: <>1__state = -1; goto IL_0061; case 2: { <>1__state = -1; break; } IL_0061: 5__2 = conf.WindowSize; 5__3 = -5__2 + 1; 5__4 = new LinkedList(); 5__4.AddFirst(5__3); break; } g__SetGOsInRange|22_0(0, <>8__1.gos.Count, false, ref <>8__1); for (LinkedListNode linkedListNode = 5__4.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { int value = linkedListNode.Value; g__SetGOsInRange|22_0(value, value + 5__2, true, ref <>8__1); linkedListNode.Value = value + 1; if (linkedListNode == 5__4.First && 1 < linkedListNode.Value - conf.WindowInterval) { 5__4.AddFirst(5__3); } else if (linkedListNode == 5__4.Last && linkedListNode.Value >= <>8__1.gos.Count) { 5__4.RemoveLast(); } } <>2__current = (object)new WaitForSeconds(conf.UpdateInterval); <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private List coroutines = new List(); public VisualGroupDefinition def { get; private set; } private List Visuals { get; } = new List(); public IEnumerable GameObjects => Visuals; public StateReplicator StateReplicator { get; private set; } private void OnStateChanged(VisualGroupState oldState, VisualGroupState newState, bool isRecall) { if (oldState.VisualAnimationType != newState.VisualAnimationType) { LegacyLogger.Debug($"VisualGroup OnStateChange: {oldState.VisualAnimationType} -> {newState.VisualAnimationType}"); } if (isRecall) { ChangeToStateUnsynced(newState); } } public void ChangeToState(VisualGroupState state) { ChangeToStateUnsynced(state); if (SNet.IsMaster) { StateReplicator.SetState(state); } } private void ChangeToStateUnsynced(VisualGroupState state) { coroutines.ForEach((Action)CoroutineManager.StopCoroutine); coroutines.Clear(); Coroutine val = null; switch (state.VisualAnimationType) { case VisualAnimationType.OFF: Visuals.ForEach(delegate(GameObject go) { go.SetActive(false); }); break; case VisualAnimationType.ON: Visuals.ForEach(delegate(GameObject go) { go.SetActive(true); }); break; case VisualAnimationType.DIRECTIONAL: case VisualAnimationType.REVERSE_DIRECTIONAL: { List gos = ((state.VisualAnimationType == VisualAnimationType.DIRECTIONAL) ? Visuals : Enumerable.Reverse(Visuals).ToList()); val = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Directional(gos, def.AnimationConfig.Directional, def.InitialPlayDelay)), (Action)null); coroutines.Add(val); break; } case VisualAnimationType.BLINK: val = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Blink(Visuals, def.AnimationConfig.Blink, def.InitialPlayDelay)), (Action)null); coroutines.Add(val); break; default: LegacyLogger.Error($"VisualGroup: Visual Type '{state.VisualAnimationType}' is undefined!"); break; } } private void BuildVisualGOs() { //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) foreach (VisualSequence visualSequence in def.VisualSequences) { GameObject val = null; switch (def.VisualType) { case VisualTemplateType.SENSOR: val = Assets.DummySensor; break; case VisualTemplateType.SCAN: val = Assets.DummyScan; break; default: LegacyLogger.Error($"Build DummyVisual: VisualType {def.VisualType} is not implemented."); continue; } List list; switch (visualSequence.SequenceType) { case VSequenceType.DIRECTIONAL: list = visualSequence.DirectionalSequence.Generate(val); break; case VSequenceType.CIRCULAR: list = visualSequence.CircularSequence.Generate(val); break; default: LegacyLogger.Error($"BuildVisualGOs: VSequenceType {visualSequence.SequenceType} is not implemented"); continue; } foreach (GameObject item in list) { ((Component)item.transform.GetChild(0).GetChild(0)).gameObject.SetActive(def.DisplayCylinder); TextMeshPro componentInChildren = item.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).SetText(LocalizedText.op_Implicit(def.Text), true); ((TMP_Text)componentInChildren).ForceMeshUpdate(false, false); } float num = 0.16216217f; item.transform.localScale = new Vector3(visualSequence.VisualRadius, visualSequence.VisualRadius, visualSequence.VisualRadius); Transform transform = item.transform; transform.localPosition += Vector3.up * num; ((Component)item.transform.GetChild(0).GetChild(1)).gameObject.GetComponentInChildren().material.SetColor("_ColorA", new Color(visualSequence.VisualColor.x, visualSequence.VisualColor.y, visualSequence.VisualColor.z)); } Visuals.AddRange(list); } } private void DestroyVisualGOs() { Visuals.ForEach((Action)Object.Destroy); Visuals.Clear(); } internal void ResetupOnDef(VisualGroupDefinition def) { this.def = def; DestroyVisualGOs(); BuildVisualGOs(); ChangeToState(new VisualGroupState { VisualAnimationType = def.InitialAnimation }); } public bool Setup() { BuildVisualGOs(); uint num = EOSNetworking.AllotReplicatorID(); if (num == 0) { LegacyLogger.Error("VisualGroup Setup: cannot setup replicator"); return false; } StateReplicator = StateReplicator.Create(num, new VisualGroupState { VisualAnimationType = VisualAnimationType.OFF }, (LifeTimeType)1, (IStateReplicatorHolder)null); StateReplicator.OnStateChanged += OnStateChanged; LevelAPI.OnEnterLevel += OnEnterLevel; return true; } private void OnEnterLevel() { ChangeToState(new VisualGroupState { VisualAnimationType = def.InitialAnimation }); } [IteratorStateMachine(typeof(d__22))] private IEnumerator Directional(List gos, DirectionalConfig conf, float InitialDelay = 0f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(0) { gos = gos, conf = conf, InitialDelay = InitialDelay }; } [IteratorStateMachine(typeof(d__23))] private IEnumerator Blink(List gos, BlinkConfig conf, float InitialDelay = 0f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__23(0) { gos = gos, conf = conf, InitialDelay = InitialDelay }; } public void Destroy() { LevelAPI.OnEnterLevel -= OnEnterLevel; DestroyVisualGOs(); StateReplicator = null; } public VisualGroup(VisualGroupDefinition def) { this.def = def; } [CompilerGenerated] internal static void g__SetGOsInRange|22_0(int start, int end, bool active, ref <>c__DisplayClass22_0 P_3) { start = Math.Max(start, 0); end = Math.Min(end, P_3.gos.Count); for (int i = start; i < end; i++) { P_3.gos[i].SetActive(active); } } } public enum VSequenceType { DIRECTIONAL, CIRCULAR } public class VisualSequence { public float VisualRadius { get; set; } = 3.2f; public Vec3 VisualColor { get; set; } = new Vec3(); public VSequenceType SequenceType { get; set; } public DirectionalSequence DirectionalSequence { get; set; } = new DirectionalSequence(); public CircularSequence CircularSequence { get; set; } = new CircularSequence(); } public class VisualGroupDefinition { public string WorldEventObjectFilter { get; set; } = string.Empty; public VisualTemplateType VisualType { get; set; } public VisualAnimationType InitialAnimation { get; set; } public float InitialPlayDelay { get; set; } public LocalizedText Text { get; set; } public bool DisplayCylinder { get; set; } public List VisualSequences { get; set; } = new List { new VisualSequence() }; public VisualAnimationConfig AnimationConfig { get; set; } = new VisualAnimationConfig(); } internal class VisualManager : GenericExpeditionDefinitionManager { public static VisualManager Current; protected override string DEFINITION_NAME => "DummyVisual"; private Dictionary Visuals { get; } = new Dictionary(); public void Build(VisualGroupDefinition def) { if (Visuals.ContainsKey(def.WorldEventObjectFilter)) { LegacyLogger.Error("Build DummyVisual: found duplicate WorldEventObjectFilter " + def.WorldEventObjectFilter + ", won't build!"); return; } VisualGroup visualGroup = new VisualGroup(def); if (visualGroup.Setup()) { Visuals[def.WorldEventObjectFilter] = visualGroup; } } public void ToggleVisualAnimationType(string worldEventObjectFilter, VisualAnimationType visualType) { if (!Visuals.TryGetValue(worldEventObjectFilter, out var value)) { LegacyLogger.Error("ToggleVisualAnimationType: Visual Sequence '" + worldEventObjectFilter + "' is not found"); return; } value.ChangeToState(new VisualGroupState { VisualAnimationType = visualType }); } private void Clear() { foreach (VisualGroup value in Visuals.Values) { value.Destroy(); } Visuals.Clear(); } private void OnBuildDone() { if (base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { base.definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions.ForEach(Build); } } protected override void FileChanged(LiveEditEventArgs e) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 base.FileChanged(e); if ((int)GameStateManager.CurrentStateName != 10 || !base.definitions.ContainsKey(base.CurrentMainLevelLayout)) { return; } foreach (VisualGroupDefinition definition in base.definitions[base.CurrentMainLevelLayout].Definitions) { if (Visuals.TryGetValue(definition.WorldEventObjectFilter, out var value)) { LegacyLogger.Debug("Rebuilding visual group '" + definition.WorldEventObjectFilter + "'"); value.ResetupOnDef(definition); } } } private VisualManager() { LevelAPI.OnBuildDone += OnBuildDone; LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } static VisualManager() { Current = new VisualManager(); } } internal enum ToggleType { INSTANT, BLINK } internal static class ToggleFunctions { public static void Instant(GameObject go, bool active) { go.SetActive(active); } public static void Instant(IEnumerable gos, bool active) { foreach (GameObject go in gos) { Instant(go, active); } } public static void Blink(GameObject go, bool active) { if (active) { CoroutineManager.BlinkIn(go, 0f); } else { CoroutineManager.BlinkOut(go, 0f); } } public static void Blink(IEnumerable gos, bool active) { foreach (GameObject go in gos) { Blink(go, active); } } } public struct VisualGroupState { public VisualAnimationType VisualAnimationType; public VisualGroupState() { VisualAnimationType = VisualAnimationType.OFF; } } } namespace LEGACY.LegacyOverride.DummyVisual.VisualSequenceType { public class CircularSequence { public Vec3 Origin { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); public float CircleRadius { get; set; } = 6.4f; public int Count { get; set; } = 1; public bool GenerateFullCircle { get; set; } public float AngleDegreeInterval { get; set; } = 60f; public float ToRadian(float degrees) { return (float)((double)degrees * Math.PI / 180.0); } public List Generate(GameObject template) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) float num = (GenerateFullCircle ? (360f / (float)Count) : AngleDegreeInterval); List list = new List(); GameObject val = new GameObject(); val.transform.SetPositionAndRotation(Origin.ToVector3(), Quaternion.identity); Vector3 val3 = default(Vector3); for (int i = 0; i < Count; i++) { GameObject val2 = Object.Instantiate(template); float degrees = num * (float)i; float num2 = ToRadian(degrees); ((Vector3)(ref val3))..ctor(Origin.x + Mathf.Cos(num2) * CircleRadius, Origin.y, Origin.z + Mathf.Sin(num2) * CircleRadius); val2.transform.SetPositionAndRotation(val3, Quaternion.identity); val2.SetActiveRecursively(true); list.Add(val2); val2.transform.SetParent(val.transform); } Quaternion val4 = Rotation.ToQuaternion(); val.transform.SetPositionAndRotation(val.transform.position, val4); foreach (GameObject item in list) { item.transform.SetParent((Transform)null); } Object.Destroy((Object)(object)val); return list; } } public class DirectionalSequence { public Vec3 StartPosition { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); public Vec3 ExtendDirection { get; set; } = new Vec3(); public float PlacementInterval { get; set; } = 6.4f; public int Count { get; set; } = 1; public List Generate(GameObject template) { //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: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Vector3 val = StartPosition.ToVector3(); Quaternion val2 = Rotation.ToQuaternion(); Vector3 val3 = ExtendDirection.ToVector3(); Vector3 normalized = ((Vector3)(ref val3)).normalized; List list = new List(); for (int i = 0; i < Count; i++) { GameObject val4 = Object.Instantiate(template); val4.transform.SetPositionAndRotation(val, val2); val4.SetActiveRecursively(true); val += normalized * PlacementInterval; list.Add(val4); } return list; } } } namespace LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation { public class VisualAnimationConfig { public DirectionalConfig Directional { get; set; } = new DirectionalConfig(); public BlinkConfig Blink { get; set; } = new BlinkConfig(); } public enum VisualAnimationType { OFF, ON, DIRECTIONAL, REVERSE_DIRECTIONAL, BLINK } } namespace LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation.AnimationComp_Deprecated { internal class BlinkAnimation : MonoBehaviour { internal GameObject VisualGO; internal float ShowHideTime; internal bool ShowCylinder; private float NextUpdateTime = float.PositiveInfinity; private bool PlayAnimation; private GameObject Cylinder { get { GameObject visualGO = VisualGO; if (visualGO == null) { return null; } return ((Component)visualGO.transform.GetChild(0).GetChild(0)).gameObject; } } private GameObject Zone { get { GameObject visualGO = VisualGO; if (visualGO == null) { return null; } return ((Component)visualGO.transform.GetChild(0).GetChild(1)).gameObject; } } private GameObject Text { get { GameObject visualGO = VisualGO; if (visualGO == null) { return null; } return ((Component)visualGO.transform.GetChild(0).GetChild(2)).gameObject; } } internal void SetPlayAnimation(bool play) { PlayAnimation = play; if (play) { NextUpdateTime = Clock.Time + ShowHideTime; } else { NextUpdateTime = float.PositiveInfinity; } } private void Update() { if (!((Object)(object)VisualGO == (Object)null) && PlayAnimation && !(Clock.Time < NextUpdateTime)) { bool active = Zone.active; Zone.SetActive(!active); if (ShowCylinder) { Cylinder.SetActive(!active); } else { Cylinder.SetActive(false); } Text.SetActive(!active); NextUpdateTime = Clock.Time + ShowHideTime; } } private void OnDestroy() { VisualGO = null; } static BlinkAnimation() { ClassInjector.RegisterTypeInIl2Cpp(); } } internal class DirectionalAnimation : MonoBehaviour { internal GameObject VisualGO; internal float InitialDelay; internal float ShowHideTime; internal bool ShowCylinder; private float NextUpdateTime = float.PositiveInfinity; private bool PlayAnimation; private GameObject Cylinder { get { GameObject visualGO = VisualGO; if (visualGO == null) { return null; } return ((Component)visualGO.transform.GetChild(0).GetChild(0)).gameObject; } } private GameObject Zone { get { GameObject visualGO = VisualGO; if (visualGO == null) { return null; } return ((Component)visualGO.transform.GetChild(0).GetChild(1)).gameObject; } } private GameObject Text { get { GameObject visualGO = VisualGO; if (visualGO == null) { return null; } return ((Component)visualGO.transform.GetChild(0).GetChild(2)).gameObject; } } internal void SetPlayAnimation(bool play) { PlayAnimation = play; if (play) { NextUpdateTime = Clock.Time + InitialDelay; } else { NextUpdateTime = float.PositiveInfinity; } } private void Update() { if (!((Object)(object)VisualGO == (Object)null) && PlayAnimation && !(Clock.Time < NextUpdateTime)) { bool active = Zone.active; Zone.SetActive(!active); if (ShowCylinder) { Cylinder.SetActive(!active); } else { Cylinder.SetActive(false); } Text.SetActive(!active); NextUpdateTime = Clock.Time + ShowHideTime; } } private void OnDestroy() { VisualGO = null; } static DirectionalAnimation() { ClassInjector.RegisterTypeInIl2Cpp(); } } } namespace LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation.AnimationConfig { public class BlinkConfig { public float ShowHideTime { get; set; } = 0.25f; } public class DirectionalConfig { public int WindowSize { get; set; } = 4; public int WindowInterval { get; set; } = 2; public float UpdateInterval { get; set; } = 0.125f; } } namespace LEGACY.ExtraEvents { internal static class LegacyExtraEvents { private class MyTextDatablock { public bool SkipLocalization { get; set; } public bool MachineTranslation { get; set; } public string English { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public int CharacterMetaData { get; set; } = 5; public int ExportVersion { get; set; } = 1; public int ImportVersion { get; set; } = 1; public string name { get; set; } = string.Empty; public bool internalEnabled { get; set; } = true; public string persistentID { get; set; } = string.Empty; public string datablock { get; set; } = "Text"; } internal enum EventType { CloseSecurityDoor_Custom = 100, SetTimerTitle = 102, AlertEnemiesInZone = 107, AlertEnemiesInArea = 108, Terminal_ShowTerminalInfoInZone = 130, Terminal_ToggleState = 131, KillEnemiesInArea = 140, KillEnemiesInZone = 141, KillEnemiesInDimension = 142, PlayGCEndSequence = 180, ChainedPuzzle_AddReqItem = 200, ChainedPuzzle_RemoveReqItem = 201, SpawnHibernate = 170, Info_ZoneHibernate = 250, Info_LevelHibernate = 251, Output_LevelHibernateSpawnEvent = 252, TP_WarpTeams = 160, TP_WarpPlayersInRange = 161, TP_WarpItemsInZone = 162, FF_ToggleFFCheck = 210, FF_AddPlayersInRangeToCheck = 211, FF_AddPlayersOutOfRangeToCheck = 212, FF_ToggleCheckOnGroup = 213, FF_Reset = 214, FF_ResetGroup = 215, FF_SetExpeditionFailedText = 216, FF_ResetExpeditionFailedText = 217, SetNavMarker = 220, ToggleDummyVisual = 221, ToggleLSFBState = 222, SaveCheckpoint = 223, SetSuccessPageCustomization = 224, ToggleCamaraShake = 225, PlayMusic = 260, StopMusic = 261, ToggleEventScanState = 270 } [CompilerGenerated] private sealed class d__15 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public WardenObjectiveEventData e; public float currentDuration; private uint 5__2; private CarryItemPickup_Core 5__3; private CP_Bioscan_Core 5__4; private CP_Cluster_Core 5__5; private CP_PlayerScanner 5__6; private float 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Expected O, but got Unknown //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Expected O, but got Unknown iWardenObjectiveItem[] array; switch (<>1__state) { default: return false; case 0: { <>1__state = -1; 5__2 = e.ChainPuzzle; int count = e.Count; 5__3 = PuzzleReqItemManager.Current.GetBigPickupItem(count); if ((Object)(object)5__3 == (Object)null) { LegacyLogger.Error($"AddReqItem: Cannot find BigPickup Item with index {count}"); return false; } 5__4 = PuzzleOverrideManager.Current.GetBioscanCore(5__2); 5__5 = PuzzleOverrideManager.Current.GetClusterCore(5__2); if ((Object)(object)5__4 != (Object)null) { float num = Mathf.Max(e.Delay - currentDuration, 0f); if (num > 0f) { <>2__current = (object)new WaitForSeconds(num); <>1__state = 1; return true; } goto IL_010c; } if ((Object)(object)5__5 != (Object)null) { float num2 = Mathf.Max(e.Delay - currentDuration, 0f); if (num2 > 0f) { <>2__current = (object)new WaitForSeconds(num2); <>1__state = 3; return true; } goto IL_039f; } LegacyLogger.Error($"AddReqItem: cannot find puzzle core with index {5__2}"); return false; } case 1: <>1__state = -1; goto IL_010c; case 2: <>1__state = -1; goto IL_02a3; case 3: { <>1__state = -1; goto IL_039f; } IL_02a3: if (5__6.m_scanProgression < e.Duration) { <>2__current = (object)new WaitForSeconds(5__7); <>1__state = 2; return true; } goto IL_02c7; IL_02ce: 5__4.AddRequiredItems(Il2CppReferenceArray.op_Implicit((iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1] { new iWardenObjectiveItem(((Il2CppObjectBase)5__3).Pointer) })); LegacyLogger.Debug($"AddReqItem: puzzle override index: {5__2}"); LegacyLogger.Debug("Item name: " + ((Item)5__3).ItemDataBlock.publicName); break; IL_02c7: 5__6 = null; goto IL_02ce; IL_010c: 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; 5__6 = ((Il2CppObjectBase)5__4.m_playerScanner).TryCast(); if ((Object)(object)5__6 != (Object)null) { 5__7 = (((double)e.FogTransitionDuration > 0.0) ? e.FogTransitionDuration : 0.5f); LegacyLogger.Debug($"AddReqItem: item would be added on scan progression: {duration}, progression check interval: {5__7} (seconds)"); goto IL_02a3; } LegacyLogger.Error("AddReqItem: Failed to get scanner for the CP_Bioscan_Core"); goto IL_02c7; } goto IL_02ce; IL_039f: 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); } } array = (iWardenObjectiveItem[])(object)new iWardenObjectiveItem[1] { new iWardenObjectiveItem(((Il2CppObjectBase)5__3).Pointer) }; foreach (iChainedPuzzleCore item in (Il2CppArrayBase)(object)5__5.m_childCores) { item.AddRequiredItems(Il2CppReferenceArray.op_Implicit(array)); } LegacyLogger.Debug($"AddReqItem: puzzle override index: {5__2}"); LegacyLogger.Debug("Item name: " + ((Item)5__3).ItemDataBlock.publicName); break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__19 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public WardenObjectiveEventData e; private float 5__2; private Color 5__3; private float