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.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 PlayerCoverage;
using SNetwork;
using ScanPosOverride.Managers;
using StateMachines;
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+de199f83f0c05c4da6acb9ddf93b3601ca04692c")]
[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]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[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.13", 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("2026_F.04_Layout");
if (block != null)
{
ForceDisableLevels.Add(((GameDataBlockBase)(object)block).persistentID);
}
block = GameDataBlockBase.GetBlock("F.08_Layout");
if (block != null)
{
ForceDisableLevels.Add(((GameDataBlockBase)(object)block).persistentID);
}
block = GameDataBlockBase.GetBlock("R6E1_Layout");
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
{
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)
bool doAbort = false;
while (Clock.Time < startTime + duration && !doAbort)
{
doAbort = checkAbort?.Invoke() ?? false;
float t = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localScale = Vector3.Lerp(startScale, targetScale, t);
yield return null;
}
trans.localScale = targetScale;
if (!doAbort && onDone != null)
{
onDone();
}
}
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)
bool doAbort = false;
while (Clock.Time < startTime + duration && !doAbort)
{
doAbort = checkAbort?.Invoke() ?? false;
float t = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localPosition = Vector3.Lerp(sourcePos, targetPos, t);
yield return null;
}
trans.localPosition = targetPos;
if (!doAbort && onDone != null)
{
onDone();
}
}
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)
bool doAbort = false;
while (Clock.Time < startTime + duration && !doAbort)
{
doAbort = checkAbort?.Invoke() ?? false;
float t = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, t);
yield return null;
}
trans.localEulerAngles = targetEuler;
if (!doAbort && onDone != null)
{
onDone();
}
}
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 = new pChainedPuzzleState
{
status = (eChainedPuzzleStatus)0,
currentSurvivalWave_EventID = state.currentSurvivalWave_EventID,
isSolved = false,
isActive = false
};
chainedPuzzleInstance.m_stateReplicator.InteractWithState(val, 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)) ? (markerVisual: value, navMakrer: value2) : (markerVisual: null, navMakrer: 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 != StationType.MEDI)
{
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
{
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);
}
}
private IEnumerator BlinkMarker()
{
while (true)
{
StationMarkerGO.SetActive(!StationMarkerGO.active);
yield return (object)new WaitForSeconds(0.5f);
}
}
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 static class GraphicsSettings_ForceBloomEnabled
{
[HarmonyPrefix]
[HarmonyPatch(typeof(CellSettingsApply), "ApplyBloomEnabled")]
private static void Pre_CellSettingsApply_ApplyBloomEnabled(ref bool value)
{
value = true;
}
}
[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 PrioritizeEnemyTargeting
{
private static bool s_patch;
private static HashSet ForceOverrideLevels;
[HarmonyPostfix]
[HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")]
private static void UpdateTracking(EnemyCourseNavigation __instance)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Invalid comparison between Unknown and I4
if (!ForceOverride() || !s_patch)
{
return;
}
int count = PlayerManager.PlayerAgentsInLevel.Count;
if (!SNet.IsMaster || count <= 1)
{
return;
}
EnemyAgent owner = __instance.m_owner;
if ((int)((StateMachine)(object)owner.Locomotion).m_currentState.m_stateEnum == 14)
{
return;
}
Agent agent = __instance.m_targetRef.m_agent;
int targetPlayerID = __instance.m_targetPlayerID;
if (!IsTargetReachable(((Agent)owner).CourseNode, agent.CourseNode))
{
return;
}
PlayerAgent val = null;
int num = int.MaxValue;
List list = new List();
Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (!((Agent)current).Alive)
{
continue;
}
PlayerCoverageData val2 = ((Il2CppArrayBase)(object)((Agent)owner).CourseNode.m_playerCoverage.m_coverageDatas)[current.Sync.SlotIndex];
if (val2.IsValidNodeDistance)
{
int nodeDistance = val2.m_nodeDistance;
if (nodeDistance < num)
{
num = nodeDistance;
list.Clear();
list.Add(current);
}
else if (nodeDistance == num)
{
list.Add(current);
}
}
}
if (list.Count > 0)
{
val = list[Random.Range(0, list.Count)];
}
if ((Object)(object)val != (Object)null && val.Sync.SlotIndex != targetPlayerID)
{
s_patch = false;
((AgentAI)owner.AI).SetTarget((Agent)(object)val);
}
}
private static bool ForceOverride()
{
return ForceOverrideLevels.Contains(RundownManager.ActiveExpedition.LevelLayoutData);
}
private static bool IsTargetReachable(AIG_CourseNode source, AIG_CourseNode target)
{
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Invalid comparison between Unknown and I4
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Invalid comparison between Unknown and I4
if (source == null || target == null)
{
return false;
}
if (source.NodeID == target.NodeID)
{
return true;
}
AIG_SearchID.IncrementSearchID();
ushort searchID = AIG_SearchID.SearchID;
Queue queue = new Queue();
queue.Enqueue(source);
while (queue.Count > 0)
{
AIG_CourseNode val = queue.Dequeue();
((AIG_CourseGraphMember)val).m_searchID = searchID;
Enumerator enumerator = val.m_portals.GetEnumerator();
while (enumerator.MoveNext())
{
AIG_CoursePortal current = enumerator.Current;
LG_Gate gate = current.Gate;
object obj;
if (gate == null)
{
obj = null;
}
else
{
iLG_Door_Core spawnedDoor = gate.SpawnedDoor;
obj = ((spawnedDoor != null) ? ((Il2CppObjectBase)spawnedDoor).TryCast() : null);
}
LG_SecurityDoor val2 = (LG_SecurityDoor)obj;
if ((Object)(object)val2 != (Object)null && (int)val2.LastStatus != 10 && (int)val2.LastStatus != 16)
{
continue;
}
AIG_CourseNode oppositeNode = current.GetOppositeNode(val);
if (((AIG_CourseGraphMember)oppositeNode).m_searchID != searchID)
{
if (oppositeNode.NodeID == target.NodeID)
{
return true;
}
queue.Enqueue(oppositeNode);
}
}
}
return false;
}
static PrioritizeEnemyTargeting()
{
s_patch = true;
ForceOverrideLevels = new HashSet();
LevelLayoutDataBlock block = GameDataBlockBase.GetBlock("2026_F.04_Layout");
if (block != null)
{
ForceOverrideLevels.Add(((GameDataBlockBase)(object)block).persistentID);
}
}
}
[HarmonyPatch]
internal class RundownSelectionCustomization
{
private static uint r1TitleID;
private static uint r2TitleID;
private static uint r3TitleID;
private static uint r4TitleID;
[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 = Text.Get(r1TitleID);
((TMP_Text)val2.m_rundownText).text = Text.Get(r2TitleID);
((TMP_Text)val3.m_rundownText).text = Text.Get(r3TitleID);
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("M_Title");
if (block != null)
{
r2TitleID = ((GameDataBlockBase)(object)block).persistentID;
}
block = GameDataBlockBase.GetBlock("R_Title");
if (block != null)
{
r3TitleID = ((GameDataBlockBase)(object)block).persistentID;
}
block = GameDataBlockBase.GetBlock("T_Title");
if (block != null)
{
r4TitleID = ((GameDataBlockBase)(object)block).persistentID;
}
}
}
private static IEnumerator reverseReveal(CM_PageRundown_New p, bool hosting, Transform guixSurfaceTransform)
{
float arrowScale = p.m_tierSpacing * 5f * p.m_tierSpaceToArrowScale;
if (hosting)
{
CoroutineManager.BlinkIn(p.m_buttonConnect, 0f, (Transform)null);
yield return (object)new WaitForSeconds(0.1f);
yield return (object)new WaitForSeconds(0.24f);
((RectTransformComp)p.m_buttonConnect).SetVisible(false);
}
CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_MOVE_UP, "");
yield return CoroutineEase.EaseLocalPos(guixSurfaceTransform, Vector3.zero, new Vector3(0f, 650f, 0f), 0.5f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null);
yield return (object)new WaitForSeconds(0.1f);
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);
yield return CoroutineEase.EaseLocalScale(guixSurfaceTransform, Vector3.one, new Vector3(0.2f, 0.2f, 0.2f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null);
yield return (object)new WaitForSeconds(0.1f);
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);
yield return (object)new WaitForSeconds(0.2f);
CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_TURN, "");
yield return CoroutineEase.EaseLocalRot(guixSurfaceTransform, Vector3.zero, new Vector3(70f, 0f, 0f), 0.3f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null);
p.m_verticalArrow.SetActive(true);
yield return (object)new WaitForSeconds(0.5f);
CoroutineManager.BlinkIn(((Component)p.m_tierMarkerSectorSummary).gameObject, 0f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, "");
yield return (object)new WaitForSeconds(0.5f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_START, "");
CoroutineEase.EaseLocalScale(p.m_verticalArrow.transform, new Vector3(1f, 0f, 1f), new Vector3(1f, arrowScale, 1f), 4.3f, (EasingFunction)Easing.LinearTween, (Action)delegate
{
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_STOP, "");
}, (BoolCheck)null);
float tierMarkerDelay = 0.6f;
yield return (object)new WaitForSeconds(0.2f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_3, "");
((Component)p.m_guix_Tier3).gameObject.SetActive(true);
for (int k = 0; k < p.m_expIconsTier3.Count; k++)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier3[k]).gameObject, (float)k * 0.1f);
}
if (p.m_expIconsTier3.Count > 0)
{
p.m_tierMarker3.SetVisible(true, tierMarkerDelay);
}
yield return (object)new WaitForSeconds(1f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, "");
((Component)p.m_guix_Tier5).gameObject.SetActive(true);
for (int m = 0; m < p.m_expIconsTier5.Count; m++)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier5[m]).gameObject, (float)m * 0.1f);
}
if (p.m_expIconsTier5.Count > 0)
{
p.m_tierMarker5.SetVisible(true, tierMarkerDelay);
}
yield return (object)new WaitForSeconds(1f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_4, "");
((Component)p.m_guix_Tier4).gameObject.SetActive(true);
for (int l = 0; l < p.m_expIconsTier4.Count; l++)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier4[l]).gameObject, (float)l * 0.1f);
}
if (p.m_expIconsTier4.Count > 0)
{
p.m_tierMarker4.SetVisible(true, tierMarkerDelay);
}
yield return (object)new WaitForSeconds(1f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_2, "");
((Component)p.m_guix_Tier2).gameObject.SetActive(true);
for (int j = 0; j < p.m_expIconsTier2.Count; j++)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier2[j]).gameObject, (float)j * 0.1f);
}
if (p.m_expIconsTier2.Count > 0)
{
p.m_tierMarker2.SetVisible(true, tierMarkerDelay);
}
yield return (object)new WaitForSeconds(1f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_1, "");
((Component)p.m_guix_Tier1).gameObject.SetActive(true);
for (int i = 0; i < p.m_expIconsTier1.Count; i++)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier1[i]).gameObject, (float)i * 0.1f);
}
if (p.m_expIconsTier1.Count > 0)
{
p.m_tierMarker1.SetVisible(true, tierMarkerDelay);
}
yield return (object)new WaitForSeconds(1f);
((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();
}
}
[HarmonyPatch]
internal class DisableExpeditionFailPageArtifactDisplay
{
private class CustomExpeditionFailedSequence
{
private CM_PageExpeditionFail page;
public CustomExpeditionFailedSequence(CM_PageExpeditionFail page)
{
this.page = page;
}
public IEnumerator CustomFailedSequence()
{
yield return (object)new WaitForSeconds(0.5f);
((Component)page.m_bgCortex_text).gameObject.SetActive(false);
page.m_bgCortex_textBoxSmall.SetActive(false);
page.m_bgCortex_textBoxLarge.SetActive(false);
((Component)page.m_returnToLobby_text).gameObject.SetActive(false);
CM_PageBase.PostSound(EVENTS.PLAY_01_FIRST_TEXT_APPEAR, "");
yield return CoroutineManager.BlinkIn(page.m_bgCortex_logo, 0f);
yield return (object)new WaitForSeconds(0.3f);
CM_PageBase.PostSound(EVENTS.PLAY_01_FIRST_TEXT_APPEAR, "");
yield return CoroutineManager.BlinkIn(page.m_bgCortex_text, 0f, (Transform)null);
yield return (object)new WaitForSeconds(0.4f);
CoroutineManager.BlinkIn(page.m_bgCortex_textBoxSmall, 0f);
CoroutineManager.BlinkIn(page.m_bgCortex_textBoxLarge, 0.15f);
yield return (object)new WaitForSeconds(0.5f);
yield return CoroutineManager.BlinkOut(page.m_bgCortex_textBoxLarge, 0f);
yield return CoroutineManager.BlinkOut(page.m_bgCortex_textBoxSmall, 0f);
((Component)page.m_bgCortex_text).gameObject.SetActive(false);
yield return CoroutineManager.BlinkOut(page.m_bgCortex_logo, 0f);
yield return (object)new WaitForSeconds(1f);
CM_PageBase.PostSound(EVENTS.PLAY_06_MAIN_MENU_LAUNCH, "");
((Component)page.m_bgScare).gameObject.SetActive(true);
page.m_bgScare.Play();
yield return (object)new WaitForSeconds(0.5f);
((Component)page.m_bgScare).gameObject.SetActive(false);
yield return CoroutineManager.BlinkIn(((Component)page.m_missionFailed_text).gameObject, 0f);
yield return (object)new WaitForSeconds(0.2f);
yield return CoroutineManager.BlinkIn(((Component)page.m_returnToLobby_text).gameObject, 0f);
}
}
[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 musicPlaying = new HashSet();
public static MusicStateOverrider Current { get; private set; } = new MusicStateOverrider();
protected override string DEFINITION_NAME => "MusicState";
private CellSoundPlayer Sound => MusicManager.Current.m_machine.Sound;
public bool MCSStateLocked { get; internal set; } = false;
private Dictionary Musics { get; } = new Dictionary();
public StateReplicator StateReplicator { get; private set; }
internal void PlayMusic(string worldEventObjectFilter)
{
if (musicPlaying.Count >= 5)
{
LegacyLogger.Error("PlayMusic: There're 5 music playing now, cannot start playing more!");
return;
}
if (!Musics.ContainsKey(worldEventObjectFilter))
{
LegacyLogger.Error("Music " + worldEventObjectFilter + " is not config-ed.");
return;
}
if (musicPlaying.Contains(worldEventObjectFilter))
{
LegacyLogger.Error("Music " + worldEventObjectFilter + " is already playing");
return;
}
DoPlayMusic(worldEventObjectFilter);
LegacyLogger.Debug("Play music " + worldEventObjectFilter);
}
private void DoPlayMusic(string worldEventObjectFilter)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
musicPlaying.Add(worldEventObjectFilter);
MusicOverride musicOverride = Musics[worldEventObjectFilter];
Sound.Post(musicOverride.StartID, true);
CellSound.SetGlobalRTPCValue(musicOverride.VolumeRTPC, CellSettingsManager.SettingsData.Audio.MusicVolume.Value * 100f);
MusicManager.Current.m_machine.ChangeState((MUS_State)14);
if (SNet.IsMaster)
{
MusicSyncStruct state = new MusicSyncStruct(StateReplicator.State);
if (state.Id0 == 0)
{
state.Id0 = musicOverride.StartID;
}
else if (state.Id1 == 0)
{
state.Id1 = musicOverride.StartID;
}
else if (state.Id2 == 0)
{
state.Id2 = musicOverride.StartID;
}
else if (state.Id3 == 0)
{
state.Id3 = musicOverride.StartID;
}
else if (state.Id4 == 0)
{
state.Id4 = musicOverride.StartID;
}
StateReplicator.SetState(state);
}
}
internal void StopMusic(string worldEventObjectFilter)
{
if (!Musics.ContainsKey(worldEventObjectFilter))
{
LegacyLogger.Error("Music " + worldEventObjectFilter + " is not config-ed.");
return;
}
if (!musicPlaying.Contains(worldEventObjectFilter))
{
LegacyLogger.Error("Music " + worldEventObjectFilter + " is not playing");
return;
}
DoStopMusic(worldEventObjectFilter);
LegacyLogger.Debug("Stop music " + worldEventObjectFilter);
}
private void DoStopMusic(string worldEventObjectFilter)
{
musicPlaying.Remove(worldEventObjectFilter);
MusicOverride musicOverride = Musics[worldEventObjectFilter];
Sound.Post(musicOverride.StopID, true);
if (SNet.IsMaster)
{
MusicSyncStruct state = new MusicSyncStruct(StateReplicator.State);
if (state.Id0 == musicOverride.StartID)
{
state.Id0 = 0u;
}
if (state.Id1 == musicOverride.StartID)
{
state.Id1 = 0u;
}
if (state.Id2 == musicOverride.StartID)
{
state.Id2 = 0u;
}
if (state.Id3 == musicOverride.StartID)
{
state.Id3 = 0u;
}
if (state.Id4 == musicOverride.StartID)
{
state.Id4 = 0u;
}
StateReplicator.SetState(state);
}
}
public bool ShouldOverrideMusicState(MUS_State currentState)
{
//IL_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)
{
return false;
}
return musicPlaying.Count > 0;
}
internal void OnApplicationFocus(bool focus)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
float num = (focus ? CellSettingsManager.SettingsData.Audio.MusicVolume.Value : 0f);
foreach (string item in musicPlaying)
{
MusicOverride musicOverride = Musics[item];
CellSound.SetGlobalRTPCValue(musicOverride.VolumeRTPC, num * 100f);
}
}
internal void OnMusicVolumeSettingChange()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
foreach (string item in musicPlaying)
{
MusicOverride musicOverride = Musics[item];
CellSound.SetGlobalRTPCValue(musicOverride.VolumeRTPC, CellSettingsManager.SettingsData.Audio.MusicVolume.Value * 100f);
}
}
private void UpdateOverrideSetting()
{
if (!base.definitions.ContainsKey(0u))
{
LegacyLogger.Error($"Didn't find global definition, ('MainLevelLayout' {0})");
return;
}
Musics.Clear();
List definitions = base.definitions[0u].Definitions;
foreach (MusicOverride item in definitions)
{
string worldEventObjectFilter = item.WorldEventObjectFilter;
if (worldEventObjectFilter != null && worldEventObjectFilter.Length == 0)
{
LegacyLogger.Debug("WorldEventObjectFilter(Music name) unspecified, won't load");
continue;
}
if (item.StartID == 0)
{
LegacyLogger.Debug("StartID unspecified (could not be 0)");
continue;
}
if (item.StopID == 0)
{
LegacyLogger.Error("StopID == 0: MusicStateOverrider doesn't implement un-looped sound!");
}
Musics[item.WorldEventObjectFilter] = item;
musicStartID[item.StartID] = item;
}
}
protected override void FileChanged(LiveEditEventArgs e)
{
base.FileChanged(e);
UpdateOverrideSetting();
}
private void Reset()
{
MCSStateLocked = false;
musicPlaying.Clear();
}
private void OnStateChanged(MusicSyncStruct oldState, MusicSyncStruct newState, bool isRecall)
{
if (isRecall)
{
Reset();
TryPlay(newState.Id0);
TryPlay(newState.Id1);
TryPlay(newState.Id2);
TryPlay(newState.Id3);
TryPlay(newState.Id4);
}
void TryPlay(uint StartID)
{
if (StartID != 0 && musicStartID.TryGetValue(StartID, out var value))
{
PlayMusic(value.WorldEventObjectFilter);
}
}
}
public override void Init()
{
base.Init();
EventAPI.OnAssetsLoaded += delegate
{
if (StateReplicator == null)
{
uint num = EOSNetworking.AllotForeverReplicatorID();
if (num == 0)
{
LegacyLogger.Error("PlayMusic: failed to setup state replicator!");
}
StateReplicator = StateReplicator.Create(num, new MusicSyncStruct(), (LifeTimeType)0, (IStateReplicatorHolder)null);
StateReplicator.OnStateChanged += OnStateChanged;
}
};
}
private MusicStateOverrider()
{
UpdateOverrideSetting();
LevelAPI.OnBuildStart += Reset;
LevelAPI.OnLevelCleanup += Reset;
}
}
public struct MusicSyncStruct
{
public uint Id0;
public uint Id1;
public uint Id2;
public uint Id3;
public uint Id4;
public MusicSyncStruct()
{
Id0 = 0u;
Id1 = 0u;
Id2 = 0u;
Id3 = 0u;
Id4 = 0u;
}
public MusicSyncStruct(MusicSyncStruct o)
{
Id0 = o.Id0;
Id1 = o.Id1;
Id2 = o.Id2;
Id3 = o.Id3;
Id4 = o.Id4;
}
}
[HarmonyPatch]
internal class Patches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(MusicMachine), "ChangeState")]
private static bool Pre_MusicMachine_ChangeState(MusicMachine __instance, ref MUS_State state)
{
if (MusicStateOverrider.Current.ShouldOverrideMusicState(state))
{
if (MusicStateOverrider.Current.MCSStateLocked)
{
return false;
}
LegacyLogger.Debug("Music State overriden and locked");
state = (MUS_State)14;
MusicStateOverrider.Current.MCSStateLocked = true;
return true;
}
if (MusicStateOverrider.Current.MCSStateLocked)
{
LegacyLogger.Debug("Music State un-overriden");
}
MusicStateOverrider.Current.MCSStateLocked = false;
return true;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CellSettingsManager), "OnApplicationFocus")]
private static void Post_OnApplicationFocus(CellSettingsManager __instance, bool focus)
{
MusicStateOverrider.Current.OnApplicationFocus(focus);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CellSettings_Audio), "ApplyAllValues")]
private static void Post_ApplyAllValues(CellSettingsManager __instance)
{
MusicStateOverrider.Current.OnMusicVolumeSettingChange();
}
}
}
namespace LEGACY.LegacyOverride.GearFunctions
{
[HarmonyPatch]
internal static class Patch_BulletWeapon
{
private static uint GLUE_GUN_PID = 400u;
[HarmonyPostfix]
[HarmonyPatch(typeof(BulletWeapon), "Fire")]
private static void Post_BulletHit(BulletWeapon __instance)
{
//IL_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)
if (((GameDataBlockBase)(object)((ItemEquippable)__instance).ArchetypeData).persistentID != GLUE_GUN_PID)
{
return;
}
RaycastHit rayHit = Weapon.s_weaponRayData.rayHit;
GameObject gameObject = ((Component)((RaycastHit)(ref rayHit)).collider).gameObject;
if ((Object)(object)gameObject == (Object)null)
{
return;
}
IDamageable val = null;
BulletWeapon.s_tempColliderInfo = gameObject.GetComponent();
if ((Object)(object)BulletWeapon.s_tempColliderInfo != (Object)null)
{
val = BulletWeapon.s_tempColliderInfo.Damageable;
}
if (val == null)
{
val = gameObject.GetComponent();
}
if (val != null)
{
Agent baseAgent = val.GetBaseAgent();
EnemyAgent val2 = ((baseAgent != null) ? ((Il2CppObjectBase)baseAgent).TryCast() : null);
if ((Object)(object)val2 != (Object)null && val2.Damage.AttachedGlueRel < 1f)
{
val.GlueDamage(100f);
}
}
}
}
}
namespace LEGACY.LegacyOverride.ExpeditionIntelNotification
{
public class ExpeditionIntel
{
public bool BlinkInContent { get; set; } = true;
public float BlinkTimeInterval { get; set; } = 0.2f;
public LocalizedText Header { get; set; } = null;
public LocalizedText Text { get; set; } = null;
}
public class ExpeditionIntelNotifier : GenericExpeditionDefinitionManager
{
public static ExpeditionIntelNotifier Current { get; private set; }
private Random rand { get; } = new Random();
protected override string DEFINITION_NAME => "ExpeditionIntel";
private void ShowIntelForExpedition(ExpeditionIntel intel)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
CM_GlobalPopup val = GlobalPopupMessageManager.ShowPopup(new PopupMessage
{
BlinkInContent = intel.BlinkInContent,
BlinkTimeInterval = intel.BlinkTimeInterval,
Header = LocalizedText.op_Implicit(intel.Header),
UpperText = LocalizedText.op_Implicit(intel.Text),
PopupType = (PopupType)3,
OnCloseCallback = Action.op_Implicit((Action)delegate
{
})
});
}
internal void OnLevelSelected(ExpeditionInTierData expData)
{
if (base.definitions.ContainsKey(expData.LevelLayoutData) && base.definitions[expData.LevelLayoutData].Definitions.Count > 0)
{
List definitions = base.definitions[expData.LevelLayoutData].Definitions;
ShowIntelForExpedition(definitions[rand.Next(0, definitions.Count)]);
LegacyLogger.Warning("ShowIntelForExpedition");
}
}
private ExpeditionIntelNotifier()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
LevelAPI.OnLevelSelected += (LevelSelectedEvent)delegate(eRundownTier _, int _, ExpeditionInTierData e)
{
OnLevelSelected(e);
};
}
static ExpeditionIntelNotifier()
{
Current = new ExpeditionIntelNotifier();
}
}
}
namespace LEGACY.LegacyOverride.ForceFail
{
public class FFPlayerGroup
{
public const int MAX_PLAYER_CNT = 4;
private List isPlayerInGroup = new List();
private StateReplicator stateReplicator;
public bool enabled { get; private set; } = false;
public ImmutableList IsPlayerInGroup => isPlayerInGroup.ToImmutableList();
public bool PlayerInGroup(int playerSlotIndex)
{
if (playerSlotIndex < 0 || playerSlotIndex >= 4)
{
LegacyLogger.Error($"Invalid player slot index, should be in [0, {4}), but got {playerSlotIndex}");
return false;
}
return isPlayerInGroup[playerSlotIndex];
}
public int NumPlayersInGroup()
{
return isPlayerInGroup.Sum((bool b) => b ? 1 : 0);
}
public void Toggle(bool enabled)
{
this.enabled = enabled;
Sync();
}
public void SetPlayerInGroup(int playerSlotIndex, bool inGroup)
{
if (playerSlotIndex < 0 || playerSlotIndex >= 4)
{
LegacyLogger.Error($"Invalid player slot index, should be in [0, {4}), but got {playerSlotIndex}");
return;
}
int num = NumPlayersInGroup();
isPlayerInGroup[playerSlotIndex] = inGroup;
int num2 = NumPlayersInGroup();
if (num == 0 && num2 > 0)
{
enabled = true;
}
else if (num > 0 && num2 == 0)
{
enabled = false;
}
Sync();
}
public void ResetSynced()
{
Reset();
Sync();
}
public void ResetUnsynced()
{
Reset();
stateReplicator.SetStateUnsynced(GetSyncStruct());
}
private void Reset()
{
enabled = false;
for (int i = 0; i < isPlayerInGroup.Count; i++)
{
isPlayerInGroup[i] = false;
}
}
private void Sync()
{
stateReplicator.SetState(GetSyncStruct());
}
private void OnStateChanged(FFReplicationStruct oldState, FFReplicationStruct newState, bool isRecall)
{
if (isRecall)
{
enabled = newState.enabled;
isPlayerInGroup[0] = newState.checkP1;
isPlayerInGroup[1] = newState.checkP2;
isPlayerInGroup[2] = newState.checkP3;
isPlayerInGroup[3] = newState.checkP4;
}
}
internal FFReplicationStruct GetSyncStruct()
{
FFReplicationStruct result = new FFReplicationStruct();
result.enabled = enabled;
result.checkP1 = isPlayerInGroup[0];
result.checkP2 = isPlayerInGroup[1];
result.checkP3 = isPlayerInGroup[2];
result.checkP4 = isPlayerInGroup[3];
return result;
}
internal static FFPlayerGroup Instantiate()
{
uint num = EOSNetworking.AllotForeverReplicatorID();
if (num == 0)
{
LegacyLogger.Error("ForceFailManager: cannot instantiate replicator - id depleted");
return null;
}
FFPlayerGroup fFPlayerGroup = new FFPlayerGroup();
fFPlayerGroup.stateReplicator = StateReplicator.Create(num, new FFReplicationStruct(), (LifeTimeType)0, (IStateReplicatorHolder)null);
fFPlayerGroup.stateReplicator.OnStateChanged += fFPlayerGroup.OnStateChanged;
fFPlayerGroup.Setup();
return fFPlayerGroup;
}
private void Setup()
{
for (int i = 0; i < 4; i++)
{
isPlayerInGroup.Add(item: false);
}
LevelAPI.OnBuildStart += ResetUnsynced;
LevelAPI.OnLevelCleanup += ResetUnsynced;
}
private FFPlayerGroup()
{
}
}
public struct FFReplicationStruct
{
public bool enabled;
public bool checkP1;
public bool checkP2;
public bool checkP3;
public bool checkP4;
public FFReplicationStruct()
{
enabled = false;
checkP1 = false;
checkP2 = false;
checkP3 = false;
checkP4 = false;
}
public FFReplicationStruct(FFReplicationStruct o)
{
enabled = false;
checkP1 = false;
checkP2 = false;
checkP3 = false;
checkP4 = false;
o.enabled = enabled;
o.checkP1 = checkP1;
o.checkP2 = checkP2;
o.checkP3 = checkP3;
o.checkP4 = checkP4;
}
public FFReplicationStruct(bool enabled, bool checkP1, bool checkP2, bool checkP3, bool checkP4)
{
this.enabled = false;
this.checkP1 = false;
this.checkP2 = false;
this.checkP3 = false;
this.checkP4 = false;
this.enabled = enabled;
this.checkP1 = checkP1;
this.checkP2 = checkP2;
this.checkP3 = checkP3;
this.checkP4 = checkP4;
}
}
public class ForceFailManager
{
public const int MAX_FF_GROUP_CNT = 4;
private List playerGroups = new List();
public static ForceFailManager Current { get; private set; }
public void AddPlayerToGroup(int playerSlotIndex, int checkGroupIndex)
{
if (checkGroupIndex < 0 || checkGroupIndex >= playerGroups.Count)
{
LegacyLogger.Error($"FFManager: check group index should be non-negative and less than {playerGroups.Count} - got {checkGroupIndex}");
}
else
{
FFPlayerGroup fFPlayerGroup = playerGroups[checkGroupIndex];
fFPlayerGroup.SetPlayerInGroup(playerSlotIndex, inGroup: true);
}
}
public void ResetSynced()
{
playerGroups.ForEach(delegate(FFPlayerGroup pg)
{
pg.ResetSynced();
});
}
public void ResetUnSynced()
{
playerGroups.ForEach(delegate(FFPlayerGroup pg)
{
pg.ResetUnsynced();
});
}
public void ResetGroupSynced(int groupIndex)
{
if (groupIndex < 0 || groupIndex >= playerGroups.Count)
{
LegacyLogger.Error($"FFManager: check group index should be non-negative and less than {playerGroups.Count} - got {groupIndex}");
}
else
{
playerGroups[groupIndex].ResetSynced();
}
}
public void ToggleCheck(bool enabled)
{
playerGroups.ForEach(delegate(FFPlayerGroup pg)
{
pg.Toggle(enabled);
});
}
public bool IsCheckEnabled()
{
foreach (FFPlayerGroup playerGroup in playerGroups)
{
if (playerGroup.enabled && playerGroup.NumPlayersInGroup() > 0)
{
return true;
}
}
return false;
}
public bool ToggleCheckOnGroup(int groupIndex, bool enabled)
{
if (groupIndex < 0 || groupIndex >= playerGroups.Count)
{
LegacyLogger.Error($"FFManager: group index should be non-negative and less than {playerGroups.Count} - got {groupIndex}");
return false;
}
playerGroups[groupIndex].Toggle(enabled);
return true;
}
public void SetExpeditionFailedText(string text)
{
((TMP_Text)MainMenuGuiLayer.Current.PageExpeditionFail.m_missionFailed_text).SetText(text, true);
}
public void ResetExpeditionFailedText()
{
string text = Text.Get(962u);
((TMP_Text)MainMenuGuiLayer.Current.PageExpeditionFail.m_missionFailed_text).SetText(text, true);
}
internal bool CheckLevelForceFailed()
{
bool result = false;
foreach (FFPlayerGroup playerGroup in playerGroups)
{
if (!playerGroup.enabled)
{
continue;
}
bool flag = false;
int num = 0;
Enumerator enumerator2 = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator2.MoveNext())
{
PlayerAgent current2 = enumerator2.Current;
if (playerGroup.PlayerInGroup(current2.PlayerSlotIndex))
{
flag = ((Agent)current2).Alive || flag;
num++;
}
}
if (flag)
{
if (num == playerGroup.NumPlayersInGroup())
{
continue;
}
result = true;
break;
}
result = true;
break;
}
return result;
}
public void Init()
{
}
private void Setup()
{
for (int i = 0; i < 4; i++)
{
FFPlayerGroup fFPlayerGroup = FFPlayerGroup.Instantiate();
if (fFPlayerGroup != null)
{
playerGroups.Add(fFPlayerGroup);
continue;
}
LegacyLogger.Error($"Instantiated player group num: {playerGroups.Count}");
break;
}
}
private ForceFailManager()
{
LevelAPI.OnBuildStart += ResetUnSynced;
LevelAPI.OnLevelCleanup += ResetUnSynced;
LevelAPI.OnBuildStart += ResetExpeditionFailedText;
LevelAPI.OnBuildDone += ResetExpeditionFailedText;
EventAPI.OnManagersSetup += Setup;
}
static ForceFailManager()
{
Current = new ForceFailManager();
}
}
}
namespace LEGACY.LegacyOverride.FogBeacon
{
public class LevelSpawnedFogBeacon
{
public static uint LSFB_ITEM_DB_ID { get; private set; }
public static bool HasFogBeaconItemDBDefinition => LSFB_ITEM_DB_ID != 0;
public string WorldEventObjectFilter => def?.WorldEventObjectFilter ?? string.Empty;
public LevelSpawnedFogBeaconSettings def { get; private set; }
public HeavyFogRepellerGlobalState GlobalState { get; private set; }
public LG_PickupItem LG_PickupItem { get; private set; }
public NavMarker NavMarker { get; private set; }
public Vector3 Position
{
get
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
LG_PickupItem lG_PickupItem = LG_PickupItem;
return (lG_PickupItem != null) ? ((Component)lG_PickupItem).transform.position : Vector3.zero;
}
}
public Color NAV_MARKER_COLOR { get; } = new Color(1f, 0.75686276f, 0.14509805f);
public static LevelSpawnedFogBeacon Instantiate(eDimensionIndex dimensionIndex, LG_LayerType layer, eLocalZoneIndex localIndex, LevelSpawnedFogBeaconSettings def)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_007e: 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)
if (!HasFogBeaconItemDBDefinition)
{
LegacyLogger.Error("LevelSpawnedFogBeaconManager: ItemDatablock Definition of vanilla Fog Repeller Turbine is not found...");
return null;
}
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layer, localIndex, ref val) || (Object)(object)val == (Object)null || def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count)
{
LegacyLogger.Error($"LevelSpawnedFogBeacon: cannot find {(dimensionIndex, layer, localIndex)}, Area_{(ushort)(65 + def.AreaIndex)}");
return null;
}
AIG_CourseNode courseNode = val.m_areas[def.AreaIndex].m_courseNode;
LevelSpawnedFogBeacon levelSpawnedFogBeacon = new LevelSpawnedFogBeacon(def, courseNode);
levelSpawnedFogBeacon.def = def;
return levelSpawnedFogBeacon;
}
internal void Destroy()
{
Object.Destroy((Object)(object)((Component)LG_PickupItem.m_root).gameObject);
GlobalState = null;
LG_PickupItem = null;
def = null;
}
private LevelSpawnedFogBeacon(LevelSpawnedFogBeaconSettings def, AIG_CourseNode node)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_01a9: Unknown result type (might be due to invalid IL or missing references)
this.def = def;
GameObject val = new GameObject($"LSBF_{def.WorldEventObjectFilter}-Area_{(ushort)(65 + def.AreaIndex)}");
val.transform.SetPositionAndRotation(def.Position.ToVector3(), Quaternion.identity);
LG_PickupItem = LG_PickupItem.SpawnGenericPickupItem(val.transform);
LG_PickupItem.SpawnNode = node;
int count = ((Il2CppArrayBase>)(object)CarryItemWithGlobalStateManager.Current.m_carryItemGlobalStatesInstancesPerType)[0].Count;
LG_PickupItem.SetupAsBigPickupItem(1, LSFB_ITEM_DB_ID, false, -1);
CarryItemPickup_Core componentInChildren = ((Component)LG_PickupItem.m_root).GetComponentInChildren();
LG_PickupItem_Sync val2 = ((Il2CppObjectBase)componentInChildren.m_sync).Cast();
if ((Object)(object)val2 != (Object)null)
{
pPickupItemState state = val2.m_stateReplicator.State;
((pCourseNode)(ref state.placement.node)).Set(LG_PickupItem.SpawnNode);
}
Interact_Pickup_PickupItem val3 = ((Il2CppObjectBase)componentInChildren.m_interact).Cast();
((Component)val3).gameObject.SetActive(false);
iTerminalItem componentInChildren2 = ((Component)LG_PickupItem).GetComponentInChildren();
if (componentInChildren2 != null)
{
LG_LevelInteractionManager.DeregisterTerminalItem(componentInChildren2);
}
NavMarker = GuiManager.NavMarkerLayer.PrepareGenericMarker(((Component)LG_PickupItem).gameObject);
if ((Object)(object)NavMarker != (Object)null)
{
NavMarker.SetColor(NAV_MARKER_COLOR);
NavMarker.SetStyle((eNavMarkerStyle)14);
NavMarker.SetVisible(false);
}
iCarryItemWithGlobalState val4 = default(iCarryItemWithGlobalState);
if (!CarryItemWithGlobalStateManager.TryGetItemInstance((eCarryItemWithGlobalStateType)0, (byte)count, ref val4))
{
LegacyLogger.Error("LevelSpawnedFogBeaconManager: Didn't find GlobalState of '" + def.WorldEventObjectFilter + "'");
return;
}
GlobalState = ((Il2CppObjectBase)val4).Cast();
FogRepeller_Sphere repellerSphere = GlobalState.m_repellerSphere;
repellerSphere.GrowDuration = def.GrowDuration;
repellerSphere.ShrinkDuration = def.ShrinkDuration;
repellerSphere.Range = def.Range;
HeavyFogRepellerGlobalState globalState = GlobalState;
globalState.CallbackOnStateChange += Action.op_Implicit((Action)delegate(pCarryItemWithGlobalState_State oldState, pCarryItemWithGlobalState_State newState, bool isRecall)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_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_000b: 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_001e: Expected I4, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
eHeavyFogRepellerStatus val5 = (eHeavyFogRepellerStatus)newState.status;
eHeavyFogRepellerStatus val6 = val5;
eHeavyFogRepellerStatus val7 = val6;
switch ((int)val7)
{
case 0:
case 2:
NavMarker.SetVisible(false);
break;
case 1:
NavMarker.SetVisible(true);
if (isRecall)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(new WardenObjectiveEventData
{
Type = (eWardenObjectiveEventType)222,
WorldEventObjectFilter = WorldEventObjectFilter,
Enabled = true,
Delay = 1.1f
}, (eWardenObjectiveEventTrigger)0, true, 0f);
}
break;
}
});
}
private static void FindFogTurbineItemDBID()
{
if (!HasFogBeaconItemDBDefinition)
{
LSFB_ITEM_DB_ID = ((GameDataBlockBase)(object)GameDataBlockBase.GetBlock("Carry_HeavyFogRepeller"))?.persistentID ?? 0;
if (LSFB_ITEM_DB_ID == 0)
{
LegacyLogger.Error("LevelSpawnedFogBeaconManager: ItemDatablock Definition of vanilla Fog Repeller Turbine is not found...");
}
}
}
static LevelSpawnedFogBeacon()
{
LSFB_ITEM_DB_ID = 0u;
FindFogTurbineItemDBID();
LevelAPI.OnBuildStart += FindFogTurbineItemDBID;
}
}
public class LevelSpawnedFogBeaconSettings
{
public int AreaIndex { get; set; } = 0;
public float GrowDuration { get; set; } = 10f;
public float ShrinkDuration { get; set; } = 10f;
public float Range { get; set; } = 11f;
public string WorldEventObjectFilter { get; set; } = string.Empty;
public Vec3 Position { get; set; } = new Vec3();
}
public class LevelSpawnedFogBeaconDefinition : GlobalZoneIndex
{
public List SpawnedBeaconsInZone { get; set; } = new List
{
new LevelSpawnedFogBeaconSettings()
};
}
public class LevelSpawnedFogBeaconManager : ZoneDefinitionManager
{
private Dictionary LSFBGlobalStatesSet = new Dictionary();
public static LevelSpawnedFogBeaconManager Current { get; }
private Dictionary LevelSpawnedFogBeacons { get; } = new Dictionary();
protected override string DEFINITION_NAME => "LevelSpawnedFogBeacon";
private void Build(LevelSpawnedFogBeaconDefinition def)
{
//IL_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references)
foreach (LevelSpawnedFogBeaconSettings item in def.SpawnedBeaconsInZone)
{
if (item.WorldEventObjectFilter == null || item.WorldEventObjectFilter == string.Empty || LevelSpawnedFogBeacons.ContainsKey(item.WorldEventObjectFilter))
{
LegacyLogger.Error("LevelSpawnedFogBeaconManager: WorldEventObjectFilter '" + item.WorldEventObjectFilter + "' is either unassigned or has already been assigned.");
continue;
}
LevelSpawnedFogBeacon levelSpawnedFogBeacon = LevelSpawnedFogBeacon.Instantiate(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, item);
if (levelSpawnedFogBeacon != null)
{
LevelSpawnedFogBeacons[item.WorldEventObjectFilter] = levelSpawnedFogBeacon;
LSFBGlobalStatesSet[((Il2CppObjectBase)levelSpawnedFogBeacon.GlobalState).Pointer] = item;
LegacyLogger.Debug($"LevelSpawnedFogBeaconManager: spawned '{item.WorldEventObjectFilter}' in {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}, Area_{(ushort)(65 + item.AreaIndex)}");
}
}
}
internal LevelSpawnedFogBeaconSettings GetLSFBDef(HeavyFogRepellerGlobalState h)
{
LevelSpawnedFogBeaconSettings value;
return LSFBGlobalStatesSet.TryGetValue(((Il2CppObjectBase)h).Pointer, out value) ? value : null;
}
public void ToggleLSFBState(string worldEventgObjectFilter, bool enable)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
if (!LevelSpawnedFogBeacons.TryGetValue(worldEventgObjectFilter, out var value))
{
LegacyLogger.Error("ToggleLSFBState: '" + worldEventgObjectFilter + "' is not defined");
}
else if (SNet.IsMaster)
{
value.GlobalState.AttemptInteract(new pCarryItemWithGlobalState_Interaction
{
type = ((!enable) ? ((byte)1) : ((byte)0)),
owner = (eCarryItemWithGlobalStateOwner)2,
staticPosition = value.Position
});
}
}
private void Clear()
{
foreach (LevelSpawnedFogBeacon value in LevelSpawnedFogBeacons.Values)
{
value.Destroy();
}
LSFBGlobalStatesSet.Clear();
LevelSpawnedFogBeacons.Clear();
}
private void BuildLevelSpawnedFogBeacons()
{
if (base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData))
{
base.definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions.ForEach(Build);
}
}
private LevelSpawnedFogBeaconManager()
{
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
LevelAPI.OnBuildDone += BuildLevelSpawnedFogBeacons;
}
static LevelSpawnedFogBeaconManager()
{
Current = new LevelSpawnedFogBeaconManager();
}
}
public class RepellerSphereSetting
{
public bool InfiniteDuration { get; set; } = false;
public float GrowDuration { get; set; } = 10f;
public float ShrinkDuration { get; set; } = 10f;
public float Range { get; set; } = 11f;
}
public class BigPickupFogBeaconSetting
{
public uint MainLevelLayout { get; set; } = 0u;
public float TimeToPickup { get; set; } = 1f;
public float TimeToPlace { get; set; } = 1f;
public RepellerSphereSetting RSHold { get; set; } = new RepellerSphereSetting();
public RepellerSphereSetting RSPlaced { get; set; } = new RepellerSphereSetting();
}
internal class BigPickupFogBeaconSettingManager
{
private Dictionary fogBeaconSettings = new Dictionary();
private LiveEditListener liveEditListener;
private static readonly string CONFIG_PATH;
public static readonly BigPickupFogBeaconSetting DEDFAULT_SETTING;
public static BigPickupFogBeaconSettingManager Current { get; private set; }
internal BigPickupFogBeaconSetting SettingForCurrentLevel { get; private set; } = DEDFAULT_SETTING;
private void AddOverride(BigPickupFogBeaconSetting _override)
{
if (_override != null)
{
if (fogBeaconSettings.ContainsKey(_override.MainLevelLayout))
{
LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout);
fogBeaconSettings[_override.MainLevelLayout] = _override;
}
else
{
fogBeaconSettings.Add(_override.MainLevelLayout, _override);
}
}
}
public void Init()
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
if (!Directory.Exists(CONFIG_PATH))
{
Directory.CreateDirectory(CONFIG_PATH);
StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json"));
streamWriter.WriteLine(Json.Serialize(new BigPickupFogBeaconSetting()));
streamWriter.Flush();
streamWriter.Close();
return;
}
foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories))
{
Json.Load(item, out var config);
AddOverride(config);
}
LevelAPI.OnBuildStart += UpdateSetting;
liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true);
liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged);
}
private void FileChanged(LiveEditEventArgs e)
{
LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath);
LiveEdit.TryReadFileContent(e.FullPath, (Action)delegate(string content)
{
BigPickupFogBeaconSetting bigPickupFogBeaconSetting = Json.Deserialize(content);
AddOverride(bigPickupFogBeaconSetting);
if (GameStateManager.IsInExpedition)
{
UpdateSetting();
}
});
}
private void UpdateSetting()
{
uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData;
SettingForCurrentLevel = (fogBeaconSettings.ContainsKey(levelLayoutData) ? fogBeaconSettings[levelLayoutData] : DEDFAULT_SETTING);
LegacyLogger.Debug($"FogBeaconSettingManager: updated setting for level with main level layout id {levelLayoutData}");
}
private BigPickupFogBeaconSettingManager()
{
}
static BigPickupFogBeaconSettingManager()
{
CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "FogBeaconSetting");
DEDFAULT_SETTING = new BigPickupFogBeaconSetting();
Current = new BigPickupFogBeaconSettingManager();
}
}
}
namespace LEGACY.LegacyOverride.ExpeditionSuccessPage
{
public struct StateSync
{
public int index;
public StateSync()
{
index = 0;
}
}
public class SuccessPageCustomization
{
public string WorldEventObjectFilter { get; set; } = string.Empty;
public LocalizedText PageHeader { get; set; } = null;
public uint OverrideSuccessMusic { get; set; } = 0u;
public bool SetAsDefaultCustomization { get; set; } = false;
}
public class SuccessPageCustomizationManager : GenericExpeditionDefinitionManager
{
public static SuccessPageCustomizationManager Current { get; }
private StateReplicator StateReplicator { get; set; }
protected override string DEFINITION_NAME => "ExpeditionSuccessPage";
public SuccessPageCustomization CurrentCustomization { get; private set; }
public void ApplyCustomization(string WorldEventObjectFilter)
{
if (!base.definitions.ContainsKey(base.CurrentMainLevelLayout))
{
LegacyLogger.Error($"SuccessPageCustomization: definition not found for main level layout {base.CurrentMainLevelLayout}");
return;
}
List definitions = base.definitions[base.CurrentMainLevelLayout].Definitions;
int num = definitions.FindIndex((SuccessPageCustomization def) => def.WorldEventObjectFilter.Equals(WorldEventObjectFilter));
if (num == -1)
{
LegacyLogger.Error("SuccessPageCustomization: customization WorldEventObjectFilter '" + WorldEventObjectFilter + "' is not found");
return;
}
CurrentCustomization = definitions[num];
LegacyLogger.Debug("SuccessPageCustomization: customization with WorldEventObjectFilter '" + WorldEventObjectFilter + "' applied");
if (SNet.IsMaster)
{
StateReplicator?.SetState(new StateSync
{
index = num
});
}
}
private void SetDefaultCustomization()
{
if (!base.definitions.ContainsKey(base.CurrentMainLevelLayout))
{
LegacyLogger.Error($"SuccessPageCustomization: definition not found for main level layout {base.CurrentMainLevelLayout}");
return;
}
List definitions = base.definitions[base.CurrentMainLevelLayout].Definitions;
int num = definitions.FindIndex((SuccessPageCustomization def) => def.SetAsDefaultCustomization);
if (num != -1)
{
CurrentCustomization = definitions[num];
LegacyLogger.Debug("SuccessPageCustomization: default customization with WorldEventObjectFilter '" + CurrentCustomization.WorldEventObjectFilter + "' applied");
if (SNet.IsMaster)
{
StateReplicator?.SetState(new StateSync
{
index = num
});
}
}
}
private void OnStateChanged(StateSync oldState, StateSync newState, bool isRecall)
{
if (isRecall && base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value) && 0 <= newState.index && newState.index < value.Definitions.Count)
{
CurrentCustomization = value.Definitions[newState.index];
}
}
private void Clear()
{
CurrentCustomization = null;
}
private SuccessPageCustomizationManager()
{
LevelAPI.OnEnterLevel += SetDefaultCustomization;
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
EventAPI.OnAssetsLoaded += delegate
{
uint num = EOSNetworking.AllotForeverReplicatorID();
if (num == 0)
{
LegacyLogger.Error("SuccessPageCustomizationManager: Cannot allot replicator!");
}
else
{
StateReplicator = StateReplicator.Create(num, new StateSync
{
index = 0
}, (LifeTimeType)0, (IStateReplicatorHolder)null);
StateReplicator.OnStateChanged += OnStateChanged;
}
};
}
static SuccessPageCustomizationManager()
{
Current = new SuccessPageCustomizationManager();
}
}
}
namespace LEGACY.LegacyOverride.EventScan
{
internal class EventScanComponent : MonoBehaviour
{
public const float UPDATE_INTERVAL = 0.3f;
public const string VANILLA_CP_PREFAB_PATH = "Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_sustained_RequireAll.prefab";
private float time = float.NaN;
private float m_colorLerpDelta = 0f;
private const float LERP_DURATION = 0.5f;
public GameObject Cylinder => ((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(0)).gameObject;
public GameObject Visual => ((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(1)).gameObject;
public GameObject Information => ((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(2)).gameObject;
public GameObject TextMeshProGO => ((Component)Information.transform.GetChild(0)).gameObject;
public Renderer VisualRenderer { get; private set; }
public TextMeshPro DisplayText { get; private set; }
private Vector3 Position => ((Component)this).gameObject.transform.position;
public StateReplicator StateReplicator { get; private set; }
public EventScanDefinition def { get; internal set; }
public Color Color_Waiting { get; private set; }
public Color Color_Active { get; private set; }
public void Setup()
{
//IL_0037: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
if (def == null)
{
LegacyLogger.Error("EventScan Setup: assign a EventScanDefinition before calling Setup()!");
return;
}
((Component)this).gameObject.transform.SetPositionAndRotation(def.Position.ToVector3(), Quaternion.identity);
((Component)this).gameObject.SetActiveRecursively(true);
GameObject loadedAsset = AssetAPI.GetLoadedAsset("Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_sustained_RequireAll.prefab");
if ((Object)(object)loadedAsset != (Object)null)
{
GameObject gameObject = ((Component)loadedAsset.transform.GetChild(0).GetChild(1)).gameObject;
GameObject val = Object.Instantiate(gameObject.gameObject);
val.transform.SetParent(((Component)this).gameObject.transform, false);
val.transform.localScale = new Vector3(1f / def.Radius, 1f / def.Radius, 1f / def.Radius);
DisplayText = val.GetComponentInChildren();
if ((Object)(object)DisplayText != (Object)null)
{
((TMP_Text)DisplayText).SetText(LocalizedText.op_Implicit(def.DisplayText), true);
((TMP_Text)DisplayText).ForceMeshUpdate(false, false);
}
else
{
LegacyLogger.Error("EventScan: instantiation error - cannot find TMPPro from vanilla CP!");
}
}
else
{
LegacyLogger.Error("EventScan: instantiation error - cannot instantiate vanilla CP!");
}
Vec3 waiting = def.ColorSetting.Waiting;
Vec3 active = def.ColorSetting.Active;
Color_Waiting = new Color(waiting.x, waiting.y, waiting.z);
Color_Active = new Color(active.x, active.y, active.z);
float num = 0.16216217f;
((Component)this).gameObject.transform.localScale = new Vector3(def.Radius, def.Radius, def.Radius);
Transform transform = ((Component)this).gameObject.transform;
transform.localPosition += Vector3.up * num;
VisualRenderer = Visual.gameObject.GetComponentInChildren();
VisualRenderer.material.SetColor("_ColorA", Color_Waiting);
uint num2 = EOSNetworking.AllotReplicatorID();
if (num2 == 0)
{
LegacyLogger.Error("EventScan: Replicator ID depleted, cannot setup");
return;
}
StateReplicator = StateReplicator.Create(num2, new EventScanStatus
{
Status = EventScanState.Waiting
}, (LifeTimeType)1, (IStateReplicatorHolder)null);
StateReplicator.OnStateChanged += OnStateChange;
}
private void OnStateChange(EventScanStatus oldState, EventScanStatus newState, bool isRecall)
{
LegacyLogger.Warning($"EventScan: {oldState.Status} => {newState.Status}");
switch (newState.Status)
{
case EventScanState.Disabled:
{
m_colorLerpDelta = 0f;
TextMeshPro displayText3 = DisplayText;
if (displayText3 != null)
{
((Component)displayText3).gameObject.SetActive(false);
}
Cylinder.SetActive(false);
CoroutineManager.BlinkOut(Visual, 0f);
break;
}
case EventScanState.Waiting:
if (!Visual.active)
{
CoroutineManager.BlinkIn(Visual, 0f);
if (def.DisplayCylinder)
{
Cylinder.SetActive(true);
}
TextMeshPro displayText2 = DisplayText;
if (displayText2 != null)
{
((Component)displayText2).gameObject.SetActive(true);
}
}
if (!isRecall && oldState.Status == EventScanState.Active)
{
def.EventsOnDeactivate.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
}
break;
case EventScanState.Active:
if (!Visual.active)
{
CoroutineManager.BlinkIn(Visual, 0f);
if (def.DisplayCylinder)
{
Cylinder.SetActive(true);
}
TextMeshPro displayText = DisplayText;
if (displayText != null)
{
((Component)displayText).gameObject.SetActive(true);
}
}
if (!isRecall && oldState.Status == EventScanState.Waiting)
{
def.EventsOnActivate.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
}
break;
}
}
public void ChangeToState(EventScanState newState)
{
ChangedToStateUnsynced(newState);
if (SNet.IsMaster)
{
StateReplicator.SetState(new EventScanStatus
{
Status = newState
});
}
}
private void ChangedToStateUnsynced(EventScanState newState)
{
}
private void Update()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Invalid comparison between Unknown and I4
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
EventScanState status = StateReplicator.State.Status;
if (status == EventScanState.Disabled)
{
return;
}
float num = Clock.Delta / 0.5f;
if (status == EventScanState.Waiting)
{
num = 0f - num;
}
m_colorLerpDelta = Mathf.Clamp01(m_colorLerpDelta + num);
Color val = Color.Lerp(Color_Waiting, Color_Active, Mathf.Pow(m_colorLerpDelta, 5f));
VisualRenderer.sharedMaterial.SetColor("_ColorA", val);
if (!float.IsNaN(time) && Clock.Time < time + 0.3f)
{
return;
}
time = Clock.Time + 0.3f;
if (def.ActiveCondition.RequiredPlayerCount == 0 && def.ActiveCondition.RequiredBigPickupIndices.Count == 0)
{
return;
}
bool flag = false;
bool flag2 = false;
Vector3 val2;
if (def.ActiveCondition.RequiredPlayerCount > 0)
{
int num2 = 0;
Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
val2 = Position - ((Agent)current).Position;
if (((Vector3)(ref val2)).magnitude < def.Radius)
{
num2++;
if (num2 >= def.ActiveCondition.RequiredPlayerCount)
{
flag = true;
break;
}
}
}
}
else
{
flag = true;
}
if (flag)
{
List requiredBigPickupIndices = def.ActiveCondition.RequiredBigPickupIndices;
if (requiredBigPickupIndices.Count > 0)
{
int num3 = 0;
foreach (int item in requiredBigPickupIndices)
{
CarryItemPickup_Core bigPickupItem = PuzzleReqItemManager.Current.GetBigPickupItem(item);
if ((Object)(object)bigPickupItem == (Object)null)
{
num3++;
continue;
}
pPickupItemState currentState = bigPickupItem.m_sync.GetCurrentState();
Vector3 zero = Vector3.zero;
ePickupItemStatus status2 = currentState.status;
ePickupItemStatus val3 = status2;
if ((int)val3 != 0)
{
if ((int)val3 != 1)
{
LegacyLogger.Error($"Item has invalid state: {currentState.status}");
continue;
}
zero = ((Component)bigPickupItem.PickedUpByPlayer).transform.position;
}
else
{
zero = ((Component)bigPickupItem).transform.position;
}
val2 = Position - zero;
if (((Vector3)(ref val2)).magnitude < def.Radius)
{
num3++;
}
}
flag2 = num3 >= requiredBigPickupIndices.Count;
}
else
{
flag2 = true;
}
}
switch (status)
{
case EventScanState.Waiting:
if (flag && flag2)
{
ChangeToState(EventScanState.Active);
}
break;
case EventScanState.Active:
if (!flag || !flag2)
{
ChangeToState(EventScanState.Waiting);
}
break;
}
}
private void OnDestroy()
{
def = null;
VisualRenderer = null;
DisplayText = null;
StateReplicator = null;
}
static EventScanComponent()
{
ClassInjector.RegisterTypeInIl2Cpp();
}
}
public class ColorSetting
{
public Vec3 Waiting { get; set; } = new Vec3
{
x = 0.5294f,
y = 0.8078f,
z = 0.9215f
};
public Vec3 Active { get; set; } = new Vec3
{
x = 1f,
y = 0.7529f,
z = 0.145f
};
}
public class ActiveCondition
{
public int RequiredPlayerCount { get; set; } = 0;
public List RequiredBigPickupIndices { get; set; } = new List();
}
public class EventScanDefinition
{
public string WorldEventObjectFilter { get; set; } = string.Empty;
public Vec3 Position { get; set; } = new Vec3();
public float Radius { get; set; } = 3.2f;
public bool DisplayCylinder { get; set; } = true;
public ColorSetting ColorSetting { get; set; } = new ColorSetting();
public LocalizedText DisplayText { get; set; } = null;
public ActiveCondition ActiveCondition { get; set; } = new ActiveCondition();
public List EventsOnActivate { get; set; } = new List();
public List EventsOnDeactivate { get; set; } = new List();
}
internal class EventScanManager : GenericExpeditionDefinitionManager
{
private Dictionary> eventScans = new Dictionary>();
public static EventScanManager Current { get; private set; }
protected override string DEFINITION_NAME => "EventScan";
private void BuildEventScan(EventScanDefinition def)
{
//IL_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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = def.Position.ToVector3();
if (!(val == Vector3.zero))
{
GameObject val2 = Object.Instantiate(Assets.EventScan);
EventScanComponent eventScanComponent = val2.AddComponent();
eventScanComponent.def = def;
eventScanComponent.Setup();
List list = null;
if (eventScans.ContainsKey(def.WorldEventObjectFilter))
{
list = eventScans[def.WorldEventObjectFilter];
}
else
{
list = new List();
eventScans[def.WorldEventObjectFilter] = list;
}
list.Add(eventScanComponent);
}
}
public void ToggleEventScanState(string WorldEventObjectFilter, bool active = true)
{
if (!eventScans.ContainsKey(WorldEventObjectFilter))
{
LegacyLogger.Error("ToggleEventScanState: " + WorldEventObjectFilter + " does not correspond to any event scans!");
return;
}
foreach (EventScanComponent item in eventScans[WorldEventObjectFilter])
{
if (!active && item.StateReplicator.State.Status != EventScanState.Disabled)
{
item.ChangeToState(EventScanState.Disabled);
}
else if (active && item.StateReplicator.State.Status == EventScanState.Disabled)
{
item.ChangeToState(EventScanState.Waiting);
}
}
}
private void Build()
{
if (base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData))
{
GenericExpeditionDefinition val = base.definitions[RundownManager.ActiveExpedition.LevelLayoutData];
val.Definitions.ForEach(BuildEventScan);
}
}
private void Clear()
{
foreach (List value in eventScans.Values)
{
foreach (EventScanComponent item in value)
{
Object.Destroy((Object)(object)((Component)item).gameObject);
}
}
eventScans.Clear();
}
static EventScanManager()
{
Current = new EventScanManager();
}
private EventScanManager()
{
LevelAPI.OnBuildDone += Build;
LevelAPI.OnLevelCleanup += Clear;
}
}
public enum EventScanState
{
Disabled,
Waiting,
Active
}
public struct EventScanStatus
{
public EventScanState Status;
}
}
namespace LEGACY.LegacyOverride.EnemyTagger
{
public enum eEnemyTaggerState
{
Uninitialized,
Inactive,
Active_Warmup,
Active_Tagging
}
public class EnemyTaggerComponent : MonoBehaviour
{
private const float INACTIVE_SOUND_UPDATE_INTERVAL = 4f;
internal int MaxTagPerScan = 12;
internal float TagInterval = 3f;
internal float TagRadius = 12f;
internal float WarmupTime = 3f;
private eEnemyTaggerState CurrentState = eEnemyTaggerState.Uninitialized;
private CellSoundPlayer m_sound = new CellSoundPlayer();
private List TaggableEnemies = new List();
private float UpdateTime = 0f;
internal CarryItemPickup_Core Parent { get; set; } = null;
internal PlayerAgent PickedByPlayer { get; set; } = null;
internal Vector3 Position => ((Object)(object)Parent == (Object)null) ? Vector3.zero : (((Object)(object)PickedByPlayer == (Object)null) ? ((Component)Parent).transform.position : ((Component)PickedByPlayer).transform.position);
public void ChangeState(eEnemyTaggerState newState)
{
if (CurrentState == newState)
{
return;
}
switch (newState)
{
case eEnemyTaggerState.Uninitialized:
LegacyLogger.Error("Enemy Tagger changed to state 'uninitialized'?");
return;
case eEnemyTaggerState.Inactive:
UpdateTime = 0f;
TaggableEnemies.Clear();
m_sound.Post(EVENTS.BULKHEAD_BUTTON_CLOSE, true);
break;
case eEnemyTaggerState.Active_Warmup:
UpdateTime = 0f;
m_sound.Post(EVENTS.BUTTONGENERICDEACTIVATE, true);
break;
case eEnemyTaggerState.Active_Tagging:
if (CurrentState != eEnemyTaggerState.Active_Warmup)
{
UpdateTime = 0f;
}
break;
default:
LegacyLogger.Error($"Enemy Tagger: Undefined state {CurrentState}");
return;
}
CurrentState = newState;
}
private bool UpdateTaggableEnemies()
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
TaggableEnemies.Clear();
bool result = false;
List reachableEnemiesInNodes = AIG_CourseGraph.GetReachableEnemiesInNodes(((Object)(object)PickedByPlayer == (Object)null) ? ((ItemInLevel)Parent).m_courseNode : ((Agent)PickedByPlayer).CourseNode, 2);
Enumerator enumerator = reachableEnemiesInNodes.GetEnumerator();
while (enumerator.MoveNext())
{
EnemyAgent current = enumerator.Current;
if (!((Agent)current).Alive)
{
continue;
}
Vector3 val = ((Component)current).transform.position - Position;
float magnitude = ((Vector3)(ref val)).magnitude;
if (!(magnitude > TagRadius))
{
result = true;
if (!current.IsTagged)
{
TaggableEnemies.Add(current);
}
if (TaggableEnemies.Count >= MaxTagPerScan)
{
break;
}
}
}
return result;
}
private void StartTagging()
{
if (!(UpdateTime >= TagInterval))
{
return;
}
if (SNet.IsMaster)
{
UpdateTaggableEnemies();
foreach (EnemyAgent taggableEnemy in TaggableEnemies)
{
ToolSyncManager.WantToTagEnemy(taggableEnemy);
}
}
UpdateTime = 0f;
}
private void StopTagging()
{
if (UpdateTime >= 4f)
{
m_sound.Post(EVENTS.BUTTONGENERICDEACTIVATE, true);
UpdateTime = 0f;
}
}
private void Warmup()
{
if (UpdateTime >= WarmupTime)
{
ChangeState(eEnemyTaggerState.Active_Tagging);
UpdateTime = TagInterval;
}
}
private void Update()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
if (CurrentState == eEnemyTaggerState.Uninitialized)
{
return;
}
if ((Object)(object)Parent == (Object)null)
{
LegacyLogger.Error("EnemyTagger: null parent");
return;
}
UpdateTime += Time.deltaTime;
m_sound.UpdatePosition(Position);
switch (CurrentState)
{
case eEnemyTaggerState.Active_Warmup:
Warmup();
break;
case eEnemyTaggerState.Active_Tagging:
StartTagging();
break;
case eEnemyTaggerState.Inactive:
StopTagging();
break;
}
}
private void OnDestroy()
{
StopTagging();
TaggableEnemies.Clear();
TaggableEnemies = null;
if (m_sound != null)
{
m_sound.Stop();
m_sound.Recycle();
m_sound = null;
}
Parent = null;
}
static EnemyTaggerComponent()
{
ClassInjector.RegisterTypeInIl2Cpp();
}
}
public class EnemyTaggerSetting
{
public uint MainLevelLayout { get; set; } = 0u;
public float TimeToPickup { get; set; } = 1f;
public float TimeToPlace { get; set; } = 1f;
public float WarmupTime { get; set; } = 5f;
public int MaxTagPerScan { get; set; } = 12;
public float TagInterval { get; set; } = 3f;
public float TagRadius { get; set; } = 12f;
public bool TagWhenPlaced { get; set; } = true;
public bool TagWhenHold { get; set; } = false;
public bool UseVisual { get; set; } = false;
}
internal class EnemyTaggerSettingManager
{
public static readonly EnemyTaggerSettingManager Current;
private Dictionary enemyTaggerSettingSettings = new Dictionary();
private LiveEditListener liveEditListener;
private static readonly string CONFIG_PATH;
private static readonly EnemyTaggerSetting DEFAULT;
private List