Decompiled source of AdvancedWardenObjective v2.5.4

AdvancedWardenObjective.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using AIGraph;
using AK;
using AWO.CustomFields;
using AWO.Jsons;
using AWO.Modules.TSL;
using AWO.Modules.WEE;
using AWO.Modules.WEE.Detours;
using AWO.Modules.WEE.Events;
using AWO.Modules.WEE.JsonInjects;
using AWO.Modules.WEE.Replicators;
using AWO.Modules.WOE;
using AWO.Sessions;
using AWO.Utils;
using Agents;
using AmorLib.API;
using AmorLib.Events;
using AmorLib.Networking.StateReplicators;
using AmorLib.Utils;
using AmorLib.Utils.Extensions;
using AmorLib.Utils.JsonElementConverters;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Hook;
using BepInEx.Unity.IL2CPP.Utils;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using CellMenu;
using ChainedPuzzles;
using Enemies;
using Expedition;
using FluffyUnderware.DevTools.Extensions;
using GTFO.API;
using GTFO.API.Extensions;
using GTFO.API.Utilities;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.Runtime;
using Il2CppJsonNet;
using Il2CppJsonNet.Linq;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using InjectLib.FieldInjection;
using InjectLib.JsonNETInjection;
using InjectLib.JsonNETInjection.Converter;
using InjectLib.JsonNETInjection.Handler;
using InjectLib.JsonNETInjection.Supports;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using PlayerCoverage;
using SNetwork;
using TMPro;
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("AdvancedWardenObjective")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9066883ef3e7b1d18e849a982da20a4fea95afc0")]
[assembly: AssemblyProduct("AdvancedWardenObjective")]
[assembly: AssemblyTitle("AdvancedWardenObjective")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace AWO
{
	internal static class Configuration
	{
		private static readonly ConfigFile Config;

		private static readonly ConfigEntry<bool> Config_VerboseEnabled;

		public static bool VerboseEnabled => Config_VerboseEnabled.Value;

		static Configuration()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "AWO.cfg"), true);
			string text = "General Settings";
			string text2 = "Enable Verbose Debug Logging";
			string text3 = "Prints some additional logs to the console, which may be useful for rundown devs";
			Config_VerboseEnabled = Config.Bind<bool>(text, text2, false, text3);
		}

		public static void Init()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			LiveEditListener val = LiveEdit.CreateListener(Paths.ConfigPath, "AWO.cfg", false);
			val.FileChanged += new LiveEditEventHandler(OnFileChanged);
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(28, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Verbose logging is enabled: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(VerboseEnabled);
			}
			Logger.Debug(val2);
		}

		private static void OnFileChanged(LiveEditEventArgs e)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config file changed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.FullPath);
			}
			Logger.Warn(val);
			Config.Reload();
		}
	}
	[BepInPlugin("GTFO.AWO", "AWO", "2.5.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal sealed class EntryPoint : BasePlugin
	{
		internal static class Coroutines
		{
			public static float CountdownStarted { get; set; }
		}

		internal static class TimerMods
		{
			public static float TimeModifier { get; set; }

			public static Color TimerColor { get; set; }

			public static float SpeedModifier { get; set; }

			public static LocaleText TimerTitleText { get; set; }

			public static LocaleText TimerBodyText { get; set; }
		}

		public static BlackoutState BlackoutState { get; private set; } = new BlackoutState();

		public static SessionRandReplicator SessionRand { get; private set; } = new SessionRandReplicator();

		public override void Load()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Configuration.Init();
			WardenEventExt.Initialize();
			new Harmony("AWO.Harmony").PatchAll();
			AssetAPI.OnStartupAssetsLoaded += delegate
			{
				LevelFailUpdateState.AssetLoaded();
			};
			LevelAPI.OnBuildDone += OnBuildDone;
			LevelAPI.OnLevelCleanup += OnLevelCleanup;
			WOEventDataFields.Init();
			SerialLookupManager.Init();
			Logger.Info("AWO is done loading!");
		}

		private void OnBuildDone()
		{
			BlackoutState.Setup();
			SessionRand.Setup(1u, RundownManager.GetActiveExpeditionData().sessionSeed);
		}

		private void OnLevelCleanup()
		{
			WardenObjectiveManager.m_exitEventsTriggered = false;
			BlackoutState.Cleanup();
			SessionRand.Cleanup();
		}
	}
	internal static class Logger
	{
		private static readonly ManualLogSource MLS;

		private const string Dev = "Dev";

		static Logger()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			MLS = new ManualLogSource("AWO");
			Logger.Sources.Add((ILogSource)(object)MLS);
		}

		private static string Format(string module, object msg)
		{
			return $"[{module}] {msg}";
		}

		public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
		{
			MLS.LogInfo(handler);
		}

		public static void Info(string str)
		{
			MLS.LogMessage((object)str);
		}

		public static void Info(string module, object data)
		{
			MLS.LogMessage((object)Format(module, data));
		}

		public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
		{
			MLS.LogDebug(handler);
		}

		public static void Debug(string str)
		{
			MLS.LogDebug((object)str);
		}

		public static void Debug(string module, object data)
		{
			MLS.LogDebug((object)Format(module, data));
		}

		public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
		{
			MLS.LogError(handler);
		}

		public static void Error(string str)
		{
			MLS.LogError((object)str);
		}

		public static void Error(string module, object data)
		{
			MLS.LogError((object)Format(module, data));
		}

		public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
		{
			MLS.LogWarning(handler);
		}

		public static void Warn(string str)
		{
			MLS.LogWarning((object)str);
		}

		public static void Warn(string module, object data)
		{
			MLS.LogWarning((object)Format(module, data));
		}

		public static void Verbose(LogLevel level, string data)
		{
			//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_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)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			if (!Configuration.VerboseEnabled)
			{
				return;
			}
			if ((int)level <= 4)
			{
				if ((int)level != 2)
				{
					if ((int)level == 4)
					{
						Warn("Dev", data);
					}
				}
				else
				{
					Error("Dev", data);
				}
			}
			else if ((int)level != 16)
			{
				if ((int)level == 32)
				{
					Debug("Dev", data);
				}
			}
			else
			{
				Info("Dev", data);
			}
		}
	}
}
namespace AWO.Utils
{
	public static class NumberExtension
	{
		public static bool IsPrime(this int num)
		{
			if (num < 2)
			{
				return false;
			}
			if (num % 2 == 0)
			{
				return num == 2;
			}
			int num2 = (int)Math.Sqrt(num);
			for (int i = 3; i <= num2; i += 2)
			{
				if (num % i == 0)
				{
					return false;
				}
			}
			return true;
		}
	}
	public static class RandomExtensions
	{
		public static bool MeetProbability(this Random rand, float prob)
		{
			if (prob >= 1f)
			{
				return true;
			}
			if (prob <= 0f)
			{
				return false;
			}
			return prob >= rand.NextFloat();
		}

		public static float NextRange(this Random rand, float min, float max)
		{
			return rand.NextFloat() * (max - min) + min;
		}

		public static float NextFloat(this Random rand)
		{
			return rand.NextSingle();
		}
	}
}
namespace AWO.Sessions
{
	internal struct BlackoutStatus
	{
		public bool blackoutEnabled;
	}
	internal sealed class BlackoutState : IStateReplicatorHolder<BlackoutStatus>
	{
		public StateReplicator<BlackoutStatus>? Replicator { get; private set; }

		public bool BlackoutEnabled { get; private set; }

		public void Setup()
		{
			BlackoutEnabled = false;
			Replicator = StateReplicator<BlackoutStatus>.Create(1u, new BlackoutStatus
			{
				blackoutEnabled = false
			}, (LifeTimeType)1, (IStateReplicatorHolder<BlackoutStatus>)this);
		}

		public void Cleanup()
		{
			BlackoutEnabled = false;
			Replicator?.Unload();
		}

		public void SetEnabled(bool enabled)
		{
			Replicator?.SetState(new BlackoutStatus
			{
				blackoutEnabled = enabled
			});
		}

		public void OnStateChange(BlackoutStatus oldState, BlackoutStatus state, bool isRecall)
		{
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Invalid comparison between Unknown and I4
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Invalid comparison between Unknown and I4
			if (oldState.blackoutEnabled == state.blackoutEnabled)
			{
				return;
			}
			bool flag = !state.blackoutEnabled;
			foreach (LG_LabDisplay item in LG_Objects.TrackedList<LG_LabDisplay>())
			{
				if ((Object)(object)((item != null) ? item.m_Text : null) != (Object)null)
				{
					((Behaviour)item.m_Text).enabled = flag;
				}
			}
			GUIX_VirtualSceneLink val = default(GUIX_VirtualSceneLink);
			foreach (LG_ComputerTerminal item2 in LG_Objects.TrackedList<LG_ComputerTerminal>())
			{
				if ((Object)(object)item2 == (Object)null)
				{
					continue;
				}
				item2.OnProximityExit();
				Interact_ComputerTerminal componentInChildren = ((Component)item2).GetComponentInChildren<Interact_ComputerTerminal>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					((Behaviour)componentInChildren).enabled = flag;
					((Interact_Base)componentInChildren).SetActive(flag);
				}
				if (GameObjectPlusExtensions.TryAndGetComponent<GUIX_VirtualSceneLink>(((Component)item2).gameObject, ref val) && (Object)(object)val.m_virtualScene != (Object)null)
				{
					((Component)val.m_virtualScene).gameObject.SetActive(flag);
				}
				if ((Object)(object)item2.m_text != (Object)null)
				{
					((Behaviour)item2.m_text).enabled = flag;
				}
				if (!flag)
				{
					PlayerAgent localInteractionSource = item2.m_localInteractionSource;
					if ((Object)(object)localInteractionSource != (Object)null && localInteractionSource.FPItemHolder.InTerminalTrigger)
					{
						item2.ExitFPSView();
					}
				}
			}
			foreach (LG_DoorButton item3 in LG_Objects.TrackedList<LG_DoorButton>())
			{
				if ((Object)(object)item3 == (Object)null)
				{
					continue;
				}
				((Component)item3.m_anim).gameObject.SetActive(flag);
				item3.m_enabled = flag;
				if (flag)
				{
					LG_WeakLock componentInChildren2 = ((Component)item3).GetComponentInChildren<LG_WeakLock>();
					if ((Object)(object)componentInChildren2 != (Object)null && (int)componentInChildren2.Status != 3)
					{
						item3.m_enabled = false;
					}
				}
			}
			foreach (LG_WeakLock item4 in LG_Objects.TrackedList<LG_WeakLock>())
			{
				if (!((Object)(object)item4 == (Object)null))
				{
					((Interact_Base)item4.m_intHack).m_isActive = flag;
					Transform val2 = ((Component)item4).transform.FindChild("HackableLock/SecurityLock/g_WeakLock/Security_Display_Locked") ?? ((Component)item4).transform.FindChild("HackableLock/Security_Display_Locked");
					if ((Object)(object)val2 != (Object)null)
					{
						((Component)val2).gameObject.active = flag;
					}
				}
			}
			foreach (LG_HSUActivator_Core item5 in LG_Objects.TrackedList<LG_HSUActivator_Core>())
			{
				if ((Object)(object)item5 == (Object)null || !item5.m_isWardenObjective || (int)item5.m_stateReplicator.State.status != 0)
				{
					continue;
				}
				item5.m_insertHSUInteraction.SetActive(flag);
				foreach (GameObject item6 in (Il2CppArrayBase<GameObject>)(object)item5.m_activateWhenActive)
				{
					item6.SetActive(flag);
				}
			}
			BlackoutEnabled = state.blackoutEnabled;
		}
	}
	internal enum LevelFailMode
	{
		Default,
		Never,
		AnyPlayerDown
	}
	internal struct LevelFailCheck
	{
		public LevelFailMode mode;
	}
	internal static class LevelFailUpdateState
	{
		public static StateReplicator<LevelFailCheck>? Replicator;

		public static bool LevelFailAllowed { get; private set; } = true;

		public static bool LevelFailWhenAnyPlayerDown { get; private set; } = false;

		internal static void AssetLoaded()
		{
			Replicator = StateReplicator<LevelFailCheck>.Create(1u, new LevelFailCheck
			{
				mode = LevelFailMode.Default
			}, (LifeTimeType)0, (IStateReplicatorHolder<LevelFailCheck>)null);
			Replicator.OnStateChanged += OnStateChanged;
			LevelAPI.OnLevelCleanup += LevelCleanup;
			LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)delegate
			{
				Replicator?.ClearAllRecallSnapshot();
				Replicator?.SetState(new LevelFailCheck
				{
					mode = LevelFailMode.Default
				});
			});
		}

		private static void LevelCleanup()
		{
			SetFailAllowed(allowed: true);
		}

		public static void SetFailAllowed(bool allowed)
		{
			Replicator?.SetState(new LevelFailCheck
			{
				mode = ((!allowed) ? LevelFailMode.Never : LevelFailMode.Default)
			});
		}

		public static void SetFailWhenAnyPlayerDown(bool enabled)
		{
			Replicator?.SetState(new LevelFailCheck
			{
				mode = (enabled ? LevelFailMode.AnyPlayerDown : LevelFailMode.Default)
			});
		}

		private static void OnStateChanged(LevelFailCheck _, LevelFailCheck state, bool __)
		{
			switch (state.mode)
			{
			case LevelFailMode.Default:
				LevelFailAllowed = true;
				LevelFailWhenAnyPlayerDown = false;
				break;
			case LevelFailMode.Never:
				LevelFailAllowed = false;
				LevelFailWhenAnyPlayerDown = false;
				break;
			case LevelFailMode.AnyPlayerDown:
				LevelFailAllowed = true;
				LevelFailWhenAnyPlayerDown = true;
				break;
			}
		}
	}
	public static class LG_Objects
	{
		public static ImmutableDictionary<Type, HashSet<Component>> TrackedTypes { get; private set; }

		static LG_Objects()
		{
			TrackedTypes = ImmutableDictionary.CreateRange(new KeyValuePair<Type, HashSet<Component>>[5]
			{
				new KeyValuePair<Type, HashSet<Component>>(typeof(LG_ComputerTerminal), new HashSet<Component>()),
				new KeyValuePair<Type, HashSet<Component>>(typeof(LG_DoorButton), new HashSet<Component>()),
				new KeyValuePair<Type, HashSet<Component>>(typeof(LG_HSUActivator_Core), new HashSet<Component>()),
				new KeyValuePair<Type, HashSet<Component>>(typeof(LG_LabDisplay), new HashSet<Component>()),
				new KeyValuePair<Type, HashSet<Component>>(typeof(LG_WeakLock), new HashSet<Component>())
			});
			LevelAPI.OnLevelCleanup += Clear;
		}

		private static void Clear()
		{
			CollectionExtensions.ForEachValue<Type, HashSet<Component>>((IDictionary<Type, HashSet<Component>>)TrackedTypes, (Action<HashSet<Component>>)delegate(HashSet<Component> set)
			{
				set.Clear();
			});
		}

		public static IEnumerable<T> TrackedList<T>() where T : Component
		{
			if (TrackedTypes.TryGetValue(typeof(T), out HashSet<Component> value))
			{
				return value.Cast<T>();
			}
			return Enumerable.Empty<T>();
		}

		public static void AddToTrackedList(Component itemToAdd)
		{
			if (TrackedTypes.TryGetValue(((object)itemToAdd).GetType(), out HashSet<Component> value))
			{
				value.Add(itemToAdd);
			}
		}

		public static void RemoveFromTrackedList(Component itemToRemove)
		{
			if (TrackedTypes.TryGetValue(((object)itemToRemove).GetType(), out HashSet<Component> value))
			{
				value.Remove(itemToRemove);
			}
		}
	}
	public struct SessionRandState
	{
		public uint currentStep;
	}
	public sealed class SessionRandReplicator : IStateReplicatorHolder<SessionRandState>
	{
		public StateReplicator<SessionRandState>? Replicator { get; private set; }

		public int Seed { get; private set; }

		public uint Step { get; private set; }

		public uint State { get; private set; }

		public void Setup(uint id, int seed)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Seed = seed;
			Step = 0u;
			State = (uint)Seed;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SessionSeed ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Seed);
			}
			Logger.Info(val);
			Replicator = StateReplicator<SessionRandState>.Create(id, new SessionRandState
			{
				currentStep = Step
			}, (LifeTimeType)1, (IStateReplicatorHolder<SessionRandState>)this);
		}

		public void Cleanup()
		{
			Step = 0u;
			Replicator?.Unload();
		}

		public void SyncStep()
		{
			Replicator?.SetState(new SessionRandState
			{
				currentStep = Step
			});
		}

		public void OnStateChange(SessionRandState oldState, SessionRandState state, bool isRecall)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			if (state.currentStep == Step)
			{
				Logger.Verbose((LogLevel)32, $"No change in SessionRand step from received state, isRecall: {isRecall}");
				return;
			}
			if (state.currentStep < Step)
			{
				Logger.Verbose((LogLevel)4, $"SessionRand step cannot be lowered by received state, isRecall: {isRecall}");
				Replicator?.SetStateUnsynced(new SessionRandState
				{
					currentStep = Step
				});
				return;
			}
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(59, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Jumping ahead from local step ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(Step);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to session step ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(state.currentStep);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", isRecall: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(isRecall);
			}
			Logger.Debug(val);
			Step = state.currentStep;
			Jump(Step);
		}

		public uint Next()
		{
			Replicator?.SetStateUnsynced(new SessionRandState
			{
				currentStep = ++Step
			});
			uint num = (State += 2654435769u);
			num ^= num >> 16;
			num *= 569420461;
			num ^= num >> 15;
			num *= 1935289751;
			return num ^ (num >> 15);
		}

		public void Jump(ulong steps)
		{
			if (steps != 0)
			{
				State += (uint)(int)(steps * 2654435769u);
			}
		}

		public int NextInt()
		{
			return (int)(Next() & 0x7FFFFFFF);
		}

		public int NextInt(int max)
		{
			if (max <= 0)
			{
				throw new ArgumentOutOfRangeException("max", "max must be positive.");
			}
			return (int)(NextFloat() * (float)max);
		}

		public int NextInt(int min, int max)
		{
			if (min > max)
			{
				throw new ArgumentOutOfRangeException("min", "min must be less than or equal to max.");
			}
			return min + NextInt(max - min);
		}

		public float NextFloat()
		{
			return (float)Next() * 2.3283064E-10f;
		}
	}
}
namespace AWO.Sessions.Patches
{
	[HarmonyPatch]
	internal static class Patch_InteractionOnBlackout
	{
		[HarmonyPatch(typeof(LG_ComputerTerminal), "OnProximityEnter")]
		[HarmonyPatch(typeof(LG_ComputerTerminal), "OnProximityExit")]
		[HarmonyPatch(typeof(LG_DoorButton), "OnWeakLockUnlocked")]
		[HarmonyPrefix]
		private static bool Pre_ToggleInteraction()
		{
			return !EntryPoint.BlackoutState.BlackoutEnabled;
		}
	}
	[HarmonyPatch]
	internal static class Patch_LevelFailCheck
	{
		[HarmonyPatch(typeof(WardenObjectiveManager), "CheckExpeditionFailed")]
		[HarmonyPostfix]
		[HarmonyPriority(200)]
		[HarmonyWrapSafe]
		private static void Post_CheckLevelFail(ref bool __result)
		{
			if (!LevelFailUpdateState.LevelFailAllowed)
			{
				__result = false;
			}
			else if (LevelFailUpdateState.LevelFailWhenAnyPlayerDown && HasAnyDownedPlayer())
			{
				__result = true;
			}
		}

		private static bool HasAnyDownedPlayer()
		{
			Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PlayerAgent current = enumerator.Current;
				if (!((Agent)current).Alive)
				{
					return true;
				}
			}
			return false;
		}
	}
	[HarmonyPatch]
	internal static class Patch_LG_ObjectsTrack
	{
		[HarmonyTargetMethods]
		private static IEnumerable<MethodBase> TargetMethods()
		{
			yield return AccessTools.Method(typeof(LG_ComputerTerminal), "Setup", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(LG_DoorButton), "Setup", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(LG_HSUActivator_Core), "Start", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(LG_LabDisplay), "GenerateText", new Type[2]
			{
				typeof(int),
				typeof(SubComplex)
			}, (Type[])null);
			yield return AccessTools.Method(typeof(LG_WeakLock), "Setup", (Type[])null, (Type[])null);
		}

		[HarmonyPostfix]
		private static void Post_TrackObject(Component __instance)
		{
			LG_Objects.AddToTrackedList(__instance);
		}
	}
}
namespace AWO.Modules.WOE
{
	[Obsolete]
	public static class WardenObjectiveExt
	{
		private static readonly Dictionary<eWardenObjectiveType, Type> _DTOTypes;

		private static readonly List<WOE_ContextBase> _ActiveContexts;

		static WardenObjectiveExt()
		{
			//IL_007b: 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_00a5: Expected O, but got Unknown
			//IL_018c: 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_0129: Expected O, but got Unknown
			_DTOTypes = new Dictionary<eWardenObjectiveType, Type>();
			_ActiveContexts = new List<WOE_ContextBase>();
			IEnumerable<Type> enumerable = from x in typeof(WOE_ContextBase).Assembly.GetTypes()
				where !x.IsAbstract
				where x.IsAssignableTo(typeof(WOE_ContextBase))
				select x;
			bool flag = default(bool);
			foreach (Type item in enumerable)
			{
				WOE_ContextBase wOE_ContextBase = (WOE_ContextBase)Activator.CreateInstance(item);
				if (_DTOTypes.TryGetValue(wOE_ContextBase.TargetType, out Type _))
				{
					Logger.Error("Duplicate TargetType Detected!");
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(14, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("With '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' and '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(wOE_ContextBase.GetType().Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
					}
					Logger.Error(val);
				}
				else if (!wOE_ContextBase.DataType.IsAssignableTo(typeof(WOE_DataBase)))
				{
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(41, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" does not have valid ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DataType");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (not derived from ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("WOE_DataBase");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
					}
					Logger.Error(val);
				}
				else
				{
					_DTOTypes[wOE_ContextBase.TargetType] = item;
				}
			}
			WOEvents.OnSetup += ObjectiveSetup;
			LevelAPI.OnLevelCleanup += LevelCleanup;
		}

		internal static void Initialize()
		{
		}

		private static void ObjectiveSetup(LG_LayerType layer, int chainIndex)
		{
			//IL_0001: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0083: 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)
			WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock);
			Type value;
			if (!WardenObjectiveManager.TryGetWardenObjectiveDataForLayer(layer, chainIndex, ref val))
			{
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(44, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<LG_LayerType>(layer);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" Layer (CI: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(chainIndex);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") does not have ObjectiveData!!!");
				}
				Logger.Error(val2);
			}
			else if (_DTOTypes.TryGetValue(val.Type, out value))
			{
				WOE_ContextBase wOE_ContextBase = (WOE_ContextBase)Activator.CreateInstance(value);
				wOE_ContextBase.Setup(layer, chainIndex);
				_ActiveContexts.Add(wOE_ContextBase);
			}
		}

		private static void LevelCleanup()
		{
			foreach (WOE_ContextBase activeContext in _ActiveContexts)
			{
				activeContext.OnLevelCleanup();
			}
			_ActiveContexts.Clear();
		}
	}
	public delegate void SetupObjectiveDel(LG_LayerType layer, int chainIndex);
	[Obsolete]
	internal static class WOEvents
	{
		public static event SetupObjectiveDel? OnSetup;

		internal static void Invoke_OnSetup(LG_LayerType layer, int chainIndex)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			WOEvents.OnSetup?.Invoke(layer, chainIndex);
		}
	}
	[Obsolete]
	internal abstract class WOE_ContextBase
	{
		public abstract eWardenObjectiveType TargetType { get; }

		public abstract Type DataType { get; }

		protected WOE_DataBase? Data { get; private set; }

		protected LG_LayerType Layer { get; private set; }

		protected int ChainIndex { get; private set; }

		public void Setup(LG_LayerType layer, int chainIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Layer = layer;
			ChainIndex = chainIndex;
		}

		public virtual void OnSetup()
		{
		}

		public virtual void OnBuildDone()
		{
		}

		public virtual void OnBuildDoneLate()
		{
		}

		public virtual void OnLevelCleanup()
		{
		}
	}
	[Obsolete]
	internal abstract class WOE_DataBase
	{
		public uint ObjectiveID { get; set; }

		public WardenObjectiveDataBlock? GameData { get; set; }
	}
}
namespace AWO.Modules.WOE.Objectives.Uplinks
{
	[Obsolete]
	internal sealed class WOE_UplinkContext : WOE_ContextBase
	{
		public override eWardenObjectiveType TargetType => (eWardenObjectiveType)8;

		public override Type DataType => typeof(WOE_UplinkData);
	}
	[Obsolete]
	internal sealed class WOE_UplinkData : WOE_DataBase
	{
		public UplinkCodeBehaviour[] CodeBehaviours { get; set; } = Array.Empty<UplinkCodeBehaviour>();
	}
	internal sealed class UplinkCodeBehaviour
	{
		public bool ShowCodesOnTerminal { get; set; } = false;

		public bool ShowCodesOnHUD { get; set; } = true;

		public bool ShowCodeToOtherTerminal { get; set; } = true;

		public TerminalZoneSelectionData TerminalZone { get; set; } = new TerminalZoneSelectionData();

		public TerminalOutput[] StartOutputs { get; set; } = Array.Empty<TerminalOutput>();

		public TerminalOutput[] EndOutputs { get; set; } = Array.Empty<TerminalOutput>();

		public WardenObjectiveEventData[] EventsOnStart { get; set; } = Array.Empty<WardenObjectiveEventData>();

		public WardenObjectiveEventData[] EventsOnEnd { get; set; } = Array.Empty<WardenObjectiveEventData>();
	}
}
namespace AWO.Modules.WOE.Objectives.ReactorStartups
{
	[Obsolete]
	internal sealed class WOE_ReactorStartupContext : WOE_ContextBase
	{
		public override eWardenObjectiveType TargetType => (eWardenObjectiveType)1;

		public override Type DataType => typeof(WOE_ReactorStartupData);
	}
	internal enum ReactorWavePuzzleType
	{
		Default,
		CustomLock,
		UseCommand_OnMainTerminal,
		UseCommand_InZone,
		PowerGenerator_InZone
	}
	[Obsolete]
	internal sealed class WOE_ReactorStartupData : WOE_DataBase
	{
		public bool RemoveMainStartupCommand { get; set; } = false;

		public bool RemoveMainVerifyCommand { get; set; } = false;

		public ScriptedWaveData[] WaveDatas { get; set; } = Array.Empty<ScriptedWaveData>();

		public ReactorWavePuzzleData[] WavePuzzles { get; set; } = Array.Empty<ReactorWavePuzzleData>();
	}
	internal enum SettingWarpMode
	{
		Clamped,
		Repeat,
		PingPong
	}
	internal sealed class ScriptedWaveData
	{
		public float[] IntroDuration { get; set; } = Array.Empty<float>();

		public SettingWarpMode IntroDurationWarpMode { get; set; } = SettingWarpMode.Clamped;

		public float[] WaveDuration { get; set; } = Array.Empty<float>();

		public SettingWarpMode WaveDurationWarpMode { get; set; } = SettingWarpMode.Clamped;

		public string[][] WaveInstructions { get; set; } = Array.Empty<string[]>();

		public SettingWarpMode WaveInstructionsWarpMode { get; set; } = SettingWarpMode.Clamped;
	}
	internal sealed class ReactorWavePuzzleData
	{
		public ReactorWavePuzzleType Type { get; set; } = ReactorWavePuzzleType.Default;

		public bool ShowBeacon { get; set; } = false;

		public string BeaconText { get; set; } = "Auxiliary Terminal";

		public Color BeaconColor { get; set; } = Color.magenta;

		public string Command { get; set; } = "REACTOR_CONTINUE";

		public string CommandDescription { get; set; } = "CONTINUE REACTOR STARTUP PROCESS";

		public bool ForceJumpWaveWhenSolved { get; set; } = true;
	}
}
namespace AWO.Modules.WOE.Objectives.GenClusters
{
	[Obsolete]
	internal sealed class WOE_GenClusterContext : WOE_ContextBase
	{
		public override eWardenObjectiveType TargetType => (eWardenObjectiveType)9;

		public override Type DataType => typeof(int);
	}
}
namespace AWO.Modules.WOE.JsonInjects
{
	[Obsolete]
	internal class ObjectiveDataHandler : Il2CppJsonReferenceTypeHandler<WardenObjectiveDataBlock>
	{
		public override void OnRead(in Object result, in JToken jToken)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			if ((int)jToken.Type == 1)
			{
				JObject val = (JObject)jToken;
				JToken val2 = default(JToken);
				if (val.TryGetValue("woeEnabled", ref val2) && (int)val2.Type == 9 && (bool)val2)
				{
					WardenObjectiveDataBlock val3 = ((Il2CppObjectBase)result).Cast<WardenObjectiveDataBlock>();
				}
			}
		}
	}
}
namespace AWO.Modules.WEE
{
	internal static class VanillaEventOvr
	{
		internal static bool HasOverride(eWardenObjectiveEventType type, WardenObjectiveEventData e)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			bool flag = e.Position != Vector3.zero;
			if (type - 3 > 1)
			{
				if ((int)type != 5)
				{
					if ((int)type == 16)
					{
						return flag || e.Count > 0;
					}
					return false;
				}
				return flag;
			}
			return (int)e.DimensionIndex > 0;
		}

		internal static void HandleEvent(eWardenObjectiveEventType type, WardenObjectiveEventData e, float currentDuration)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(type, e, currentDuration)), (Action)null);
		}

		private static IEnumerator Handle(eWardenObjectiveEventType type, WardenObjectiveEventData e, float currentDuration)
		{
			//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)
			float delay = Mathf.Max(e.Delay - currentDuration, 0f);
			if (delay > 0f)
			{
				int reloadCount = CheckpointManager.CheckpointUsage;
				yield return (object)new WaitForSeconds(delay);
				if (reloadCount < CheckpointManager.CheckpointUsage)
				{
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Delayed event ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<eWardenObjectiveEventType>(type);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" aborted due to checkpoint reload");
					}
					Logger.Warn(val);
					yield break;
				}
			}
			if (WorldEventManager.GetCondition(e.Condition.ConditionIndex) != e.Condition.IsTrue)
			{
				Logger.Verbose((LogLevel)32, $"Condition {e.Condition.ConditionIndex} is not met");
				yield break;
			}
			WardenObjectiveManager.DisplayWardenIntel(e.Layer, e.WardenIntel);
			if (e.DialogueID != 0)
			{
				PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false);
			}
			if (e.SoundID != 0)
			{
				PlaySound(e);
			}
			if (!SNet.IsMaster)
			{
				yield break;
			}
			switch (type - 3)
			{
			case 1:
				ToggleDimensionLights(mode: true, e.DimensionIndex);
				yield break;
			case 0:
				ToggleDimensionLights(mode: false, e.DimensionIndex);
				yield break;
			case 2:
				yield break;
			}
			if ((int)type == 16)
			{
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(SpawnEnemyOnPoint(e)), (Action)null);
			}
		}

		private static void PlaySound(WardenObjectiveEventData e)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if ((int)e.Type != 5)
			{
				WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true);
			}
			else
			{
				CellSoundPlayer val = new CellSoundPlayer();
				GameObjectPlusExtensions.PostWithCleanup(val, e.SoundID, e.Position, 1u);
			}
			string text = ((Object)e.SoundSubtitle).ToString();
			if (!string.IsNullOrWhiteSpace(text))
			{
				GuiManager.PlayerLayer.ShowMultiLineSubtitle(text);
			}
		}

		private static void ToggleDimensionLights(bool mode, eDimensionIndex dimension)
		{
			//IL_0003: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			pEnvironmentInteraction val = new pEnvironmentInteraction
			{
				EnvironmentStateChangeType = (EnvironmentStateChangeType)1,
				LightsEnabled = mode,
				DimensionIndex = dimension
			};
			EnvironmentStateManager.LogEnvironmentState("VEO SetLightMode Attempt");
			EnvironmentStateManager.Current.AttemptInteract(val);
		}

		private static IEnumerator SpawnEnemyOnPoint(WardenObjectiveEventData e)
		{
			int count = ((e.Count < 2) ? 1 : e.Count);
			LG_WorldEventObject weObject = default(LG_WorldEventObject);
			Vector3 pos = (WorldEventUtils.TryGetRandomWorldEventObjectFromFilter(e.WorldEventObjectFilter, (uint)Builder.SessionSeedRandom.Seed, ref weObject) ? ((Component)weObject).transform.position : e.Position);
			LG_WorldEventObject obj = weObject;
			object obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				LG_Area parentArea = obj.ParentArea;
				obj2 = ((parentArea != null) ? parentArea.m_courseNode : null);
			}
			if (obj2 == null)
			{
				obj2 = CourseNodeUtil.GetCourseNode(pos);
			}
			AIG_CourseNode courseNode = (AIG_CourseNode)obj2;
			if (courseNode == null)
			{
				Logger.Error("SpawnEnemyOnPoint", "Failed to find valid CourseNode from Position!");
				yield break;
			}
			AgentMode val = ((!e.Enabled) ? ((e.EnemyID != 20) ? ((AgentMode)4) : ((AgentMode)3)) : ((AgentMode)1));
			AgentMode mode = val;
			float interval = Math.Min(0.25f, 2f / (float)count);
			WaitForSeconds spawnInterval = new WaitForSeconds(interval);
			for (int i = 0; i < count; i++)
			{
				EnemyAgent.SpawnEnemy(e.EnemyID, pos, courseNode, mode);
				yield return spawnInterval;
			}
		}
	}
	internal static class WardenEventExt
	{
		internal static readonly Dictionary<WEE_Type, BaseEvent> _EventsToTrigger;

		static WardenEventExt()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			_EventsToTrigger = new Dictionary<WEE_Type, BaseEvent>();
			IEnumerable<Type> enumerable = from x in AccessTools.GetTypesFromAssembly(Assembly.GetExecutingAssembly())
				where !x.IsAbstract
				where x.IsAssignableTo(typeof(BaseEvent))
				select x;
			bool flag = default(bool);
			foreach (Type item in enumerable)
			{
				BaseEvent baseEvent = (BaseEvent)Activator.CreateInstance(item);
				if (_EventsToTrigger.TryGetValue(baseEvent.EventType, out BaseEvent value))
				{
					Logger.Error("Duplicate EventType detected!");
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(14, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("With '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(value.Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' and '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(baseEvent.Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
					}
					Logger.Error(val);
				}
				else
				{
					baseEvent.Setup();
					_EventsToTrigger[baseEvent.EventType] = baseEvent;
				}
			}
		}

		internal static void Initialize()
		{
			ClassInjector.RegisterTypeInIl2Cpp<OutsideDataReplicator>();
			ClassInjector.RegisterTypeInIl2Cpp<ScanPositionReplicator>();
			ClassInjector.RegisterTypeInIl2Cpp<ZoneLightReplicator>();
			JsonInjector.SetConverter<eWardenObjectiveEventType>((Il2CppJsonUnmanagedTypeConverter<eWardenObjectiveEventType>)new EventTypeConverter());
			JsonInjector.SetConverter<WorldEventConditionPair>((Il2CppJsonReferenceTypeConverter<WorldEventConditionPair>)(object)new ArrayableFlatConditionConverter());
			JsonInjector.SetConverter<eDimensionIndex>((Il2CppJsonUnmanagedTypeConverter<eDimensionIndex>)new ArrayableFlatEnumConverter<eDimensionIndex>());
			JsonInjector.SetConverter<LG_LayerType>((Il2CppJsonUnmanagedTypeConverter<LG_LayerType>)new ArrayableFlatEnumConverter<LG_LayerType>());
			JsonInjector.SetConverter<eLocalZoneIndex>((Il2CppJsonUnmanagedTypeConverter<eLocalZoneIndex>)new ArrayableFlatEnumConverter<eLocalZoneIndex>());
			JsonInjector.AddHandler<WardenObjectiveEventData>((Il2CppJsonReferenceTypeHandler<WardenObjectiveEventData>)(object)new EventDataHandler());
			JsonInjector.AddHandler<WorldEventFromSourceData>((Il2CppJsonReferenceTypeHandler<WorldEventFromSourceData>)(object)new TriggerDataHandler());
			WEE_EnumInjector.Inject();
			Detour_ExecuteEvent.Patch();
		}

		internal static void HandleEvent(WEE_Type type, WardenObjectiveEventData e, float currentDuration)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_00bd: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			WEE_EventData wEEData = e.GetWEEData();
			bool flag = default(bool);
			if (wEEData == null)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(76, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WardenEvent Type is Extension (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<WEE_Type>(type);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), but it's not registered to any dataholder!");
				}
				Logger.Error(val);
				return;
			}
			if (!_EventsToTrigger.TryGetValue(type, out BaseEvent value))
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<WEE_Type>(type);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Event does not exist in lookup!");
				}
				Logger.Error(val);
				return;
			}
			List<(eDimensionIndex, LG_LayerType, eLocalZoneIndex)> list = Expand(wEEData).ToList();
			foreach (var (val2, layer, val3) in list)
			{
				if (!value.AllowArrayableGlobalIndex || list.Count == 1)
				{
					wEEData.DimensionIndex = val2;
					wEEData.Layer = layer;
					wEEData.LocalIndex = val3;
					CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(value, wEEData, currentDuration)), (Action)null);
					break;
				}
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(value, wEEData.Clone(val2, layer, val3), currentDuration)), (Action)null);
			}
		}

		private static IEnumerable<(eDimensionIndex, LG_LayerType, eLocalZoneIndex)> Expand(WEE_EventData e)
		{
			foreach (eDimensionIndex d in e.ArrayableDimension.Values)
			{
				foreach (LG_LayerType l in e.ArrayableLayer.Values)
				{
					foreach (eLocalZoneIndex z in e.ArrayableZone.Values)
					{
						yield return (d, l, z);
					}
				}
			}
		}

		private static IEnumerator Handle(BaseEvent eventInstance, WEE_EventData e, float currentDuration)
		{
			float delay = Mathf.Max(e.Delay - currentDuration, 0f);
			if (delay > 0f)
			{
				int reloadCount = CheckpointManager.CheckpointUsage;
				yield return (object)new WaitForSeconds(delay);
				if (reloadCount < CheckpointManager.CheckpointUsage)
				{
					bool flag = default(bool);
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Delayed event ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<WEE_Type>(e.Type);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" aborted due to checkpoint reload");
					}
					Logger.Warn(val);
					yield break;
				}
			}
			foreach (WorldEventConditionPair condition in e.Condition)
			{
				if (WorldEventManager.GetCondition(condition.ConditionIndex) != condition.IsTrue)
				{
					Logger.Verbose((LogLevel)32, $"Condition {condition.ConditionIndex} is not met");
					yield break;
				}
			}
			if (ClearWardenIntelQueueEvent.AllowWardenIntel)
			{
				WardenObjectiveManager.DisplayWardenIntel(e.Layer, LocaleText.op_Implicit(e.WardenIntel));
			}
			else if (e.Type != WEE_Type.ClearWardenIntelQueue && e.SpecialBool)
			{
				ClearWardenIntelQueueEvent.ShowSubObjectiveMessage(e.Layer, e.WardenIntel);
			}
			if (e.Type != WEE_Type.ForcePlayPlayerDialogue)
			{
				if (e.DialogueID != 0)
				{
					PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false);
				}
				if (e.SoundID != 0)
				{
					WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true);
					string line = LocaleText.op_Implicit(e.SoundSubtitle);
					if (!string.IsNullOrWhiteSpace(line) && e.Type != WEE_Type.PlaySubtitles)
					{
						GuiManager.PlayerLayer.ShowMultiLineSubtitle(line);
					}
				}
			}
			if (e.SubObjective.DoUpdate && e.Type != WEE_Type.MultiProgression)
			{
				WardenObjectiveManager.UpdateSyncCustomSubObjective(LocaleText.op_Implicit(e.SubObjective.CustomSubObjectiveHeader), LocaleText.op_Implicit(e.SubObjective.CustomSubObjective));
			}
			if (e.Fog.DoUpdate)
			{
				EnvironmentStateManager.AttemptStartFogTransition(e.Fog.FogSetting, e.Fog.FogTransitionDuration, e.DimensionIndex);
			}
			SafeInvoke.Invoke<WEE_EventData>((Action<WEE_EventData>)eventInstance.Trigger, e);
		}
	}
	internal static class WEE_EnumInjector
	{
		public const int ExtendedIndex = 10000;

		private static readonly Dictionary<string, object> _EventTypes;

		private static int _CurrentIndex;

		static WEE_EnumInjector()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			_EventTypes = new Dictionary<string, object>();
			_CurrentIndex = 0;
			WEE_Type[] values = Enum.GetValues<WEE_Type>();
			bool flag = default(bool);
			for (int i = 0; i < values.Length; i++)
			{
				WEE_Type wEE_Type = values[i];
				string text = wEE_Type.ToString();
				AddEvent(text);
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Injecting EWOEvent: '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
				}
				Logger.Debug(val);
			}
		}

		private static void AddEvent(string name)
		{
			_EventTypes[name] = _CurrentIndex + 10000;
			_CurrentIndex++;
		}

		internal static void Inject()
		{
			EnumInjector.InjectEnumValues<eWardenObjectiveEventType>(_EventTypes);
		}
	}
	public sealed class WEE_EventData
	{
		public WEE_Type Type { get; set; }

		public Arrayable<WorldEventConditionPair> Condition { get; set; } = (Arrayable<WorldEventConditionPair>)new WorldEventConditionPair();

		public eWardenObjectiveEventTrigger Trigger { get; set; } = (eWardenObjectiveEventTrigger)0;

		public uint ChainPuzzle { get; set; } = 0u;

		public bool UseStaticBioscanPoints { get; set; } = false;

		[JsonPropertyName("DimensionIndex")]
		public Arrayable<eDimensionIndex> ArrayableDimension { get; set; } = (eDimensionIndex)0;

		[JsonIgnore]
		public eDimensionIndex DimensionIndex { get; set; }

		[JsonPropertyName("Layer")]
		public Arrayable<LG_LayerType> ArrayableLayer { get; set; } = (LG_LayerType)0;

		[JsonIgnore]
		public LG_LayerType Layer { get; set; }

		[JsonPropertyName("LocalIndex")]
		public Arrayable<eLocalZoneIndex> ArrayableZone { get; set; } = (eLocalZoneIndex)0;

		[JsonIgnore]
		public eLocalZoneIndex LocalIndex { get; set; }

		public Vector3 Position { get; set; } = Vector3.zero;

		public float Delay { get; set; } = 0f;

		public float Duration { get; set; } = 0f;

		public LocaleText WardenIntel { get; set; } = LocaleText.Empty;

		public uint SoundID { get; set; } = 0u;

		public LocaleText SoundSubtitle { get; set; } = LocaleText.Empty;

		public uint DialogueID { get; set; } = 0u;

		public int Count { get; set; } = 0;

		public bool Enabled { get; set; } = true;

		public bool SpecialBool { get; set; } = false;

		public int SpecialNumber { get; set; } = -1;

		public LocaleText SpecialText { get; set; } = LocaleText.Empty;

		public string WorldEventObjectFilter
		{
			private get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return LocaleText.op_Implicit(SpecialText);
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				SpecialText = new LocaleText(value);
			}
		}

		public WEE_SubObjectiveData SubObjective { get; set; } = new WEE_SubObjectiveData();

		public WEE_UpdateFogData Fog { get; set; } = new WEE_UpdateFogData();

		public bool CleanUpEnemiesBehind { get; set; } = true;

		public WEE_ReactorEventData? Reactor { get; set; } = null;

		public WEE_CountdownData? Countdown { get; set; } = null;

		public WEE_ZoneLightData? SetZoneLight { get; set; } = null;

		public Arrayable<WEE_CleanupEnemiesData> CleanupEnemies { get; set; } = new WEE_CleanupEnemiesData();

		public Arrayable<WEE_SpawnHibernateData> SpawnHibernates { get; set; } = new Arrayable<WEE_SpawnHibernateData>();

		public Arrayable<WEE_SpawnScoutData> SpawnScouts { get; set; } = new Arrayable<WEE_SpawnScoutData>();

		public Arrayable<WEE_AddTerminalCommand> AddTerminalCommand { get; set; } = new Arrayable<WEE_AddTerminalCommand>();

		public Arrayable<WEE_AddTerminalCommand> AddCommand
		{
			private get
			{
				return AddTerminalCommand;
			}
			set
			{
				AddTerminalCommand = value;
			}
		}

		public Arrayable<WEE_HideTerminalCommand> HideTerminalCommand { get; set; } = new Arrayable<WEE_HideTerminalCommand>();

		public Arrayable<WEE_HideTerminalCommand> HideCommand
		{
			private get
			{
				return HideTerminalCommand;
			}
			set
			{
				HideTerminalCommand = value;
			}
		}

		public Arrayable<WEE_UnhideTerminalCommand> UnhideTerminalCommand { get; set; } = new Arrayable<WEE_UnhideTerminalCommand>();

		public Arrayable<WEE_UnhideTerminalCommand> UnhideCommand
		{
			private get
			{
				return UnhideTerminalCommand;
			}
			set
			{
				UnhideTerminalCommand = value;
			}
		}

		public WEE_GiveResource? GiveResource { get; set; } = null;

		public ActiveEnemyWaveData? ActiveEnemyWave { get; set; } = null;

		public WEE_NestedEvent? NestedEvent { get; set; } = null;

		public WEE_StartEventLoop? StartEventLoop { get; set; } = null;

		public WEE_StartEventLoop? EventLoop
		{
			private get
			{
				return StartEventLoop;
			}
			set
			{
				StartEventLoop = value;
			}
		}

		public WEE_TeleportPlayer? TeleportPlayer { get; set; } = null;

		public WEE_InfectPlayer? InfectPlayer { get; set; } = null;

		public WEE_DamagePlayer? DamagePlayer { get; set; } = null;

		public WEE_RevivePlayer? RevivePlayer { get; set; } = null;

		public WEE_AdjustTimer AdjustTimer { get; set; } = new WEE_AdjustTimer();

		public WEE_CountupData? Countup { get; set; } = null;

		public Arrayable<WEE_NavMarkerData> NavMarker { get; set; } = new WEE_NavMarkerData();

		public WEE_ShakeScreen? CameraShake { get; set; } = null;

		public WEE_StartPortalMachine? Portal { get; set; } = null;

		public WEE_SetSuccessScreen? SuccessScreen { get; set; } = null;

		public List<WEE_SubObjectiveData> MultiProgression { get; set; } = new List<WEE_SubObjectiveData>();

		public WEE_PlayWaveDistantRoar? WaveRoarSound { get; set; } = null;

		public WEE_CustomHudText? CustomHudText { get; set; } = null;

		public WEE_CustomHudText? CustomHud
		{
			private get
			{
				return CustomHudText;
			}
			set
			{
				CustomHudText = value;
			}
		}

		public WEE_SpecialHudTimer? SpecialHudTimer { get; set; } = new WEE_SpecialHudTimer();

		public WEE_SpecialHudTimer? SpecialHud
		{
			private get
			{
				return SpecialHudTimer;
			}
			set
			{
				SpecialHudTimer = value;
			}
		}

		public WEE_ForcePlayerDialogue? PlayerDialogue { get; set; } = null;

		public Arrayable<WEE_SetTerminalLog> SetTerminalLog { get; set; } = new Arrayable<WEE_SetTerminalLog>();

		public Arrayable<WEE_SetTerminalLog> TerminalLog
		{
			private get
			{
				return SetTerminalLog;
			}
			set
			{
				SetTerminalLog = value;
			}
		}

		public List<WEE_SetPocketItem> ObjectiveItems { get; set; } = new List<WEE_SetPocketItem>();

		public WEE_SetOutsideDimensionData? DimensionData { get; set; } = null;

		public WEE_SetExpeditionEnvironment? EnvironmentData { get; set; } = null;

		public WEE_FadeScreenInOut? FadeScreen { get; set; } = null;

		public WEE_EventData Clone(eDimensionIndex dim, LG_LayerType layer, eLocalZoneIndex zone)
		{
			//IL_000e: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			WEE_EventData wEE_EventData = (WEE_EventData)MemberwiseClone();
			wEE_EventData.DimensionIndex = dim;
			wEE_EventData.Layer = layer;
			wEE_EventData.LocalIndex = zone;
			return wEE_EventData;
		}
	}
	public sealed class WEE_SubObjectiveData
	{
		public bool DoUpdate { get; set; } = false;

		public LocaleText CustomSubObjectiveHeader { get; set; } = LocaleText.Empty;

		public LocaleText CustomSubObjective { get; set; } = LocaleText.Empty;

		public uint Index { get; set; } = 0u;

		public int Priority { get; set; } = 1;

		public LG_LayerType Layer { get; set; } = (LG_LayerType)0;

		public bool IsLayerIndependent { get; set; } = true;

		public LocaleText OverrideTag { get; set; } = LocaleText.Empty;
	}
	public sealed class WEE_UpdateFogData
	{
		public bool DoUpdate { get; set; } = false;

		public uint FogSetting { get; set; } = 0u;

		public float FogTransitionDuration { get; set; } = 0f;
	}
	public sealed class WEE_ReactorEventData
	{
		public enum WaveState
		{
			Intro,
			Wave,
			Verify,
			Idle
		}

		public WaveState State { get; set; } = WaveState.Intro;

		public int Wave { get; set; } = 1;

		public float Progress { get; set; } = 0f;
	}
	public sealed class WEE_CountdownData
	{
		public float Duration { get; set; } = 0f;

		public bool CanShowHours { get; set; } = true;

		public LocaleText TimerText { get; set; } = LocaleText.Empty;

		public LocaleText TitleText
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return TimerText;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				TimerText = value;
			}
		}

		public Color TimerColor { get; set; } = Color.red;

		public List<EventsOnTimerProgress> EventsOnProgress { get; set; } = new List<EventsOnTimerProgress>();

		public List<WardenObjectiveEventData> EventsOnDone { get; set; } = new List<WardenObjectiveEventData>();
	}
	public sealed class WEE_CleanupEnemiesData
	{
		public enum CleanUpType
		{
			Kill,
			Despawn
		}

		public CleanUpType Type { get; set; } = CleanUpType.Despawn;

		public int AreaIndex { get; set; } = -1;

		public int[] AreaBlacklist { get; set; } = Array.Empty<int>();

		public bool IncludeHibernate { get; set; } = true;

		public bool IncludeAggressive { get; set; } = true;

		public bool IncludeScout { get; set; } = true;

		public uint[] ExcludeEnemyID { get; set; } = Array.Empty<uint>();

		public uint[] IncludeOnlyID { get; set; } = Array.Empty<uint>();

		public void DoClear(AIG_CourseNode node)
		{
			//IL_0045: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected I4, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			if (!SNet.IsMaster || node == null || node.m_enemiesInNode == null)
			{
				return;
			}
			foreach (EnemyAgent item in node.m_enemiesInNode.ToArray())
			{
				AgentMode mode = ((AgentAI)item.AI).Mode;
				if ((mode - 1) switch
				{
					0 => IncludeAggressive, 
					2 => IncludeScout, 
					3 => IncludeHibernate, 
					_ => true, 
				} && !ExcludeEnemyID.Contains(item.EnemyDataID) && (IncludeOnlyID.Length == 0 || IncludeOnlyID.Contains(item.EnemyDataID)))
				{
					switch (Type)
					{
					case CleanUpType.Despawn:
						((Agent)item).m_replicator.Despawn();
						break;
					case CleanUpType.Kill:
						item.Damage.IsImortal = false;
						item.Damage.BulletDamage(((Dam_SyncedDamageBase)item.Damage).DamageMax, (Agent)null, default(Vector3), default(Vector3), default(Vector3), false, 0, 1f, 1f, 0u);
						break;
					}
				}
			}
		}
	}
	public sealed class WEE_ZoneLightData
	{
		public enum ModifierType : byte
		{
			RevertToOriginal,
			SetZoneLightData,
			TransitionToOriginal
		}

		public ModifierType Type { get; set; } = ModifierType.RevertToOriginal;

		public uint LightDataID { get; set; } = 0u;

		public float TransitionDuration { get; set; } = 0.5f;

		public int Seed { get; set; } = 0;

		public bool UseRandomSeed => Seed == 0;
	}
	public sealed class WEE_SpawnHibernateData
	{
		public int AreaIndex { get; set; } = -1;

		public int[] AreaBlacklist { get; set; } = Array.Empty<int>();

		public uint EnemyID { get; set; } = 0u;

		public int Count { get; set; } = 0;

		public Vector3 Position { get; set; } = Vector3.zero;

		public Vector3 Rotation { get; set; } = Vector3.zero;
	}
	public sealed class WEE_SpawnScoutData
	{
		public int AreaIndex { get; set; } = -1;

		public int[] AreaBlacklist { get; set; } = Array.Empty<int>();

		public eEnemyGroupType GroupType { get; set; }

		public eEnemyRoleDifficulty Difficulty { get; set; }

		public int Count { get; set; } = 0;
	}
	public sealed class WEE_AddTerminalCommand
	{
		public struct LocaleTerminalOutput
		{
			public TerminalLineType LineType { get; set; }

			public LocaleText Output { get; set; }

			public float Time { get; set; }

			public readonly TerminalOutput ToTerminalOutput()
			{
				//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_0008: 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_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Expected O, but got Unknown
				return new TerminalOutput
				{
					LineType = LineType,
					Output = LocaleText.op_Implicit(SerialLookupManager.ParseLocaleText(Output)),
					Time = Time
				};
			}
		}

		public int TerminalIndex { get; set; } = 0;

		public int CommandNumber { get; set; } = 6;

		public string Command { get; set; } = string.Empty;

		public LocaleText CommandDesc { get; set; } = LocaleText.Empty;

		public bool AutoIndentCommandDesc { get; set; } = false;

		public List<LocaleTerminalOutput> PostCommandOutputs { get; set; } = new List<LocaleTerminalOutput>();

		public List<WardenObjectiveEventData> CommandEvents { get; set; } = new List<WardenObjectiveEventData>();

		public bool ProgressWaitBeforeEvents { get; set; } = false;

		public TERM_CommandRule SpecialCommandRule { get; set; } = (TERM_CommandRule)0;
	}
	public sealed class WEE_HideTerminalCommand
	{
		public int TerminalIndex { get; set; } = 0;

		public TERM_Command CommandEnum { get; set; } = (TERM_Command)0;

		public int CommandNumber { get; set; } = 0;

		public bool DeleteCommand { get; set; } = false;
	}
	public sealed class WEE_UnhideTerminalCommand
	{
		public int TerminalIndex { get; set; } = 0;

		public TERM_Command CommandEnum { get; set; } = (TERM_Command)0;

		public int CommandNumber { get; set; } = 0;
	}
	public sealed class WEE_GiveResource
	{
		public float Health { get; set; } = 0f;

		public float MainAmmo { get; set; } = 0f;

		public float SpecialAmmo { get; set; } = 0f;

		public float ToolAmmo { get; set; } = 0f;

		public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex>(Enum.GetValues<PlayerIndex>());

		public bool FullTeamOverflow { get; set; } = true;

		public bool UseLocation { get; set; } = false;

		public bool IncludeSupplyEfficiency { get; set; } = false;

		public bool HasAnyAmmoGain => MainAmmo != 0f || SpecialAmmo != 0f || ToolAmmo != 0f;

		public bool HasAnyGain => Health != 0f && HasAnyAmmoGain;
	}
	public sealed class WEE_NestedEvent
	{
		public enum NestedMode : byte
		{
			ActivateAll,
			RandomAny,
			RandomWeighted
		}

		public struct EventsOnRandomWeight
		{
			public string DebugName { get; set; }

			public float Weight { get; set; }

			public int RepeatCount { get; set; }

			public bool IsInfinite { get; set; }

			public List<WardenObjectiveEventData> Events { get; set; }
		}

		public NestedMode Type { get; set; } = NestedMode.ActivateAll;

		public int MaxRandomEvents { get; set; } = -1;

		public bool AllowRepeatsInRandom { get; set; } = false;

		public List<WardenObjectiveEventData> EventsToActivate { get; set; } = new List<WardenObjectiveEventData>();

		public List<EventsOnRandomWeight> WheelOfEvents { get; set; } = new List<EventsOnRandomWeight>();
	}
	public sealed class WEE_StartEventLoop
	{
		public int LoopIndex { get; set; } = 0;

		public float LoopDelay { get; set; } = 1f;

		public int LoopCount { get; set; } = -1;

		public List<WardenObjectiveEventData> EventsToActivate { get; set; } = new List<WardenObjectiveEventData>();
	}
	public enum PlayerIndex : byte
	{
		P0,
		P1,
		P2,
		P3
	}
	public sealed class WEE_TeleportPlayer
	{
		public struct TeleportData
		{
			public PlayerIndex PlayerIndex { get; set; }

			[JsonPropertyName("DimensionIndex")]
			public eDimensionIndex Dimension { get; set; }

			public Vector3 Position { get; set; }

			public string WorldEventObjectFilter { get; set; }

			[JsonPropertyName("LookDirection")]
			public int LookDir { get; set; }

			[JsonPropertyName("LookDirectionV3")]
			public Vector3 LookDirV3 { get; set; }

			public bool PlayWarpAnimation { get; set; }

			[JsonPropertyName("FlashDuration")]
			public float Duration { get; set; }

			[JsonIgnore]
			public PlayerAgent Player { get; set; }

			[JsonIgnore]
			public eDimensionIndex LastDimension { get; set; }

			[JsonIgnore]
			public Vector3 LastPosition { get; set; }

			[JsonIgnore]
			public Vector3 LastLookDirV3 { get; set; }

			[JsonIgnore]
			public List<IWarpableObject> ItemsToWarp { get; set; }
		}

		public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex>();

		public bool PlayWarpAnimation { get; set; } = true;

		public bool SendBPUsToHost { get; set; } = false;

		public Vector3 Player0Position { get; set; } = Vector3.zero;

		public int P0LookDir { get; set; } = 0;

		public Vector3 Player1Position { get; set; } = Vector3.zero;

		public int P1LookDir { get; set; } = 0;

		public Vector3 Player2Position { get; set; } = Vector3.zero;

		public int P2LookDir { get; set; } = 0;

		public Vector3 Player3Position { get; set; } = Vector3.zero;

		public int P3LookDir { get; set; } = 0;

		public bool FlashTeleport { get; set; } = false;

		public bool WarpSentries { get; set; } = true;

		public bool WarpBigPickups { get; set; } = true;

		public bool SendBigPickupsToHost
		{
			private get
			{
				return SendBPUsToHost;
			}
			set
			{
				SendBPUsToHost = value;
			}
		}

		public bool FullTeamOverflow { get; set; } = false;

		public List<TeleportData> TPData { get; set; } = new List<TeleportData>();
	}
	public sealed class WEE_InfectPlayer
	{
		public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex>
		{
			PlayerIndex.P0,
			PlayerIndex.P1,
			PlayerIndex.P2,
			PlayerIndex.P3
		};

		public bool FullTeamOverflow { get; set; } = true;

		public float InfectionAmount { get; set; } = 0f;

		public bool InfectOverTime { get; set; } = false;

		public float Interval { get; set; } = 1f;

		public bool UseZone { get; set; } = false;
	}
	public sealed class WEE_DamagePlayer
	{
		public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex>
		{
			PlayerIndex.P0,
			PlayerIndex.P1,
			PlayerIndex.P2,
			PlayerIndex.P3
		};

		public bool FullTeamOverflow { get; set; } = true;

		public float DamageAmount { get; set; } = 0f;

		public bool DealPercentageDamage { get; set; } = false;

		public bool DamageOverTime { get; set; } = false;

		public float Interval { get; set; } = 1f;

		public bool UseZone { get; set; } = false;
	}
	public sealed class WEE_RevivePlayer
	{
		public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex>
		{
			PlayerIndex.P0,
			PlayerIndex.P1,
			PlayerIndex.P2,
			PlayerIndex.P3
		};

		public bool FullTeamOverflow { get; set; } = true;
	}
	public sealed class WEE_AdjustTimer
	{
		public float Duration { get; set; } = 0f;

		public float Speed { get; set; } = 0f;

		public bool UpdateTitleText { get; set; } = false;

		public LocaleText TitleText { get; set; } = LocaleText.Empty;

		public bool UpdateText { get; set; } = false;

		public bool UpdateBodyText
		{
			private get
			{
				return UpdateText;
			}
			set
			{
				UpdateText = value;
			}
		}

		public LocaleText CustomText { get; set; } = LocaleText.Empty;

		public LocaleText BodyText
		{
			private get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return CustomText;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				CustomText = value;
			}
		}

		public bool UpdateColor { get; set; } = false;

		public Color TimerColor { get; set; } = Color.red;

		public bool UpdateSpecialHud { get; set; } = false;

		public int SpecialHudIndex { get; set; } = 0;

		public float SpecialHudTimeModifier { get; set; } = 0f;
	}
	public sealed class WEE_CountupData
	{
		public float Duration { get; set; } = 0f;

		public float StartValue { get; set; } = 0f;

		public float Speed { get; set; } = 1f;

		public LocaleText TimerText { get; set; } = LocaleText.Empty;

		public LocaleText TitleText
		{
			private get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return TimerText;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				TimerText = value;
			}
		}

		public LocaleText CustomText { get; set; } = LocaleText.Empty;

		public LocaleText BodyText
		{
			private get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return CustomText;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				CustomText = value;
			}
		}

		public Color TimerColor { get; set; } = Color.red;

		public int DecimalPoints { get; set; } = 0;

		public List<EventsOnTimerProgress> EventsOnProgress { get; set; } = new List<EventsOnTimerProgress>();

		public List<WardenObjectiveEventData> EventsOnDone { get; set; } = new List<WardenObjectiveEventData>();
	}
	public struct EventsOnTimerProgress
	{
		public float Progress { get; set; }

		public List<WardenObjectiveEventData> Events { get; set; }
	}
	public sealed class WEE_NavMarkerData
	{
		public int Index { get; set; } = 0;

		public NavMarkerOption Style { get; set; } = (NavMarkerOption)10;

		public LocaleText Title { get; set; } = LocaleText.Empty;

		public Color Color { get; set; } = new Color(0.701f, 0.435f, 0.964f, 1f);

		public bool UsePin { get; set; } = true;
	}
	public sealed class WEE_ShakeScreen
	{
		public float Radius { get; set; } = 0f;

		public float Duration { get; set; } = 0f;

		public float Amplitude { get; set; } = 0f;

		public float Frequency { get; set; } = 0f;

		public bool Directional { get; set; } = true;
	}
	public sealed class WEE_StartPortalMachine
	{
		public eDimensionIndex TargetDimension { get; set; } = (eDimensionIndex)1;

		public float TeleportDelay { get; set; } = 5f;

		public bool PreventPortalWarpTeamEvent { get; set; } = false;
	}
	public sealed class WEE_SetSuccessScreen
	{
		public enum ScreenType : byte
		{
			SetSuccessScreen,
			FlashFakeScreen
		}

		public ScreenType Type { get; set; } = ScreenType.SetSuccessScreen;

		public WinScreen CustomSuccessScreen { get; set; } = WinScreen.Empty;

		public eCM_MenuPage FakeEndScreen { get; set; } = (eCM_MenuPage)17;

		public uint OverrideMusic { get; set; } = 0u;
	}
	public sealed class WEE_PlayWaveDistantRoar
	{
		public enum WaveRoarSound : byte
		{
			Striker,
			Shooter,
			Birther,
			Shadow,
			Tank,
			Flyer,
			Immortal,
			Bullrush,
			Pouncer,
			Striker_Berserk,
			Shooter_Spread
		}

		public enum WaveRoarSize : byte
		{
			Small,
			Medium,
			Big
		}

		public WaveRoarSound RoarSound { get; set; } = WaveRoarSound.Striker;

		public WaveRoarSize RoarSize { get; set; } = WaveRoarSize.Small;

		public bool IsOutside { get; set; } = false;
	}
	public sealed class WEE_CustomHudText
	{
		public LocaleText Title { get; set; } = LocaleText.Empty;

		public LocaleText TitleText
		{
			private get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return Title;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Title = value;
			}
		}

		public LocaleText Body { get; set; } = LocaleText.Empty;

		public LocaleText BodyText
		{
			private get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return Body;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Body = value;
			}
		}
	}
	public sealed class WEE_SpecialHudTimer
	{
		public enum SpecialHudType : byte
		{
			StartTimer,
			StartIndexTimer,
			StartPersistent,
			StopIndex,
			StopAll
		}

		public float Duration { get; set; } = 0f;

		public SpecialHudType Type { get; set; } = SpecialHudType.StartTimer;

		public int Index { get; set; } = 0;

		public LocaleText Message { get; set; } = LocaleText.Empty;

		public ePUIMessageStyle Style { get; set; } = (ePUIMessageStyle)0;

		public int Priority { get; set; } = -2;

		public bool ShowTimeInProgressBar { get; set; } = true;

		public bool InvertProgress { get; set; } = false;

		public List<EventsOnTimerProgress> EventsOnProgress { get; set; } = new List<EventsOnTimerProgress>();

		public List<WardenObjectiveEventData> EventsOnDone { get; set; } = new List<WardenObjectiveEventData>();

		public bool HasIndex
		{
			get
			{
				SpecialHudType type = Type;
				if (type - 1 <= SpecialHudType.StartIndexTimer)
				{
					return true;
				}
				return false;
			}
		}
	}
	public sealed class WEE_ForcePlayerDialogue
	{
		public enum DialogueType : byte
		{
			Closest,
			Specific,
			Random
		}

		public enum PlayerIntensityState : byte
		{
			Exploration,
			Stealth,
			Encounter,
			Combat
		}

		public DialogueType Type { get; set; } = DialogueType.Closest;

		public PlayerIndex CharacterID { get; set; } = PlayerIndex.P0;

		public PlayerIntensityState IntensityState { get; set; } = PlayerIntensityState.Exploration;
	}
	public sealed class WEE_SetTerminalLog
	{
		public enum LogEventType : byte
		{
			Add,
			Remove,
			Move
		}

		public int TerminalIndex { get; set; } = 0;

		public LogEventType Type { get; set; } = LogEventType.Add;

		public eDimensionIndex TargetDimensionIndex { get; set; } = (eDimensionIndex)0;

		public LG_LayerType TargetLayer { get; set; } = (LG_LayerType)0;

		public eLocalZoneIndex TargetLocalIndex { get; set; } = (eLocalZoneIndex)0;

		public int TargetTerminalIndex { get; set; } = 0;

		public string FileName { get; set; } = string.Empty;

		public LocaleText FileContent { get; set; } = LocaleText.Empty;

		public Language FileContentOriginalLanguage { get; set; } = (Language)1;

		public uint AttachedAudioFile { get; set; } = 0u;

		public int AttachedAudioByteSize { get; set; } = 0;

		public uint PlayerDialogToTriggerAfterAudio { get; set; } = 0u;

		public List<WardenObjectiveEventData> EventsOnFileRead { get; set; } = new List<WardenObjectiveEventData>();

		public bool TryGetTargetTerminal(out LG_ComputerTerminal targetTerm)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			targetTerm = null;
			LG_Zone val = default(LG_Zone);
			if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(TargetDimensionIndex, TargetLayer, TargetLocalIndex, ref val))
			{
				return false;
			}
			if (TargetTerminalIndex < 0 || TargetTerminalIndex >= val.TerminalsSpawnedInZone.Count)
			{
				return false;
			}
			targetTerm = val.TerminalsSpawnedInZone[TargetTerminalIndex];
			return (Object)(object)targetTerm != (Object)null;
		}
	}
	public sealed class WEE_SetPocketItem
	{
		public enum PlayerTagType : byte
		{
			Custom,
			Specific,
			Random,
			Closest
		}

		public int Index { get; set; } = 0;

		public int Count { get; set; } = 0;

		public bool IsOnTop { get; set; } = false;

		public LocaleText ItemName { get; set; } = LocaleText.Empty;

		public PlayerTagType TagType { get; set; } = PlayerTagType.Custom;

		public PlayerIndex PlayerIndex { get; set; } = PlayerIndex.P0;

		public string CustomTag { get; set; } = string.Empty;

		[JsonIgnore]
		public string? Tag { get; set; } = string.Empty;

		public bool ShouldRemove => Count < 1;

		private string LiveCount => (Count > 1) ? $"{Count} " : string.Empty;

		public string FormatString()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			return $"{LiveCount}{ItemName} <uppercase><color=#ffffff{MathUtil.ZeroOneRangeToHex(0.2f)}>[{Tag}]</color></uppercase>";
		}
	}
	public sealed class WEE_SetOutsideDimensionData
	{
		public bool IsOutside { get; set; } = true;

		public ValueBase LightAzimuth { get; set; } = ValueBase.Unchanged;

		public ValueBase LightElevation { get; set; } = ValueBase.Unchanged;

		public ValueBase LightIntensity { get; set; } = ValueBase.Unchanged;

		public ValueBase AmbientIntensity { get; set; } = ValueBase.Unchanged;

		public ValueBase ReflectionsIntensity { get; set; } = ValueBase.Unchanged;

		public ValueBase GodrayRange { get; set; } = ValueBase.Unchanged;

		public ValueBase GodrayExponent { get; set; } = ValueBase.Unchanged;

		public uint AtmosphereData { get; set; } = 0u;

		public ValueBase AtmosphereDensity { get; set; } = ValueBase.Unchanged;

		public ValueBase Exposure { get; set; } = ValueBase.Unchanged;

		public ValueBase AerialScale { get; set; } = ValueBase.Unchanged;

		public ValueBase MieScattering { get; set; } = ValueBase.Unchanged;

		public ValueBase MieG { get; set; } = ValueBase.Unchanged;

		public ValueBase MultipleScattering { get; set; } = ValueBase.Unchanged;

		public uint CloudsData { get; set; } = 0u;

		public ValueBase CloudsCoverage { get; set; } = ValueBase.Unchanged;

		public ValueBase CloudsDensity { get; set; } = ValueBase.Unchanged;

		public ValueBase CloudsSharpness { get; set; } = ValueBase.Unchanged;

		public ValueBase CloudsShadowOpacity { get; set; } = ValueBase.Unchanged;

		public ValueBase CloudsTimescale { get; set; } = ValueBase.Unchanged;

		public ValueBase CloudsCrawling { get; set; } = ValueBase.Unchanged;

		public ValueBase CloudsFade { get; set; } = ValueBase.Unchanged;

		public BoolBase Sandstorm { get; set; } = BoolBase.Unchanged;

		public ValueBase SandstormEdgeA { get; set; } = ValueBase.Unchanged;

		public ValueBase SandstormEdgeB { get; set; } = ValueBase.Unchanged;

		public ValueBase SandstormMinFog { get; set; } = ValueBase.Unchanged;
	}
	public sealed class WEE_SetExpeditionEnvironment
	{
		public ValueBase EnvironmentWetness { get; set; } = ValueBase.Unchanged;

		public bool UpdateColor { get; set; } = false;

		public Color DustColor { get; set; } = Color.white;

		public ValueBase DustAlphaBoost { get; set; } = ValueBase.Unchanged;

		public ValueBase DustTurbulence { get; set; } = ValueBase.Unchanged;
	}
	public sealed class WEE_FadeScreenInOut
	{
		public Color FadeColor { get; set; } = Color.black;

		public float CurveTimeStart { get; set; } = 0f;

		public float CurveValueStart { get; set; } = 0f;

		public float CurveTimeEnd { get; set; } = 1f;

		public float CurveValueEnd { get; set; } = 1f;

		public float FadeSpeed { get; set; } = 1f;
	}
	public enum WEE_Type
	{
		CloseSecurityDoor = 10000,
		LockSecurityDoor = 10001,
		SetDoorInteraction = 10002,
		TriggerSecurityDoorAlarm = 10003,
		SolveSecurityDoorAlarm = 10004,
		StartReactor = 10005,
		ModifyReactorWaveState = 10006,
		ForceCompleteReactor = 10007,
		ForceCompleteLevel = 10008,
		ForceFailLevel = 10009,
		Countdown = 10010,
		SetLevelFailCheckEnabled = 10011,
		SetLevelFailWhenAnyPlayerDowned = 10012,
		KillAllPlayers = 10013,
		KillPlayersInZone = 10014,
		SolveSingleObjectiveItem = 10015,
		SetLightDataInZone = 10016,
		AlertEnemiesInZone = 10017,
		CleanupEnemiesInZone = 10018,
		SpawnHibernateInZone = 10019,
		SpawnScoutInZone = 10020,
		SaveCheckpoint = 10021,
		MoveExtractionWorldPosition = 10022,
		SetBlackoutEnabled = 10023,
		AddTerminalCommand = 10024,
		HideTerminalCommand = 10025,
		UnhideTerminalCommand = 10026,
		AddChainPuzzleToSecurityDoor = 10027,
		SetActiveEnemyWave = 10028,
		GiveResource = 10029,
		NestedEvent = 20000,
		StartEventLoop = 20001,
		StopEventLoop = 20002,
		TeleportPlayer = 20003,
		InfectPlayer = 20004,
		DamagePlayer = 20005,
		RevivePlayer = 20006,
		AdjustAWOTimer = 20007,
		Countup = 20008,
		ForceCompleteChainPuzzle = 20009,
		SpawnNavMarker = 20010,
		ShakeScreen = 20011,
		StartPortalMachine = 20012,
		SetSuccessScreen = 20013,
		PlaySubtitles = 20014,
		MultiProgression = 20015,
		PlayWaveRoarSound = 20016,
		CustomHudText = 20017,
		SpecialHudTimer = 20018,
		ForcePlayPlayerDialogue = 20019,
		SetTerminalLog = 20020,
		SetPocketItem = 20021,
		DoInteractWeakDoorsInZone = 20022,
		ToggleInteractWeakDoorsInZone = 20023,
		PickupSentries = 20024,
		SetOutsideDimensionData = 20025,
		SetExpeditionEnvironment = 20026,
		ClearWardenIntelQueue = 20027,
		ResetOnApproachDoor = 20028,
		FadeScreenInOut = 20029
	}
}
namespace AWO.Modules.WEE.Replicators
{
	public struct OutsideDataState
	{
		public float duration;

		public bool revertToOriginal;

		public bool isOutside;

		public uint atmosphereData;

		public uint cloudsData;

		public bool sandstorm;

		public unsafe fixed float fieldData[23];
	}
	public sealed class OutsideDataReplicator : MonoBehaviour, IStateReplicatorHolder<OutsideDataState>
	{
		public LG_Dimension Dimension = null;

		public DimensionData OutsideData = null;

		private OutsideDataState _origData;

		private float[] _origFields = new float[FieldMap.Length];

		private Coroutine? _transitionCoroutine;

		internal static readonly (Func<DimensionData, float> Get, Action<DimensionData, float> Set)[] FieldMap = new(Func<DimensionData, float>, Action<DimensionData, float>)[23]
		{
			((DimensionData d) => d.LightAzimuth, delegate(DimensionData d, float v)
			{
				d.LightAzimuth = v;
			}),
			((DimensionData d) => d.LightElevation, delegate(DimensionData d, float v)
			{
				d.LightElevation = v;
			}),
			((DimensionData d) => d.LightIntensity, delegate(DimensionData d, float v)
			{
				d.LightIntensity = v;
			}),
			((DimensionData d) => d.AmbientIntensity, delegate(DimensionData d, float v)
			{
				d.AmbientIntensity = v;
			}),
			((DimensionData d) => d.ReflectionsIntensity, delegate(DimensionData d, float v)
			{
				d.ReflectionsIntensity = v;
			}),
			((DimensionData d) => d.GodrayRange, delegate(DimensionData d, float v)
			{
				d.GodrayRange = v;
			}),
			((DimensionData d) => d.GodrayExponent, delegate(DimensionData d, float v)
			{
				d.GodrayExponent = v;
			}),
			((DimensionData d) => d.AtmosphereDensity, delegate(DimensionData d, float v)
			{
				d.AtmosphereDensity = v;
			}),
			((DimensionData d) => d.Exposure, delegate(DimensionData d, float v)
			{
				d.Exposure = v;
			}),
			((DimensionData d) => d.AerialScale, delegate(DimensionData d, float v)
			{
				d.AerialScale = v;
			}),
			((DimensionData d) => d.MieScattering, delegate(DimensionData d, float v)
			{
				d.MieScattering = v;
			}),
			((DimensionData d) => d.MieG, delegate(DimensionData d, float v)
			{
				d.MieG = v;
			}),
			((DimensionData d) => d.MultipleScattering, delegate(DimensionData d, float v)
			{
				d.MultipleScattering = v;
			}),
			((DimensionData d) => d.CloudsCoverage, delegate(DimensionData d, float v)
			{
				d.CloudsCoverage = v;
			}),
			((DimensionData d) => d.CloudsDensity, delegate(DimensionData d, float v)
			{
				d.CloudsDensity = v;
			}),
			((DimensionData d) => d.CloudsSharpness, delegate(DimensionData d, float v)
			{
				d.CloudsSharpness = v;
			}),
			((DimensionData d) => d.CloudsShadowOpacity, delegate(DimensionData d, float v)
			{
				d.CloudsShadowOpacity = v;
			}),
			((DimensionData d) => d.CloudsTimescale, delegate(DimensionData d, float v)
			{
				d.CloudsTimescale = v;
			}),
			((DimensionData d) => d.CloudsCrawling, delegate(DimensionData d, float v)
			{
				d.CloudsCrawling = v;
			}),
			((DimensionData d) => d.CloudsFade, delegate(DimensionData d, float v)
			{
				d.CloudsFade = v;
			}),
			((DimensionData d) => d.SandstormEdgeA, delegate(DimensionData d, float v)
			{
				d.SandstormEdgeA = v;
			}),
			((DimensionData d) => d.SandstormEdgeB, delegate(DimensionData d, float v)
			{
				d.SandstormEdgeB = v;
			}),
			((DimensionData d) => d.SandstormMinFog, delegate(DimensionData d, float v)
			{
				d.SandstormMinFog = v;
			})
		};

		[HideFromIl2Cpp]
		public StateReplicator<OutsideDataState>? Replicator { get; private set; }

		private static float[] GetFieldArray(DimensionData dimData)
		{
			float[] array = new float[FieldMap.Length];
			int num = 0;
			(Func<DimensionData, float>, Action<DimensionData, float>)[] fieldMap = FieldMap;
			for (int i = 0; i < fieldMap.Length; i++)
			{
				Func<DimensionData, float> item = fieldMap[i].Item1;
				array[num++] = item(dimData);
			}
			return array;
		}

		public void Setup(Dimension dim)
		{
			//IL_00a6: 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_00bd: Expected I4, but got Unknown
			Dimension = ((Component)this).GetComponent<LG_Dimension>();
			if (dim.DimensionData == null)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			OutsideData = dim.DimensionData;
			_origData = new OutsideDataState
			{
				revertToOriginal = true,
				isOutside = OutsideData.IsOutside,
				atmosphereData = OutsideData.AtmosphereData,
				cloudsData = OutsideData.CloudsData,
				sandstorm = OutsideData.Sandstorm
			};
			_origFields = GetFieldArray(OutsideData);
			Replicator = StateReplicator<OutsideDataState>.Create((uint)(dim.DimensionIndex + 1), default(OutsideDataState), (LifeTimeType)1, (IStateReplicatorHolder<OutsideDataState>)this);
		}

		public void OnDestroy()
		{
			Replicator?.Unload();
		}

		public void SetOutsideData(OutsideDataState data)
		{
			Replicator?.SetState(data);
		}

		public unsafe void OnStateChange(OutsideDataState oldState, OutsideDataState state, bool isRecall)
		{
			if (_transitionCoroutine != null)
			{
				((MonoBehaviour)Dimension).StopCoroutine(_transitionCoroutine);
			}
			float duration = (isRecall ? 0f : state.duration);
			float[] array = new float[FieldMap.Length];
			if (state.revertToOriginal)
			{
				state = _origData;
				array = _origFields;
			}
			else
			{
				float* ptr = state.fieldData;
				for (int i = 0; i < FieldMap.Length; i++)
				{
					array[i] = ptr[i];
				}
			}
			if (!array.All((float f) => f == 0f))
			{
				LG_Dimension dimension = Dimension;
				OutsideDataState data = state;
				data.duration = duration;
				_transitionCoroutine = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)dimension, OutsideTransition(data, array));
			}
		}

		[HideFromIl2Cpp]
		private IEnumerator OutsideTransition(OutsideDataState data, float[] fieldArr)
		{
			OutsideData.IsOutside = data.isOutside;
			OutsideData.AtmosphereData = ((data.atmosphereData != 0) ? data.atmosphereData : OutsideData.AtmosphereData);
			OutsideData.CloudsData = ((data.cloudsData != 0) ? data.cloudsData : OutsideData.CloudsData);
			OutsideData.Sandstorm = data.sandstorm;
			float[] startValues = GetFieldArray(OutsideData);
			float startAzimuth = startValues[0];
			float startElevation = startValues[1];
			float endAzimuth = fieldArr[0];
			float endElevation = fieldArr[1];
			bool azimuthOnly = !float.IsNaN(endAzimuth);
			bool elevationOnly = !float.IsNaN(endElevation);
			Vector3 startDir = Vector3.zero;
			Vector3 endDir = Vector3.zero;
			bool slerpFlag = azimuthOnly && elevationOnly;
			if (slerpFlag)
			{
				startDir = DirFromDeg(startAzimuth, startElevation);
				endDir = DirFromDeg(endAzimuth, endElevation);
			}
			float time = 0f;
			while (time <= data.duration)
			{
				time += Time.deltaTime;
				float progress = Mathf.Clamp01(time / data.duration);
				if (slerpFlag)
				{
					Vector3 val = Vector3.Slerp(startDir, endDir, progress);
					Vector3 dir = ((Vector3)(ref val)).normalized;
					float elDeg = Mathf.Asin(Mathf.Clamp(dir.y, -1f, 1f)) * 57.29578f;
					float azDeg = Mathf.Atan2(dir.x, dir.z) * 57.29578f;
					FieldMap[0].Set(OutsideData, azDeg);
					FieldMap[1].Set(OutsideData, elDeg);
				}
				else if (azimuthOnly)
				{
					float azimuth = Mathf.LerpAngle(startAzimuth, endAzimuth, progress);
					FieldMap[0].Set(OutsideData, azimuth);
				}
				else if (elevationOnly)
				{
					float elevation = Mathf.Lerp(startElevation, endElevation, progress);
					FieldMap[1].Set(OutsideData, elevation);
				}
				for (int i = 2; i < FieldMap.Length; i++)
				{
					float endValue = fieldArr[i];
					if (!float.IsNaN(endValue))
					{
						float value = Mathf.Lerp(startValues[i], endValue, progress);
						FieldMap[i].Set(OutsideData, value);
					}
				}
				yield return null;
			}
			static Vector3 DirFromDeg(float num2, float num4)
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: 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_004a: Unknown result type (might be due to invalid IL or missing references)
				float num = num2 * ((float)Math.PI / 180f);
				float num3 = num4 * ((float)Math.PI / 180f);
				float num5 = Mathf.Sin(num3);
				float num6 = Mathf.Cos(num3);
				float num7 = Mathf.Sin(num) * num6;
				float num8 = Mathf.Cos(num) * num6;
				Vector3 val2 = new Vector3(num7, num5, num8);
				return ((Vector3)(ref val2)).normalized;
			}
		}
	}
	public struct ScanPositionState
	{
		public Vector3 position;

		public int nodeID;
	}
	public sealed class ScanPositionReplicator : MonoBehaviour, IStateReplicatorHolder<ScanPositionState>
	{
		public CP_Bioscan_Core TrackingScan = null;

		public NavMarker? Marker;

		public bool IsExitScan;

		[HideFromIl2Cpp]
		public StateReplicator<ScanPositionState>? Replicator { get; private set; }

		public void Setup(uint id, CP_Bioscan_Core scan, NavMarker? marker, bool isExit)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			Replicator = StateReplicator<ScanPositionState>.Create(id, new ScanPositionState
			{
				position = ((Component)scan).transform.position,
				nodeID = scan.CourseNode.NodeID
			}, (LifeTimeType)1, (IStateReplicatorHolder<ScanPositionState>)this);
			TrackingScan = scan;
			Marker = marker;
			IsExitScan = isExit;
		}

		public void OnDestroy()
		{
			Replicator?.Unload();
		}

		public void TryUpdatePosition(Vector3 position)
		{
			//IL_0001: 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)
			AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(position);
			if (courseNode != null)
			{
				Replicator?.SetState(new ScanPositionState
				{
					position = position,
					nodeID = courseNode.NodeID
				});
			}
		}

		public void OnStateChange(ScanPositionState oldState, ScanPositionState state, bool isRecall)
		{
			//IL_0002: 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_0027: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//IL_010e: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			if (oldState.position == state.position)
			{
				return;
			}
			((Component)TrackingScan).transform.position = state.position;
			if ((int)TrackingScan.State.status > 0)
			{
				TrackingScan.PlayerScanner.StopScan();
				TrackingScan.PlayerScanner.StartScan();
			}
			NavMarker? marker = Marker;
			if (marker != null)
			{
				marker.SetTrackingObject(((Component)TrackingScan).gameObject);
			}
			AIG_CourseNode val = default(AIG_CourseNode);
			if (AIG_CourseNode.GetCourseNode(state.nodeID, ref val))
			{
				TrackingScan.CourseNode.UnregisterBioscan(TrackingScan);
				TrackingScan.m_courseNode = val;
				val.RegisterBioscan(TrackingScan);
			}
			if (!IsExitScan)
			{
				return;
			}
			LG_Zone zone = TrackingScan.m_courseNode.m_zone;
			string formattedText = zone.NavInfo.GetFormattedText((LG_NavInfoFormat)6);
			LG_LayerType[] values = Enum.GetValues<LG_LayerType>();
			foreach (LG_LayerType val2 in values)
			{
				if (WardenObjectiveManager.HasWardenObjectiveDataForLayer(val2))
				{
					WardenObjectiveManager.SetObjectiveTextFragment(val2, WardenObjectiveManager.GetCurrentChainIndex(val2), (eWardenTextFragment)6, formattedText);
					WardenObjectiveManager.UpdateObjectiveGUIWithCurrentState(val2, false, false, true);
				}
			}
		}
	}
	public struct ZoneLightState
	{
		public bool transitionToOriginal;

		public uint lightData;

		public int lightSeed;

		public float duration;
	}
	public struct LightTransitionData
	{
		public enum Mode
		{
			Enabled,
			Disabled,
			Flickering,
			Original
		}

		public ILightModifier lightMod;

		public float duration;

		public float origIntensity;

		public float startIntensity;

		public float endIntensity;

		public Color startColor;

		public Color endColor;

		public Mode endMode;

		public int endModeSeed;

		public bool origEnabled;
	}
	public sealed class ZoneLightReplicator : MonoBehaviour, IStateReplicatorHolder<ZoneLightState>
	{
		public LG_Zone Zone = null;

		public LightWorker[] LightsInZone = Array.Empty<LightWorker>();

		private readonly Dictionary<ILightModifier, Coroutine?> _lightMods = new Dictionary<ILightModifier, Coroutine>();

		private readonly Dictionary<int, ILightModifier> _modMap = new Dictionary<int, ILightModifier>();

		public Coroutine? ShareStatusCoroutine;

		[HideFromIl2Cpp]
		public StateReplicator<ZoneLightState>? Replicator { get; private set; }

		[HideFromIl2Cpp]
		public event Action? OnLightsChanged;

		public void Setup()
		{
			Zone = ((Component)this).GetComponent<LG_Zone>();
			Replicator = StateReplicator<ZoneLightState>.Create((uint)(Zone.ID + 1), default(ZoneLightState), (LifeTimeType)1, (IStateReplicatorHolder<ZoneLightState>)this);
			LightsInZone = LightAPI.GetLightWorkersInZone((LG_Zone[])(object)new LG_Zone[1] { Zone }).ToArray();
		}

		public void OnDestroy()
		{
			Replicator?.Unload();
		}

		public void SetLightSetting(ZoneLightState data)
		{
			Replicator?.SetState(data);
		}

		public void RevertLightData()
		{
			Replicator?.SetState(new ZoneLightState
			{
				lightData = 0u
			});
		}

		public void OnStateChange(ZoneLightState oldState, ZoneLightState state, bool isRecall)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			if (state.lightData == 0)
			{
				ClearLightMods();
				return;
			}
			LightSettingsDataBlock block = default(LightSettingsDataBlock);
			if (!DataBlockUtil.TryGetBlock<LightSettingsDataBlock>(state.lightData, ref block))
			{
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(47, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to find enabled LightSettingsDataBlock ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(state.lightData);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!");
				}
				Logger.Error(val);
				return;
			}
			LightSettingSelector[] selectors = Enum.GetValues<LightCategory>().Select(delegate(LightCategory category)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				LightSettingSelector val2 = new LightSettingSelector();
				val2.Setup(category, block);
				return val2;
			}).ToArray();
			for (int num = 0; num < LightsInZone.Length; num++)
			{
				ApplyLightMod(selectors, state.transitionToOriginal, isRecall ? 0f : state.duration, state.lightSeed, num);
			}
			StartShareStatus(state.duration);
		}

		private void ClearLightMods()
		{
			foreach (KeyValuePair<ILightModifier, Coroutine> lightMod in _lightMods)
			{
				if (lightMod.Value != null)
				{
					((MonoBehaviour)Zone).StopCoroutine(lightMod.Value);
				}
				lightMod.Key.Remove();
			}
			_lightMods.Clear();
			_modMap.Clear();
			LightAPI.ForEachWorker((IEnumerable<LightWorker>)LightsInZone, (Action<LightWorker>)delegate(LightWorker worker)
			{
				worker.ToggleLightFlicker(true);
			});
			StopShareStatus();
			ShareStatus();
		}

		private void ApplyLightMod(LightSettingSelector[] selectors, bool transitionToOrignal, float duration, int seed, int subseed)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (