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 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.JSON;
using ExtraObjectiveSetup.Utils;
using FloLib.Infos;
using FloLib.Networks.Replications;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using GameEvent;
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.ExtraEvents.Patches;
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.LegacyOverride.Restart;
using LEGACY.Utils;
using LEGACY.VanillaFix;
using LevelGeneration;
using Localization;
using MTFO.API;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using ScanPosOverride.Managers;
using TMPro;
using ThermalSights;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LEGACY")]
[assembly: AssemblyConfiguration("Debug")]
[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 + " \nPE 2.6.2 ", 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; }
internal static GameObject RestartPage { 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");
RestartPage = AssetAPI.GetLoadedAsset("Assets/Misc/CM_PageRestart_CellUI.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.*/)]
[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("Hikaria.InLevelCarryOnBack")]
[BepInIncompatibility("com.Chaxi.StrongerPrisoner")]
[BepInPlugin("Inas.LEGACY", "LEGACY", "4.4.5")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string RUNDOWN_NAME = "LEGACY";
public const string VERSION = "4.4.5";
public const bool TESTING = false;
public const string TEST_STRING = "TESTING";
private Harmony m_Harmony;
public override void Load()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
m_Harmony = new Harmony("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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0037: 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: Invalid comparison between Unknown and I4
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected I4, but got Unknown
//IL_00b3: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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;
eReactorStatus val3 = status;
switch (val3 - 7)
{
default:
return;
case 0:
val2 = (eWardenObjectiveEventTrigger)1;
break;
case 1:
val2 = (eWardenObjectiveEventTrigger)2;
break;
case 2:
val2 = (eWardenObjectiveEventTrigger)3;
break;
}
LG_LayerType layerType = __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_000e: 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_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_001c: 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_0012: 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_0059: 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_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
//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_0033: Invalid comparison between Unknown and I4
//IL_0053: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_00a3: 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)
//IL_00ab: 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_00af: 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_00c4: Expected I4, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: 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;
eReactorStatus val = status;
switch (val - 2)
{
case 0:
{
WardenObjectiveDataBlock val2 = null;
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val2) || val2 == null)
{
LegacyLogger.Error("Patch_ReactorStartup_OverwriteGUIBehaviour: ");
LegacyLogger.Error("Failed to get warden objective datablock");
break;
}
__instance.m_lightCollection.SetMode(val2.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_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_003c: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Invalid comparison between Unknown and I4
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Invalid comparison between Unknown and I4
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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;
eLocalZoneIndex val = localIndex;
if ((int)val != 1)
{
if ((int)val == 5)
{
__instance.m_zonePlacementWeights.Start = 0f;
__instance.m_zonePlacementWeights.Middle = 0f;
__instance.m_zonePlacementWeights.End = 100000f;
}
return;
}
ePickupItemType pickupType = __instance.m_pickupType;
ePickupItemType val2 = pickupType;
if ((int)val2 == 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_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Invalid comparison between Unknown and I4
//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_0025: Invalid comparison between Unknown and I4
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
eDoorStatus status = state.status;
eDoorStatus val = status;
if ((val - 4 <= 1 || (int)val == 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; } = false;
private Debugger()
{
}
internal void Init()
{
if (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 Transform trans;
public Vector3 sourcePos;
public Vector3 targetPos;
public float startTime;
public float duration;
public EasingFunction ease;
public Action onDone;
public BoolCheck checkAbort;
private bool 5__1;
private float 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
5__1 = false;
break;
case 1:
<>1__state = -1;
break;
}
if (Clock.Time < startTime + duration && !5__1)
{
5__1 = checkAbort != null && checkAbort();
5__2 = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localPosition = Vector3.Lerp(sourcePos, targetPos, 5__2);
<>2__current = null;
<>1__state = 1;
return true;
}
trans.localPosition = targetPos;
if (!5__1 && 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 Transform trans;
public Vector3 sourceEuler;
public Vector3 targetEuler;
public float startTime;
public float duration;
public EasingFunction ease;
public Action onDone;
public BoolCheck checkAbort;
private bool 5__1;
private float 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
5__1 = false;
break;
case 1:
<>1__state = -1;
break;
}
if (Clock.Time < startTime + duration && !5__1)
{
5__1 = checkAbort != null && checkAbort();
5__2 = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, 5__2);
<>2__current = null;
<>1__state = 1;
return true;
}
trans.localEulerAngles = targetEuler;
if (!5__1 && 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 Transform trans;
public Vector3 startScale;
public Vector3 targetScale;
public float startTime;
public float duration;
public EasingFunction ease;
public Action onDone;
public BoolCheck checkAbort;
private bool 5__1;
private float 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
5__1 = false;
break;
case 1:
<>1__state = -1;
break;
}
if (Clock.Time < startTime + duration && !5__1)
{
5__1 = checkAbort != null && checkAbort();
5__2 = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localScale = Vector3.Lerp(startScale, targetScale, 5__2);
<>2__current = null;
<>1__state = 1;
return true;
}
trans.localScale = targetScale;
if (!5__1 && 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_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)
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_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)
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_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)
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 GOExtensions
{
public static GameObject GetChild(this GameObject go, string childName, bool substrSearch = false, bool recursiveSearch = true)
{
if (((Object)go).name.Equals(childName) || (substrSearch && ((Object)go).name.Contains(childName)))
{
return go;
}
for (int i = 0; i < go.transform.childCount; i++)
{
GameObject gameObject = ((Component)go.transform.GetChild(i)).gameObject;
GameObject val = null;
if (recursiveSearch)
{
val = gameObject.GetChild(childName, substrSearch);
}
else if (((Object)gameObject).name.Equals(childName) || (substrSearch && ((Object)gameObject).name.Contains(childName)))
{
val = gameObject;
}
if ((Object)(object)val != (Object)null)
{
return val;
}
}
return null;
}
}
public static class Helper
{
private static void ResetChild(iChainedPuzzleCore ICore)
{
CP_Bioscan_Core val = ((Il2CppObjectBase)ICore).TryCast();
if ((Object)(object)val != (Object)null)
{
CP_Holopath_Spline val2 = ((Il2CppObjectBase)val.m_spline).Cast();
CP_PlayerScanner val3 = ((Il2CppObjectBase)val.PlayerScanner).Cast();
val3.ResetScanProgression(0f);
val.Deactivate();
return;
}
CP_Cluster_Core val4 = ((Il2CppObjectBase)ICore).TryCast();
if ((Object)(object)val4 == (Object)null)
{
LegacyLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core...");
return;
}
CP_Holopath_Spline val5 = ((Il2CppObjectBase)val4.m_spline).Cast();
foreach (iChainedPuzzleCore item in (Il2CppArrayBase)(object)val4.m_childCores)
{
ResetChild(item);
}
val4.Deactivate();
}
public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
if (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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
return (int)player.Owner.Load().gameState == 10;
}
public static ChainedPuzzleInstance GetChainedPuzzleForCommandOnTerminal(LG_ComputerTerminal terminal, string command)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected I4, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Invalid comparison between Unknown and I4
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Invalid comparison between Unknown and I4
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Invalid comparison between Unknown and I4
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Invalid comparison between Unknown and I4
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Invalid comparison between Unknown and I4
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Invalid comparison between Unknown and I4
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
uint num = 0u;
if (terminal.SpawnNode.m_dimension.IsMainDimension)
{
LG_LayerType layerType = terminal.SpawnNode.LayerType;
LG_LayerType val = layerType;
switch ((int)val)
{
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 val2 = null;
List terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone;
int num2 = terminalsSpawnedInZone.IndexOf(terminal);
ExpeditionZoneData val3 = null;
Enumerator enumerator = block.Zones.GetEnumerator();
while (enumerator.MoveNext())
{
ExpeditionZoneData current = enumerator.Current;
if (current.LocalIndex == terminal.SpawnNode.m_zone.LocalIndex)
{
val3 = current;
break;
}
}
if (val3 == null)
{
LegacyLogger.Error("Cannot find target zone data.");
return null;
}
if (val3.TerminalPlacements.Count != terminalsSpawnedInZone.Count)
{
LegacyLogger.Error("The numbers of terminal placement and spawn, skipped for the zone terminal.");
return null;
}
val2 = val3.TerminalPlacements[num2].UniqueCommands;
if (val2.Count == 0)
{
return null;
}
List val4 = null;
TERM_Command val5 = (TERM_Command)0;
Enumerator enumerator2 = val2.GetEnumerator();
string text = default(string);
string text2 = default(string);
while (enumerator2.MoveNext())
{
CustomTerminalCommand current2 = enumerator2.Current;
if (current2.Command == command)
{
val4 = current2.CommandEvents;
if (!terminal.m_command.TryGetCommand(current2.Command, ref val5, ref text, ref text2))
{
LegacyLogger.Error("Cannot get TERM_COMMAND for command {0} on the specified terminal.");
}
break;
}
}
if (val4 == null || (int)val5 == 0)
{
return null;
}
if ((int)val5 != 38 && (int)val5 != 39 && (int)val5 != 40 && (int)val5 != 41 && (int)val5 != 42)
{
return null;
}
ChainedPuzzleInstance val6 = null;
for (int i = 0; i < val4.Count && (val4[i].ChainPuzzle == 0 || !terminal.TryGetChainPuzzleForCommand(val5, i, ref val6) || !((Object)(object)val6 != (Object)null)); i++)
{
}
return val6;
}
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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between I4 and Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Invalid comparison between I4 and Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected I4, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between I4 and Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Invalid comparison between I4 and Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected I4, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)zone == (Object)null)
{
return -1;
}
LG_LayerType type = zone.m_layer.m_type;
eLocalZoneIndex localIndex = zone.LocalIndex;
eDimensionIndex currentDimensionIndex = 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_0068: 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_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
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;
}
return (terminalIndex < 0) ? null : val.TerminalsSpawnedInZone[terminalIndex];
}
public static AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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)
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
{
static Json()
{
}
public static T Deserialize(string json)
{
return EOSJson.Deserialize(json);
}
public static object Deserialize(Type type, string json)
{
return EOSJson.Deserialize(type, json);
}
public static string Serialize(T value)
{
return EOSJson.Serialize(value);
}
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; } = (eWardenObjectiveEventTrigger)0;
public int Type { get; set; } = 170;
public eDimensionIndex DimensionIndex { get; set; } = (eDimensionIndex)0;
public LG_LayerType Layer { get; set; } = (LG_LayerType)0;
public eLocalZoneIndex LocalIndex { get; set; } = (eLocalZoneIndex)0;
public string WorldEventObjectFilter { get; set; } = "RANDOM";
public uint EnemyID { get; set; }
public int Count { get; set; } = 1;
public float Delay { get; set; } = 0f;
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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_004a: 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_0067: Expected I4, but got Unknown
//IL_00b0: 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;
LG_AreaSize val = size;
switch (val - 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_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate(Assets.ObjectiveMarker);
float num = 0.16216217f;
Transform transform = val.transform;
transform.localPosition += Vector3.up * num;
return val;
}
public void EnableMarkerAt(string markerName, GameObject target, float scale)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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)
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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0039: 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_007a: 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)
{
GameObject value;
NavMarker value2;
return (markerVisuals.TryGetValue(markerName, out value) && navMarkers.TryGetValue(markerName, out value2)) ? (value, value2) : (null, null);
}
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.Restart
{
public static class CM_PageRestart
{
internal static TextMeshPro Text { get; private set; }
internal static GameObject Reconnecting { get; private set; }
public static GameObject Page { get; private set; }
internal static void Setup()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Assets.RestartPage == (Object)null)
{
return;
}
if ((Object)(object)Page != (Object)null)
{
LegacyLogger.Warning("Duplicate setup for CM_PageRestart!");
try
{
Object.Destroy((Object)(object)Page);
}
finally
{
Page = null;
}
}
Transform transform = ((Component)((GuiLayer)GuiManager.Current.m_mainMenuLayer).GuiLayerBase).transform;
Page = Object.Instantiate(Assets.RestartPage, transform.position, transform.rotation, transform);
CM_PageBase component = Page.GetComponent();
GameObject gameObject = ((Component)component.m_movingContentHolder).gameObject;
Reconnecting = gameObject.GetChild("Reconnecting");
GameObject gameObject2 = ((Component)GuiManager.Current.m_mainMenuLayer.PageMap.m_mapDisconnected.transform.GetChild(0)).gameObject;
gameObject2 = Object.Instantiate(gameObject2, Reconnecting.transform);
Text = gameObject2.GetComponent();
((Graphic)Text).color = new Color(0f, 1f, 72f / 85f, 1f);
((TMP_Text)Text).SetText("RECONNECTING", true);
((TMP_Text)Text).ForceMeshUpdate(false, false);
Page.GetComponent().Setup(GuiManager.Current.m_mainMenuLayer);
}
public static void SetPageActive(bool active)
{
Page.GetComponent().SetPageActive(active);
}
}
}
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)
{
PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(player.Owner);
PlayerAmmoStorage ammoStorage = backpack.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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
<>4__this.StationMarkerGO.SetActive(!<>4__this.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 = null;
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 => State.RemainingUseTime <= 0 && State.CurrentCooldownTime > 0f;
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()
{
return Enabled && !InCooldown;
}
protected abstract void Replenish(PlayerAgent player);
protected virtual void SetInteractionText()
{
//IL_0014: 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}) per {def.CooldownTime}s");
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_000c: 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_0022: 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_0030: 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)
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)
{
PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(player.Owner);
PlayerAmmoStorage ammoStorage = backpack.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; } = 0f;
}
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; } = 0f;
}
public class ResourceStationDefinition : GlobalZoneIndex
{
public int AreaIndex { get; set; } = 0;
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 = 0f;
private float endTime = 0f;
private bool hasOnGoingTimer = false;
private Action OnProgress;
private Action OnTimerEnd;
public float RemainingTime => hasOnGoingTimer ? Math.Max(endTime - Clock.Time, 0f) : 0f;
private static List TimerGOs { get; }
private void Update()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)GameStateManager.CurrentStateName == 10 && 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_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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.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 class GUIManager_RestartPage
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(GuiManager), "Setup")]
private static void Post_Setup(GuiManager __instance)
{
LevelAPI.OnBuildStart += delegate
{
CM_PageRestart.Setup();
};
}
}
[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 static class PouncerArenaPosition_Fix
{
[HarmonyPatch(typeof(LG_Floor), "CreateDimension")]
[HarmonyPrefix]
private static void CreateDimension_Prefix(eDimensionIndex dimensionIndex, bool arenaDimension, ref 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_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Invalid comparison between Unknown and I4
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (dimensionIndex - 17 <= 3)
{
position += new Vector3
{
y = -500f
};
}
}
}
[HarmonyPatch]
internal class RundownSelectionCustomization
{
[CompilerGenerated]
private sealed class d__7 : 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__1;
private float 5__2;
private int 5__3;
private int 5__4;
private int 5__5;
private int 5__6;
private int 5__7;
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Expected O, but got Unknown
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Expected O, but got Unknown
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Expected O, but got Unknown
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Expected O, but got Unknown
//IL_0459: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: 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_0104: Expected O, but got Unknown
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Expected O, but got Unknown
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04d4: Expected O, but got Unknown
//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
//IL_05b4: Expected O, but got Unknown
//IL_068c: Unknown result type (might be due to invalid IL or missing references)
//IL_0696: Expected O, but got Unknown
//IL_076e: Unknown result type (might be due to invalid IL or missing references)
//IL_0778: Expected O, but got Unknown
//IL_0850: Unknown result type (might be due to invalid IL or missing references)
//IL_085a: Expected O, but got Unknown
//IL_0932: Unknown result type (might be due to invalid IL or missing references)
//IL_093c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
5__1 = 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_0147;
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_0147;
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__1, 1f), 4.3f, (EasingFunction)Easing.LinearTween, (Action)delegate
{
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_STOP, "");
}, (BoolCheck)null);
5__2 = 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);
5__3 = 0;
while (5__3 < p.m_expIconsTier3.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier3[5__3]).gameObject, (float)5__3 * 0.1f);
5__3++;
}
if (p.m_expIconsTier3.Count > 0)
{
p.m_tierMarker3.SetVisible(true, 5__2);
}
<>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);
5__4 = 0;
while (5__4 < p.m_expIconsTier5.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier5[5__4]).gameObject, (float)5__4 * 0.1f);
5__4++;
}
if (p.m_expIconsTier5.Count > 0)
{
p.m_tierMarker5.SetVisible(true, 5__2);
}
<>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);
5__5 = 0;
while (5__5 < p.m_expIconsTier4.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier4[5__5]).gameObject, (float)5__5 * 0.1f);
5__5++;
}
if (p.m_expIconsTier4.Count > 0)
{
p.m_tierMarker4.SetVisible(true, 5__2);
}
<>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);
5__6 = 0;
while (5__6 < p.m_expIconsTier2.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier2[5__6]).gameObject, (float)5__6 * 0.1f);
5__6++;
}
if (p.m_expIconsTier2.Count > 0)
{
p.m_tierMarker2.SetVisible(true, 5__2);
}
<>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);
5__7 = 0;
while (5__7 < p.m_expIconsTier1.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier1[5__7]).gameObject, (float)5__7 * 0.1f);
5__7++;
}
if (p.m_expIconsTier1.Count > 0)
{
p.m_tierMarker1.SetVisible(true, 5__2);
}
<>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_0147:
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;
private static uint r3TitleID;
[HarmonyPostfix]
[HarmonyPatch(typeof(CM_PageRundown_New), "Setup")]
private static void Post_CM_PageRundown_New(CM_PageRundown_New __instance)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: 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)
GameSetupDataBlock block = GameDataBlockBase.GetBlock(1u);
if (block.RundownIdsToLoad.Count <= 1)
{
return;
}
int count = block.RundownIdsToLoad.Count;
int num = count;
if (num == 3)
{
((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions)[0] = new Vector3(-430f, 180f, 0f);
((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions)[1] = new Vector3(0f, 100f, 0f);
((Il2CppArrayBase)(object)__instance.m_rundownSelectionPositions)[2] = new Vector3(420f, 100f, 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_007a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: 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_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
GameSetupDataBlock block = GameDataBlockBase.GetBlock(1u);
if (block.RundownIdsToLoad.Count > 1)
{
int count = block.RundownIdsToLoad.Count;
int num = count;
if (num == 3)
{
CM_RundownSelection val = p.m_rundownSelections[0];
CM_RundownSelection val2 = p.m_rundownSelections[1];
CM_RundownSelection val3 = p.m_rundownSelections[2];
((Component)val).transform.localScale = new Vector3(2f, 2f, 2f) * 1.8f;
((Component)val2).transform.localScale = new Vector3(1.25f, 1.25f, 1.25f) * 1f;
((Component)val3).transform.localScale = new Vector3(1.25f, 1.25f, 1.25f) * 2.05f;
Transform transform = val.m_rundownText.transform;
Quaternion localRotation = (val3.m_rundownText.transform.localRotation = Quaternion.AngleAxis(45f, Vector3.right) * Quaternion.AngleAxis(4f, Vector3.forward));
transform.localRotation = localRotation;
val2.m_rundownText.transform.localRotation = Quaternion.AngleAxis(45f, Vector3.right) * Quaternion.AngleAxis(-1f, Vector3.forward);
val.m_rundownText.transform.localPosition = Vector3.up * 60f + Vector3.right * 20f;
val2.m_rundownText.transform.localPosition = Vector3.up * 85f;
val3.m_rundownText.transform.localPosition = Vector3.up * 60f + Vector3.left * 30f;
Transform transform2 = ((Component)val).transform;
localRotation = (((Component)val3).transform.localRotation = Quaternion.AngleAxis(-45f, Vector3.right) * Quaternion.AngleAxis(10f, Vector3.up));
transform2.localRotation = localRotation;
((Component)val2).transform.localRotation = Quaternion.AngleAxis(-45f, Vector3.right);
((TMP_Text)val.m_rundownText).text = ((r1TitleID != 0) ? Text.Get(r1TitleID) : "L ");
((TMP_Text)val3.m_rundownText).text = ((r2TitleID != 0) ? Text.Get(r2TitleID) : "R ");
((TMP_Text)val2.m_rundownText).text = ((r3TitleID != 0) ? Text.Get(r3TitleID) : "M ");
DestroyAltText(val);
DestroyAltText(val2);
DestroyAltText(val3);
}
}
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("L_Title");
if (block != null)
{
r1TitleID = ((GameDataBlockBase)(object)block).persistentID;
}
block = GameDataBlockBase.GetBlock("R_Title");
if (block != null)
{
r2TitleID = ((GameDataBlockBase)(object)block).persistentID;
}
block = GameDataBlockBase.GetBlock("M_Title");
if (block != null)
{
r3TitleID = ((GameDataBlockBase)(object)block).persistentID;
}
}
}
[IteratorStateMachine(typeof(d__7))]
private static IEnumerator reverseReveal(CM_PageRundown_New p, bool hosting, Transform guixSurfaceTransform)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new d__7(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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Expected O, but got Unknown
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Expected O, but got Unknown
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Expected O, but got Unknown
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Expected O, but got Unknown
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Expected O, but got Unknown
//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Expected O, but got Unknown
switch (<>1__state)
{
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)<>4__this.page.m_bgCortex_text).gameObject.SetActive(false);
<>4__this.page.m_bgCortex_textBoxSmall.SetActive(false);
<>4__this.page.m_bgCortex_textBoxLarge.SetActive(false);
((Component)<>4__this.page.m_returnToLobby_text).gameObject.SetActive(false);
CM_PageBase.PostSound(EVENTS.PLAY_01_FIRST_TEXT_APPEAR, "");
<>2__current = CoroutineManager.BlinkIn(<>4__this.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(<>4__this.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(<>4__this.page.m_bgCortex_textBoxSmall, 0f);
CoroutineManager.BlinkIn(<>4__this.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(<>4__this.page.m_bgCortex_textBoxLarge, 0f);
<>1__state = 7;
return true;
case 7:
<>1__state = -1;
<>2__current = CoroutineManager.BlinkOut(<>4__this.page.m_bgCortex_textBoxSmall, 0f);
<>1__state = 8;
return true;
case 8:
<>1__state = -1;
((Component)<>4__this.page.m_bgCortex_text).gameObject.SetActive(false);
<>2__current = CoroutineManager.BlinkOut(<>4__this.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)<>4__this.page.m_bgScare).gameObject.SetActive(true);
<>4__this.page.m_bgScare.Play();
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 11;
return true;
case 11:
<>1__state = -1;
((Component)<>4__this.page.m_bgScare).gameObject.SetActive(false);
<>2__current = CoroutineManager.BlinkIn(((Component)<>4__this.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)<>4__this.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_000c: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Expected O, but got Unknown
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: 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)
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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Invalid comparison between Unknown and I4
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
//IL_005a: 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;
eHeavyFogRepellerStatus val7 = val6;
if ((int)val7 != 1)
{
if ((int)val7 == 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; } = 0u;
public uint VolumeRTPC { get; set; } = 0u;
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