Decompiled source of Imperium v0.1.2

giosuel.Imperium.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Imperium.Core;
using Imperium.Integration;
using Imperium.MonoBehaviours;
using Imperium.MonoBehaviours.ImpUI;
using Imperium.MonoBehaviours.ImpUI.Common;
using Imperium.MonoBehaviours.ImpUI.ImperiumUI;
using Imperium.MonoBehaviours.ImpUI.ImperiumUI.ObjectListEntry;
using Imperium.MonoBehaviours.ImpUI.ImperiumUI.Windows;
using Imperium.MonoBehaviours.ImpUI.LayerSelector;
using Imperium.MonoBehaviours.ImpUI.MoonUI;
using Imperium.MonoBehaviours.ImpUI.MoonUI.Windows;
using Imperium.MonoBehaviours.ImpUI.NavigatorUI;
using Imperium.MonoBehaviours.ImpUI.ObjectsUI;
using Imperium.MonoBehaviours.ImpUI.OracleUI;
using Imperium.MonoBehaviours.ImpUI.RenderingUI;
using Imperium.MonoBehaviours.ImpUI.SaveUI;
using Imperium.MonoBehaviours.ImpUI.SettingsUI;
using Imperium.MonoBehaviours.ImpUI.SpawningUI;
using Imperium.MonoBehaviours.ImpUI.TeleportUI;
using Imperium.MonoBehaviours.ImpUI.TeleportUI.Windows;
using Imperium.MonoBehaviours.ImpUI.WeatherUI;
using Imperium.MonoBehaviours.VisualizerObjects;
using Imperium.Netcode;
using Imperium.Oracle;
using Imperium.Patches.Objects;
using Imperium.Patches.Systems;
using Imperium.Types;
using Imperium.Util;
using Imperium.Util.Binding;
using Imperium.Visualizers;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using RuntimeNetcodeRPCValidator;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UniverseLib.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("giosuel.Imperium")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("All-in-one debugging mod for Lethal Company.")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-dev.8+e6fe09d0cb20a211cb61e35d38cb93c673d5bfda")]
[assembly: AssemblyProduct("giosuel.Imperium")]
[assembly: AssemblyTitle("giosuel.Imperium")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/giosuel/imperium")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Imperium
{
	[BepInDependency("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator", "0.2.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("giosuel.Imperium", "Imperium", "0.1.2")]
	public class Imperium : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "giosuel.Imperium";

		public const string PLUGIN_NAME = "Imperium";

		public const string PLUGIN_VERSION = "0.1.2";

		internal static ManualLogSource Log;

		internal static ConfigFile ConfigFile;

		internal static Terminal Terminal;

		internal static HUDManager HUDManager;

		internal static PlayerControllerB Player;

		internal static GameManager GameManager;

		internal static ObjectManager ObjectManager;

		internal static PlayerManager PlayerManager;

		internal static Visualization Visualization;

		internal static global::Imperium.Oracle.Oracle Oracle;

		internal static ImpFreecam Freecam;

		internal static ImpInputBindings InputBindings;

		internal static PositionIndicator PositionIndicator;

		internal static ImpInterfaceManager Interface;

		private static Harmony harmony;

		private static NetcodeValidator netcodeValidator;

		internal static bool IsImperiumReady;

		internal static ImpBinaryBinding IsSceneLoaded;

		internal static TimeOfDay TimeOfDay => TimeOfDay.Instance;

		internal static IngamePlayerSettings IngamePlayerSettings => IngamePlayerSettings.Instance;

		internal static StartOfRound StartOfRound => StartOfRound.Instance;

		internal static RoundManager RoundManager => RoundManager.Instance;

		private void Awake()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			ConfigFile = ((BaseUnityPlugin)this).Config;
			if (ImpAssets.Load())
			{
				netcodeValidator = new NetcodeValidator("giosuel.Imperium");
				netcodeValidator.PatchAll();
				netcodeValidator.BindToPreExistingObjectByBehaviour<ImpNetSpawning, Terminal>();
				netcodeValidator.BindToPreExistingObjectByBehaviour<ImpNetQuota, Terminal>();
				netcodeValidator.BindToPreExistingObjectByBehaviour<ImpNetTime, Terminal>();
				netcodeValidator.BindToPreExistingObjectByBehaviour<ImpNetWeather, Terminal>();
				netcodeValidator.BindToPreExistingObjectByBehaviour<ImpNetPlayer, Terminal>();
				netcodeValidator.BindToPreExistingObjectByBehaviour<ImpNetCommunication, Terminal>();
				harmony = new Harmony("giosuel.Imperium");
				PreLaunchPatch();
				IsImperiumReady = true;
				ImpOutput.Log("[OK] Imperium is ready!");
			}
		}

		internal static void Launch()
		{
			if (!IsImperiumReady)
			{
				ImpOutput.Send("[ERR] Imperium failed to launch ⊙︿⊙");
				return;
			}
			InputBindings = new ImpInputBindings();
			Terminal = GameObject.Find("TerminalScript").GetComponent<Terminal>();
			HUDManager = Object.FindObjectOfType<HUDManager>();
			IsSceneLoaded = new ImpBinaryBinding(currentValue: false);
			ImpNetworkManager.IsHost.Set(NetworkManager.Singleton.IsHost);
			PlayerManager.UpdateCameras();
			Freecam = ImpFreecam.Create();
			Interface = ImpInterfaceManager.Create();
			PositionIndicator = Object.Instantiate<GameObject>(ImpAssets.IndicatorObject).AddComponent<PositionIndicator>();
			PlayerManager = new PlayerManager(IsSceneLoaded, ImpNetworkManager.ConnectedPlayers, (Component)(object)Freecam);
			GameManager = new GameManager(IsSceneLoaded, ImpNetworkManager.ConnectedPlayers);
			ObjectManager = new ObjectManager(IsSceneLoaded, ImpNetworkManager.ConnectedPlayers);
			Oracle = new global::Imperium.Oracle.Oracle();
			Visualization = new Visualization(Oracle.State, ObjectManager);
			MoonManager.Create(ObjectManager);
			GameManager.IndoorSpawningPaused.onTrigger += Oracle.Simulate;
			GameManager.OutdoorSpawningPaused.onTrigger += Oracle.Simulate;
			GameManager.DaytimeSpawningPaused.onTrigger += Oracle.Simulate;
			GameManager.IndoorDeviation.onTrigger += Oracle.Simulate;
			GameManager.DaytimeDeviation.onTrigger += Oracle.Simulate;
			GameManager.MaxIndoorPower.onTrigger += Oracle.Simulate;
			GameManager.MaxOutdoorPower.onTrigger += Oracle.Simulate;
			GameManager.MaxDaytimePower.onTrigger += Oracle.Simulate;
			GameManager.MinIndoorSpawns.onTrigger += Oracle.Simulate;
			GameManager.MinOutdoorSpawns.onTrigger += Oracle.Simulate;
			Interface.OpenInterface.onUpdate += delegate(BaseUI openInterface)
			{
				if (Object.op_Implicit((Object)(object)openInterface))
				{
					PositionIndicator.HideIndicator();
				}
			};
			ObjectManager.CurrentPlayers.onTrigger += Visualization.RefreshOverlays;
			ObjectManager.CurrentLevelEntities.onTrigger += Visualization.RefreshOverlays;
			ObjectManager.CurrentLevelItems.onTrigger += Visualization.RefreshOverlays;
			ObjectManager.CurrentLevelLandmines.onTrigger += Visualization.RefreshOverlays;
			ObjectManager.CurrentLevelTurrets.onTrigger += Visualization.RefreshOverlays;
			ObjectManager.CurrentLevelSpiderWebs.onTrigger += Visualization.RefreshOverlays;
			ObjectManager.CurrentLevelBreakerBoxes.onTrigger += Visualization.RefreshOverlays;
			ImpSettings.LoadAll();
			SpawnUI();
			harmony.PatchAll();
			UnityExplorerIntegration.PatchFunctions(harmony);
			if (!ImpNetworkManager.IsHost.Value)
			{
				ImpNetTime.Instance.RequestTimeServerRpc();
			}
		}

		internal static void Unload()
		{
			harmony.UnpatchSelf();
			PreLaunchPatch();
			InputBindings.BaseMap.Disable();
			InputBindings.FreecamMap.Disable();
			Interface.StopListening();
			ImpSettings.Reinstantiate();
		}

		internal static void ReloadUI()
		{
			Interface.Close();
			Unload();
			Launch();
		}

		private static void SpawnUI()
		{
			Interface.Register<SettingsUI, ImperiumUI>(ImpAssets.SettingsUIObject);
			Interface.Register<ConfirmationUI, ImperiumUI>(ImpAssets.ConfirmationUIObject);
			Interface.Register<SaveUI, ImperiumUI>(ImpAssets.SaveUIObject);
			Interface.Register<ObjectsUI, ImperiumUI>(ImpAssets.ObjectsUIObject);
			Interface.Register<MoonUI, ImperiumUI>(ImpAssets.MoonUIObject);
			Interface.Register<RenderingUI, ImperiumUI>(ImpAssets.RenderingUIObject);
			Interface.Register<ImperiumUI>(ImpAssets.ImperiumUIObject, "<Keyboard>/F1");
			Interface.Register<SpawningUI>(ImpAssets.SpawningUIObject, "<Keyboard>/F2");
			Interface.Register<TeleportUI>(ImpAssets.TeleportUIObject, "<Keyboard>/F3");
			Interface.Register<WeatherUI>(ImpAssets.WeatherUIObject, "<Keyboard>/F4");
			Interface.Register<OracleUI>(ImpAssets.OracleUIObject, "<Keyboard>/F5");
			Interface.Register<NavigatorUI>(ImpAssets.NavigatorUIObject, "<Keyboard>/F6");
			Interface.StartListening();
			ImpOutput.Log("[OK] Imperium UIs have been registered! \\o/");
		}

		private static void PreLaunchPatch()
		{
			harmony.PatchAll(typeof(PlayerControllerPatch.PreloadPatches));
			harmony.PatchAll(typeof(TerminalPatch.PreloadPatches));
			harmony.PatchAll(typeof(PreInitPatches.PreInitSceneScriptPatch));
			harmony.PatchAll(typeof(PreInitPatches.MenuManagerPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "giosuel.Imperium";

		public const string PLUGIN_NAME = "giosuel.Imperium";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace Imperium.Visualizers
{
	internal abstract class BaseVisualizer<T>
	{
		private readonly string displayName;

		protected readonly Dictionary<int, GameObject> indicatorObjects = new Dictionary<int, GameObject>();

		protected BaseVisualizer(string displayName)
		{
			this.displayName = displayName;
		}

		protected BaseVisualizer(string displayName, ImpBinding<T> objectsBinding)
		{
			this.displayName = displayName;
			objectsBinding.onUpdate += Refresh;
		}

		internal virtual void Toggle(bool isOn)
		{
			ImpUtils.ToggleGameObjects(indicatorObjects.Values, isOn);
			ImpOutput.Send(isOn ? ("Successfully enabled " + displayName + "!") : ("Successfully disabled " + displayName + "!"), "Imperium", isWarning: false, NotificationType.Confirmation);
		}

		protected void ClearObjects()
		{
			foreach (GameObject item in indicatorObjects.Values.Where((GameObject indicator) => (Object)(object)indicator != (Object)null))
			{
				Object.Destroy((Object)(object)item);
			}
			indicatorObjects.Clear();
		}

		protected virtual void Refresh(T objects)
		{
		}
	}
	internal class EntityInfos : BaseVisualizer<HashSet<EnemyAI>>
	{
		public EntityInfos(ImpBinding<HashSet<EnemyAI>> objectsBinding)
			: base("Entity Infos", objectsBinding)
		{
		}

		protected override void Refresh(HashSet<EnemyAI> objects)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			foreach (EnemyAI @object in objects)
			{
				if (!indicatorObjects.ContainsKey(((Object)@object).GetInstanceID()))
				{
					GameObject val = Object.Instantiate<GameObject>(ImpAssets.EntityInfo);
					EnemyAICollisionDetect componentInChildren = ((Component)@object).GetComponentInChildren<EnemyAICollisionDetect>();
					Transform val2 = (Object.op_Implicit((Object)(object)((componentInChildren != null) ? ((Component)componentInChildren).transform : null)) ? ((Component)((Component)@object).GetComponentInChildren<EnemyAICollisionDetect>()).transform : ((Component)@object).transform);
					BoxCollider componentInChildren2 = ((Component)@object).GetComponentInChildren<BoxCollider>();
					float num = 1f;
					if (Object.op_Implicit((Object)(object)componentInChildren2))
					{
						Bounds bounds = ((Collider)componentInChildren2).bounds;
						num += (((Bounds)(ref bounds)).max.y - ((Bounds)(ref bounds)).min.y) / 2f;
					}
					val.transform.position = val2.position + Vector3.up * num;
					val.transform.localScale = Vector3.one * 0.4f;
					val.transform.SetParent(val2, true);
					val.AddComponent<EntityInfo>().Init(@object);
					val.SetActive(ImpSettings.Visualizations.EntityInfo.Value);
					indicatorObjects[((Object)@object).GetInstanceID()] = val;
				}
			}
		}
	}
	internal class KnifeIndicators : BaseVisualizer<Shovel>
	{
		public KnifeIndicators()
			: base("Knife Indicators")
		{
		}

		internal void Refresh(KnifeItem knife, bool isActivelyHolding)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (!indicatorObjects.TryGetValue(((Object)knife).GetInstanceID(), out var value))
			{
				value = new GameObject();
				value.transform.SetParent(((Component)knife).transform);
				value.AddComponent<KnifeIndicator>();
				indicatorObjects[((Object)knife).GetInstanceID()] = value;
			}
			value.GetComponent<KnifeIndicator>().Init(knife, isActivelyHolding);
			value.gameObject.SetActive(ImpSettings.Visualizations.KnifeIndicators.Value);
		}

		internal override void Toggle(bool isOn)
		{
			base.Toggle(isOn);
			RefreshAll();
		}

		private void RefreshAll()
		{
			KnifeItem[] array = Object.FindObjectsOfType<KnifeItem>();
			foreach (KnifeItem val in array)
			{
				Refresh(val, ((GrabbableObject)val).isHeld);
			}
		}
	}
	internal class LandmineIndicators : BaseVisualizer<HashSet<Landmine>>
	{
		public LandmineIndicators(ImpBinding<HashSet<Landmine>> objectsBinding)
			: base("Landmine Indicators", objectsBinding)
		{
		}

		internal void SnapshotPlayerHitbox(int landmineId)
		{
			if (indicatorObjects.TryGetValue(landmineId, out var value))
			{
				value.GetComponent<LandmineIndicator>().SnapshotHitboxes();
			}
		}

		protected override void Refresh(HashSet<Landmine> objects)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			ClearObjects();
			foreach (Landmine item in objects.Where((Landmine obj) => Object.op_Implicit((Object)(object)obj)))
			{
				if (!indicatorObjects.ContainsKey(((Object)item).GetInstanceID()))
				{
					GameObject val = new GameObject();
					val.transform.SetParent(((Component)item).transform);
					val.AddComponent<LandmineIndicator>().Init(item);
					val.SetActive(ImpSettings.Visualizations.LandmineIndicators.Value);
					indicatorObjects[((Object)item).GetInstanceID()] = val;
				}
			}
		}
	}
	internal class PlayerInfos : BaseVisualizer<HashSet<PlayerControllerB>>
	{
		public PlayerInfos(ImpBinding<HashSet<PlayerControllerB>> objectsBinding)
			: base("Player Infos", objectsBinding)
		{
		}

		protected override void Refresh(HashSet<PlayerControllerB> objects)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			ClearObjects();
			foreach (PlayerControllerB @object in objects)
			{
				if (!indicatorObjects.ContainsKey(((Object)@object).GetInstanceID()))
				{
					Transform transform = ((Component)@object).transform;
					GameObject val = Object.Instantiate<GameObject>(ImpAssets.PlayerInfo, transform, true);
					val.transform.position = transform.position + Vector3.up * 1.4f;
					val.transform.localScale = Vector3.one * 0.4f;
					val.AddComponent<PlayerInfo>().playerController = ((Component)@object).GetComponent<PlayerControllerB>();
					val.SetActive(ImpSettings.Visualizations.PlayerInfo.Value);
					indicatorObjects[((Object)@object).GetInstanceID()] = val;
				}
			}
		}
	}
	internal class ShotgunIndicators : BaseVisualizer<ShotgunItem>
	{
		public ShotgunIndicators()
			: base("Shotgun Indicators")
		{
		}

		internal void Refresh(ShotgunItem shotgun, bool isActivelyHolding)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (!indicatorObjects.TryGetValue(((Object)shotgun).GetInstanceID(), out var value))
			{
				value = new GameObject();
				value.transform.SetParent(((Component)shotgun).transform);
				value.AddComponent<ShotgunIndicator>();
				indicatorObjects[((Object)shotgun).GetInstanceID()] = value;
			}
			value.GetComponent<ShotgunIndicator>().Init(shotgun, isActivelyHolding);
			value.gameObject.SetActive(ImpSettings.Visualizations.ShotgunIndicators.Value);
		}
	}
	internal class ShovelIndicators : BaseVisualizer<Shovel>
	{
		public ShovelIndicators()
			: base("Shovel Indicators")
		{
		}

		internal void Refresh(Shovel shovel, bool isActivelyHolding)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (!indicatorObjects.TryGetValue(((Object)shovel).GetInstanceID(), out var value))
			{
				value = new GameObject();
				value.transform.SetParent(((Component)shovel).transform);
				value.AddComponent<ShovelIndicator>();
				indicatorObjects[((Object)shovel).GetInstanceID()] = value;
			}
			value.GetComponent<ShovelIndicator>().Init(shovel, isActivelyHolding);
			value.gameObject.SetActive(ImpSettings.Visualizations.ShovelIndicators.Value);
		}
	}
	internal class SpawnIndicators : BaseVisualizer<OracleState>
	{
		public SpawnIndicators(ImpBinding<OracleState> oracleStateBinding)
			: base("Spawn Indicators", oracleStateBinding)
		{
		}

		protected override void Refresh(OracleState state)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			ClearObjects();
			for (int i = state.currentCycle; i < state.outdoorCycles.Length; i++)
			{
				foreach (SpawnReport item in state.outdoorCycles[i])
				{
					GameObject val = Object.Instantiate<GameObject>(ImpAssets.SpawnIndicator);
					SpawnIndicator spawnIndicator = val.AddComponent<SpawnIndicator>();
					((Component)spawnIndicator).transform.position = item.position;
					spawnIndicator.Init(Imperium.ObjectManager.GetDisplayName(item.entity.enemyName), item.spawnTime);
					val.SetActive(ImpSettings.Visualizations.SpawnIndicators.Value);
					indicatorObjects[((Object)val).GetInstanceID()] = val;
				}
			}
		}
	}
	internal class SpikeTrapIndicators : BaseVisualizer<HashSet<SpikeRoofTrap>>
	{
		public SpikeTrapIndicators(ImpBinding<HashSet<SpikeRoofTrap>> objectsBinding)
			: base("Spike Trap Indicators", objectsBinding)
		{
		}

		protected override void Refresh(HashSet<SpikeRoofTrap> objects)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			ClearObjects();
			foreach (SpikeRoofTrap item in objects.Where((SpikeRoofTrap obj) => Object.op_Implicit((Object)(object)obj)))
			{
				if (!indicatorObjects.ContainsKey(((Object)item).GetInstanceID()))
				{
					GameObject val = new GameObject();
					val.transform.SetParent(((Component)item).transform);
					val.AddComponent<SpikeTrapIndicator>().Init(item);
					val.SetActive(ImpSettings.Visualizations.SpikeTrapIndicators.Value);
					indicatorObjects[((Object)item).GetInstanceID()] = val;
				}
			}
		}
	}
	internal class VentTimers : BaseVisualizer<HashSet<EnemyVent>>
	{
		public VentTimers(ImpBinding<HashSet<EnemyVent>> objectsBinding)
			: base("Vent Timers", objectsBinding)
		{
		}

		protected override void Refresh(HashSet<EnemyVent> objects)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			foreach (EnemyVent item in objects.Where((EnemyVent obj) => Object.op_Implicit((Object)(object)obj)))
			{
				if (!indicatorObjects.ContainsKey(((Object)item).GetInstanceID()))
				{
					Transform transform = ((Component)item).transform;
					GameObject val = Object.Instantiate<GameObject>(ImpAssets.SpawnTimerObject, transform, true);
					Quaternion rotation = transform.rotation;
					val.transform.rotation = rotation;
					val.transform.localRotation = Quaternion.Euler(0f, 180f, -90f);
					val.transform.position = transform.position + Vector3.up * 0.8f;
					val.AddComponent<SpawnTimer>().vent = item;
					val.SetActive(ImpSettings.Visualizations.SpawnTimers.Value);
					indicatorObjects[((Object)item).GetInstanceID()] = val;
				}
			}
		}
	}
}
namespace Imperium.Util
{
	public abstract class ImpAssets
	{
		internal static GameObject ImperiumUIObject;

		internal static GameObject TeleportUIObject;

		internal static GameObject WeatherUIObject;

		internal static GameObject SpawningUIObject;

		internal static GameObject MoonUIObject;

		internal static GameObject SaveUIObject;

		internal static GameObject ObjectsUIObject;

		internal static GameObject SettingsUIObject;

		internal static GameObject ConfirmationUIObject;

		internal static GameObject RenderingUIObject;

		internal static GameObject OracleUIObject;

		internal static GameObject NavigatorUIObject;

		internal static GameObject IndicatorObject;

		internal static GameObject LayerSelector;

		internal static AudioClip GrassClick;

		internal static AudioClip ButtonClick;

		internal static GameObject SpawnTimerObject;

		internal static GameObject SpikeTrapTimerObject;

		internal static GameObject SpawnIndicator;

		internal static GameObject PlayerInfo;

		internal static GameObject EntityInfo;

		internal static Material XrayMaterial;

		internal static Material FresnelBlueMaterial;

		internal static Material FresnelYellowMaterial;

		internal static Material FresnelGreenMaterial;

		internal static Material FresnelRedMaterial;

		internal static Material WireframePurpleMaterial;

		internal static Material WireframeCyanMaterial;

		internal static Material WireframeAmaranthMaterial;

		internal static Material WireframeYellowMaterial;

		internal static Material WireframeGreenMaterial;

		internal static Material WireframeRedMaterial;

		private static List<string> logBuffer = new List<string>();

		internal static bool Load()
		{
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "imperium_assets"));
			if ((Object)(object)val == (Object)null)
			{
				ImpOutput.Log("[PRELOAD] Failed to load Imperium assets, aborting!");
				return false;
			}
			logBuffer = new List<string>();
			List<bool> source = new List<bool>(32)
			{
				LoadFile<GameObject>(val, "Assets/imperium_ui.prefab", out ImperiumUIObject),
				LoadFile<GameObject>(val, "Assets/teleport_ui.prefab", out TeleportUIObject),
				LoadFile<GameObject>(val, "Assets/weather_ui.prefab", out WeatherUIObject),
				LoadFile<GameObject>(val, "Assets/spawning_ui.prefab", out SpawningUIObject),
				LoadFile<GameObject>(val, "Assets/moon_ui.prefab", out MoonUIObject),
				LoadFile<GameObject>(val, "Assets/save_ui.prefab", out SaveUIObject),
				LoadFile<GameObject>(val, "Assets/objects_ui.prefab", out ObjectsUIObject),
				LoadFile<GameObject>(val, "Assets/settings_ui.prefab", out SettingsUIObject),
				LoadFile<GameObject>(val, "Assets/rendering_ui.prefab", out RenderingUIObject),
				LoadFile<GameObject>(val, "Assets/oracle_ui.prefab", out OracleUIObject),
				LoadFile<GameObject>(val, "Assets/navigator_ui.prefab", out NavigatorUIObject),
				LoadFile<GameObject>(val, "Assets/confirmation_ui.prefab", out ConfirmationUIObject),
				LoadFile<GameObject>(val, "Assets/indicator.prefab", out IndicatorObject),
				LoadFile<GameObject>(val, "Assets/layer_selector.prefab", out LayerSelector),
				LoadFile<GameObject>(val, "Assets/spawn_timer.prefab", out SpawnTimerObject),
				LoadFile<GameObject>(val, "Assets/spiketrap_timer.prefab", out SpikeTrapTimerObject),
				LoadFile<GameObject>(val, "Assets/player_info.prefab", out PlayerInfo),
				LoadFile<GameObject>(val, "Assets/entity_info.prefab", out EntityInfo),
				LoadFile<GameObject>(val, "Assets/spawn_indicator.prefab", out SpawnIndicator),
				LoadFile<Material>(val, "Assets/Materials/xray.mat", out XrayMaterial),
				LoadFile<Material>(val, "Assets/Materials/fresnel_blue.mat", out FresnelBlueMaterial),
				LoadFile<Material>(val, "Assets/Materials/fresnel_red.mat", out FresnelRedMaterial),
				LoadFile<Material>(val, "Assets/Materials/fresnel_green.mat", out FresnelGreenMaterial),
				LoadFile<Material>(val, "Assets/Materials/fresnel_yellow.mat", out FresnelYellowMaterial),
				LoadFile<Material>(val, "Assets/Materials/wireframe_purple.mat", out WireframePurpleMaterial),
				LoadFile<Material>(val, "Assets/Materials/wireframe_cyan.mat", out WireframeCyanMaterial),
				LoadFile<Material>(val, "Assets/Materials/wireframe_amaranth.mat", out WireframeAmaranthMaterial),
				LoadFile<Material>(val, "Assets/Materials/wireframe_yellow.mat", out WireframeYellowMaterial),
				LoadFile<Material>(val, "Assets/Materials/wireframe_green.mat", out WireframeGreenMaterial),
				LoadFile<Material>(val, "Assets/Materials/wireframe_red.mat", out WireframeRedMaterial),
				LoadFile<AudioClip>(val, "Assets/Audio/GrassClick.wav", out GrassClick),
				LoadFile<AudioClip>(val, "Assets/Audio/ButtonClick.ogg", out ButtonClick)
			};
			ImpOutput.LogBlock(logBuffer, "Imperium Asset Loader");
			if (source.Any((bool result) => !result))
			{
				ImpOutput.Log("[PRELOAD]  Failed to load one or more assets from ./imperium_assets, aborting!");
				return false;
			}
			return true;
		}

		private static bool LoadFile<T>(AssetBundle assets, string path, out T loadedObject) where T : Object
		{
			loadedObject = assets.LoadAsset<T>(path);
			if (!Object.op_Implicit((Object)(object)loadedObject))
			{
				Imperium.Log.LogError((object)("Failed to load '" + path + "' from ./imperium_assets"));
				return false;
			}
			logBuffer.Add("> Successfully loaded " + path.Split("/").Last() + " from asset bundle.");
			return true;
		}
	}
	public abstract class ImpAttributes
	{
		internal class HostOnly : Attribute
		{
		}

		internal class LocalMethod : Attribute
		{
		}

		internal class RemoteMethod : Attribute
		{
		}
	}
	public abstract class ImpNaming
	{
		private static readonly Dictionary<string, string> RenameMap = new Dictionary<string, string>
		{
			{ "centipede", "Snare Flea" },
			{ "bunker spider", "Bunker Spider" },
			{ "hoarding bug", "Hoarding Bug" },
			{ "flowerman", "Bracken" },
			{ "crawler", "Thumper" },
			{ "blob", "Hygrodere" },
			{ "girl", "Ghost Girl" },
			{ "puffer", "Spore Lizard" },
			{ "nutcracker", "Nutcracker" },
			{ "masked", "masked" },
			{ "spring", "Coil Head" },
			{ "jester", "Jester" },
			{ "lasso", "Lasso" },
			{ "red pill", "Red Pill" },
			{ "mouthdog", "Eyeless Dog" },
			{ "forestgiant", "Forest Keeper" },
			{ "earth leviathan", "Earth Leviathan" },
			{ "baboon hawk", "Baboon Hawk" },
			{ "red locust bees", "Circuit Bees" },
			{ "manticoil", "Manticoil" },
			{ "docile locust bees", "Roaming Locusts" }
		};
	}
	internal abstract class ImpOutput
	{
		private static readonly Dictionary<NotificationType, ImpConfig<bool>> NotificationSettings = new Dictionary<NotificationType, ImpConfig<bool>>
		{
			{
				NotificationType.GodMode,
				ImpSettings.Preferences.NotificationsGodMode
			},
			{
				NotificationType.OracleUpdate,
				ImpSettings.Preferences.NotificationsOracle
			},
			{
				NotificationType.Confirmation,
				ImpSettings.Preferences.NotificationsConfirmation
			},
			{
				NotificationType.SpawnReport,
				ImpSettings.Preferences.NotificationsSpawnReports
			},
			{
				NotificationType.Entities,
				ImpSettings.Preferences.NotificationsEntities
			},
			{
				NotificationType.Server,
				ImpSettings.Preferences.NotificationsServer
			},
			{
				NotificationType.Other,
				ImpSettings.Preferences.NotificationsOther
			}
		};

		internal static void SendToClients(string text, string title = "Imperium", bool isWarning = false)
		{
			if (ImpNetworkManager.IsHost.Value)
			{
				ImpNetCommunication.Instance.SendClientRpc(text, title, isWarning);
			}
		}

		internal static void Send(string text, string title = "Imperium", bool isWarning = false, NotificationType notificationType = NotificationType.Other)
		{
			if (!Object.op_Implicit((Object)(object)HUDManager.Instance))
			{
				Imperium.Log.LogError((object)("Failed to send notification, HUDManager is not defined, message: " + text));
			}
			else if (NotificationSettings[notificationType].Value && !ImpSettings.IsLoading)
			{
				if (notificationType == NotificationType.OracleUpdate)
				{
					title = "Oracle";
				}
				HUDManager.Instance.DisplayTip(title, text, isWarning, false, "LC_Tip1");
			}
		}

		internal static void Log(string message)
		{
			Imperium.Log.LogInfo((object)message);
		}

		internal static void LogBlock(List<string> lines, string title = "Imperium Monitoring")
		{
			if (ImpSettings.Preferences.GeneralLogging.Value)
			{
				string text = "[MON] Imperium message block :)\n";
				title = "< " + title + " >";
				int width = Mathf.Max(lines.Max((string line) => line.Length) + 4, 20);
				string text2 = string.Concat(Enumerable.Repeat("═", width - 2));
				int num = (width - title.Length) / 2 - 1;
				if ((width - title.Length) / 2 % 2 == 0)
				{
					num++;
				}
				string text3 = string.Concat(Enumerable.Repeat(" ", num));
				text = text + "╒" + text2 + "╕\n";
				text = text + "│" + text3 + title + text3 + "│\n";
				text = text + "╞" + text2 + "╡\n";
				text = lines.Aggregate(text, (string current, string line) => current + ("│ " + line).PadRight(width - 2) + " │\n");
				text = text + "╘" + text2 + "╛";
				Imperium.Log.Log((LogLevel)8, (object)text);
			}
		}
	}
	internal enum NotificationType
	{
		GodMode,
		OracleUpdate,
		Confirmation,
		SpawnReport,
		Entities,
		Server,
		Other
	}
	internal abstract class ImpUtils
	{
		internal abstract class RichText
		{
			internal static string Strikethrough(string value)
			{
				return "<s>" + value + "</s>";
			}

			internal static string Underlined(string value)
			{
				return "<u>" + value + "</u>";
			}

			internal static string Bold(string value)
			{
				return "<b>" + value + "</b>";
			}

			internal static string Italic(string value)
			{
				return "<i>" + value + "</i>";
			}
		}

		internal abstract class Interface
		{
			internal static void ToggleImageActive(Image image, bool isOn)
			{
				//IL_0002: 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)
				((Graphic)image).color = ChangeAlpha(((Graphic)image).color, isOn ? 1f : 0.3f);
			}

			internal static void ToggleTextActive(TMP_Text text, bool isOn)
			{
				//IL_0002: 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)
				((Graphic)text).color = ChangeAlpha(((Graphic)text).color, isOn ? 1f : 0.1f);
			}

			private static Color ChangeAlpha(Color oldColor, float newAlpha)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				Color result = oldColor;
				result.a = newAlpha;
				return result;
			}

			internal static void ToggleCursorState(bool uiOpen)
			{
				Imperium.Player.quickMenuManager.isMenuOpen = uiOpen;
				Cursor.lockState = (CursorLockMode)((!uiOpen) ? 1 : 0);
			}
		}

		internal abstract class Math
		{
			internal static float SampleQuadraticBezier(float start, float end, float control, float x)
			{
				return (1f - x) * (1f - x) * start + 2f * (1f - x) * x * control + x * x * end;
			}

			internal static string FormatChance(float chance)
			{
				return NormalizeFloat(MathF.Round(chance * 100f, 2)).ToString(CultureInfo.InvariantCulture) + "%";
			}

			private static float NormalizeFloat(float value)
			{
				string[] array = value.ToString(CultureInfo.InvariantCulture).Split('.');
				if (array.Length == 1)
				{
					return value;
				}
				if (int.Parse(array[1]) == 0)
				{
					return (int)value;
				}
				return MathF.Round(value);
			}

			internal static string FormatFloatToThreeDigits(float value)
			{
				if (!(value >= 100f))
				{
					if (value >= 10f)
					{
						return MathF.Round(value, 1).ToString(CultureInfo.InvariantCulture);
					}
					return MathF.Round(value, 2).ToString(CultureInfo.InvariantCulture);
				}
				return Mathf.RoundToInt(value).ToString();
			}
		}

		internal abstract class VectorMath
		{
			internal static Vector3 ClosestPointAlongRay(Ray ray, Vector3 point)
			{
				//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_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: 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_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				Vector3 origin = ((Ray)(ref ray)).origin;
				Vector3 val = ((Ray)(ref ray)).origin + ((Ray)(ref ray)).direction - origin;
				float num = Vector3.Dot(point - origin, val);
				num = Mathf.Max(num, 0f);
				return ((Ray)(ref ray)).origin + ((Ray)(ref ray)).direction * num;
			}
		}

		internal abstract class Geometry
		{
			internal static LineRenderer CreateLine(Transform parent, float thickness = 0.05f, bool useWorldSpace = false, Color? color = null, params Vector3[] positions)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				GameObject val = new GameObject();
				val.transform.parent = parent;
				((Object)val).name = "ImpObject";
				LineRenderer obj = val.AddComponent<LineRenderer>();
				((Renderer)obj).material = new Material(Shader.Find("Sprites/Default"));
				obj.startWidth = thickness;
				obj.endWidth = thickness;
				obj.useWorldSpace = useWorldSpace;
				obj.positionCount = 2;
				return obj;
			}

			internal static void SetLineColor(LineRenderer lineRenderer, Color color)
			{
				//IL_0001: 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)
				lineRenderer.startColor = color;
				lineRenderer.endColor = color;
			}

			internal static void SetLinePositions(LineRenderer lineRenderer, params Vector3[] positions)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				lineRenderer.positionCount = positions.Length;
				for (int i = 0; i < positions.Length; i++)
				{
					lineRenderer.SetPosition(i, positions[i]);
				}
			}

			internal static GameObject CreatePrimitive(PrimitiveType type, Transform parent, Color color, float size = 1f, string name = null)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				GameObject obj = CreatePrimitive(type, parent, size, name);
				MeshRenderer component = obj.GetComponent<MeshRenderer>();
				((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
				Material material = ((Renderer)component).material;
				material.shader = Shader.Find("HDRP/Unlit");
				material.color = color;
				return obj;
			}

			internal static GameObject CreatePrimitive(PrimitiveType type, Transform parent, [CanBeNull] Material material, float size = 1f, string name = null)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = CreatePrimitive(type, parent, size, name);
				if (name != null)
				{
					((Object)val).name = name;
				}
				MeshRenderer component = val.GetComponent<MeshRenderer>();
				((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
				if ((Object)(object)material != (Object)null)
				{
					((Renderer)component).material = material;
				}
				else
				{
					((Renderer)component).material.shader = Shader.Find("HDRP/Unlit");
				}
				return val;
			}

			private static GameObject CreatePrimitive(PrimitiveType type, Transform parent, float size = 1f, string name = "ImpObject")
			{
				//IL_0000: 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_002c: Expected I4, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = GameObject.CreatePrimitive(type);
				((Object)val).name = name;
				switch ((int)type)
				{
				case 0:
					Object.Destroy((Object)(object)val.GetComponent<SphereCollider>());
					break;
				case 2:
				case 3:
				case 4:
				case 5:
					Object.Destroy((Object)(object)val.GetComponent<BoxCollider>());
					break;
				case 1:
					Object.Destroy((Object)(object)val.GetComponent<CapsuleCollider>());
					break;
				default:
					throw new ArgumentOutOfRangeException("type", type, null);
				}
				val.transform.localScale = Vector3.one * size;
				val.transform.position = parent.position;
				val.transform.SetParent(parent);
				return val;
			}
		}

		internal static int RandomItemValue(Item item)
		{
			Random obj = ((Imperium.RoundManager.AnomalyRandom != null) ? CloneRandom(Imperium.RoundManager.AnomalyRandom) : new Random());
			int minValue = System.Math.Min(item.minValue, item.maxValue);
			int maxValue = System.Math.Min(item.minValue, item.maxValue);
			return (int)((float)obj.Next(minValue, maxValue) * Imperium.RoundManager.scrapValueMultiplier);
		}

		internal static T DictionaryGetOrNew<T>(IDictionary<string, T> map, string key) where T : new()
		{
			if (map.TryGetValue(key, out var value))
			{
				return value;
			}
			return map[key] = new T();
		}

		internal static void ToggleGameObjects(IEnumerable<GameObject> list, bool isOn)
		{
			foreach (GameObject item in list.Where((GameObject obj) => (Object)(object)obj != (Object)null))
			{
				item.SetActive(isOn);
			}
		}

		internal static void ToggleGameObjects(IEnumerable<Component> list, bool isOn)
		{
			foreach (Component item in list.Where((Component obj) => (Object)(object)obj != (Object)null && (Object)(object)obj.gameObject != (Object)null))
			{
				item.gameObject.SetActive(isOn);
			}
		}

		internal static Random CloneRandom(Random random)
		{
			Random random2 = new Random();
			int[] source = Reflection.Get<Random, int[]>(random, "_seedArray");
			Reflection.Set(random2, "_seedArray", source.ToArray());
			Reflection.Copy(random, random2, "_inextp");
			Reflection.Copy(random, random2, "_inext");
			return random2;
		}

		internal static float TimeToNormalized(float currentTime)
		{
			return currentTime / Imperium.TimeOfDay.totalTime;
		}

		internal static string FormatDayTime(float dayTime)
		{
			return FormatTime(TimeToNormalized(dayTime));
		}

		internal static string FormatFraction(int num1, int num2, bool ignoreEmpty = true)
		{
			if (ignoreEmpty && num1 == 0 && num2 == 0)
			{
				return "";
			}
			return $"({num1}/{num2})";
		}

		internal static string FormatTime(float normalizedTime)
		{
			int num = (int)(normalizedTime * Imperium.TimeOfDay.lengthOfHours * (float)Imperium.TimeOfDay.numberOfHours) + 360;
			int num2 = num % 60;
			int num3 = num / 60;
			string arg = ((num3 < 12) ? "AM" : "PM");
			num3 %= 12;
			if (num3 == 0)
			{
				num3 = 12;
			}
			return $"{num3:00}:{num2:00} {arg}";
		}

		internal static string FormatVector(Vector3 input, int roundDigits = -1)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			float num = ((roundDigits > -1) ? MathF.Round(input.x, roundDigits) : input.x);
			float num2 = ((roundDigits > -1) ? MathF.Round(input.y, roundDigits) : input.y);
			float num3 = ((roundDigits > -1) ? MathF.Round(input.z, roundDigits) : input.z);
			return $"({num}/{num2}/{num3})";
		}

		internal static T InvokeDefaultOnNull<T>(Func<T> callback)
		{
			try
			{
				return callback();
			}
			catch (NullReferenceException)
			{
				return default(T);
			}
		}

		internal static void PlayClip(AudioClip audioClip, bool randomize = false)
		{
			RoundManager.PlayRandomClip(Imperium.HUDManager.UIAudio, (AudioClip[])(object)new AudioClip[1] { audioClip }, randomize, 1f, 0);
		}

		internal static SpawnableItemWithRarity AddScrapToSpawnList(Item itemType, ICollection<SpawnableItemWithRarity> scrapList)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			SpawnableItemWithRarity val = new SpawnableItemWithRarity
			{
				spawnableItem = itemType,
				rarity = 0
			};
			scrapList.Add(val);
			return val;
		}

		internal static SpawnableEnemyWithRarity AddEntityToSpawnList(EnemyType entityType, ICollection<SpawnableEnemyWithRarity> entityList)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			SpawnableEnemyWithRarity val = new SpawnableEnemyWithRarity
			{
				enemyType = entityType,
				rarity = 0
			};
			entityList.Add(val);
			return val;
		}

		internal static int ToggleLayerInMask(int layerMask, int layer)
		{
			if ((layerMask & (1 << layer)) != 0)
			{
				return layerMask & ~(1 << layer);
			}
			return layerMask | (1 << layer);
		}
	}
	internal static class Reflection
	{
		internal static void Invoke<T>(T instance, string methodName, params object[] parameters)
		{
			typeof(T).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, parameters);
		}

		internal static R Invoke<T, R>(T instance, string methodName, params object[] parameters)
		{
			object obj = typeof(T).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, parameters);
			if (obj is R)
			{
				return (R)obj;
			}
			throw new ArgumentOutOfRangeException();
		}

		internal static IEnumerator GetCoroutine<T>(T instance, string methodName)
		{
			return (IEnumerator)typeof(T).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, Array.Empty<object>());
		}

		internal static R Get<T, R>(T instance, string fieldName, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic)
		{
			return (R)typeof(T).GetField(fieldName, bindingFlags).GetValue(instance);
		}

		internal static void Set<T, V>(T instance, string fieldName, V value, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic)
		{
			typeof(T).GetField(fieldName, bindingFlags).SetValue(instance, value);
		}

		internal static void SetProperty<T, V>(T instance, string propertyName, V value, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic)
		{
			typeof(T).InvokeMember(propertyName, bindingFlags | BindingFlags.SetProperty, null, instance, new object[1] { value });
		}

		internal static void Copy<T>(T source, T target, string fieldName, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic)
		{
			FieldInfo field = typeof(T).GetField(fieldName, bindingFlags);
			field.SetValue(target, field.GetValue(source));
		}
	}
}
namespace Imperium.Util.Binding
{
	public class ImpBinaryBinding : ImpBinding<bool>
	{
		internal event Action onTrue;

		internal event Action onFalse;

		internal ImpBinaryBinding(bool currentValue, Action onTrue = null, Action onFalse = null)
			: base(currentValue, (Action<bool>)null, (Action<bool>)null, ignoreRefresh: false)
		{
			this.onTrue += onTrue;
			this.onFalse += onFalse;
			base.onUpdate += OnUpdate;
		}

		internal void Toggle()
		{
			Set(!base.Value);
		}

		internal void SetTrue()
		{
			Set(value: true);
		}

		internal void SetFalse()
		{
			Set(value: false);
		}

		private void OnUpdate(bool value)
		{
			if (value)
			{
				this.onTrue?.Invoke();
			}
			else
			{
				this.onFalse?.Invoke();
			}
		}
	}
	public class ImpBinding<T> : IRefreshable, IResettable
	{
		private readonly Action<T> syncOnUpdate;

		private readonly bool ignoreRefresh;

		public T DefaultValue { get; }

		public T Value { get; protected set; }

		public event Action<T> onUpdate;

		public event Action onTrigger;

		internal ImpBinding()
		{
		}

		internal ImpBinding(T currentValue, Action<T> onUpdate = null, Action<T> syncOnUpdate = null, bool ignoreRefresh = false)
		{
			Value = currentValue;
			DefaultValue = currentValue;
			this.ignoreRefresh = ignoreRefresh;
			this.syncOnUpdate = syncOnUpdate;
			this.onUpdate += onUpdate;
		}

		internal ImpBinding(T currentValue, T defaultValue, Action<T> onUpdate = null, Action<T> syncOnUpdate = null, bool ignoreRefresh = false)
		{
			Value = currentValue;
			DefaultValue = defaultValue;
			this.ignoreRefresh = ignoreRefresh;
			this.syncOnUpdate = syncOnUpdate;
			this.onUpdate += onUpdate;
		}

		internal void Reset(bool skipSync)
		{
			Set(DefaultValue, skipSync);
		}

		public void Refresh()
		{
			if (!ignoreRefresh)
			{
				Set(Value, skipSync: true);
			}
		}

		public void Refresh(T newValue)
		{
			Value = newValue;
			if (!ignoreRefresh)
			{
				Set(newValue, skipSync: true);
			}
		}

		public void Reset()
		{
			Reset(skipSync: false);
		}

		internal void Set(T value)
		{
			Set(value, skipSync: false);
		}

		internal virtual void Set(T value, bool skipSync)
		{
			Value = value;
			if (!skipSync)
			{
				syncOnUpdate?.Invoke(value);
			}
			this.onUpdate?.Invoke(value);
			this.onTrigger?.Invoke();
		}
	}
	public interface IRefreshable
	{
		void Refresh();
	}
	public interface IResettable
	{
		void Reset();
	}
	public class ImpConfig<T> : ImpBinding<T>
	{
		private readonly ConfigEntry<T> config;

		internal ImpConfig(string section, string key, T defaultValue, Action<T> onUpdate = null, Action<T> syncOnUpdate = null, bool ignoreRefresh = false)
			: base(defaultValue, onUpdate, syncOnUpdate, ignoreRefresh)
		{
			config = Imperium.ConfigFile.Bind<T>(section, key, defaultValue, (ConfigDescription)null);
			base.Value = config.Value;
		}

		internal override void Set(T value, bool skipSync)
		{
			config.Value = value;
			base.Set(config.Value, skipSync);
		}
	}
	internal class ImpEvent
	{
		internal event Action onTrigger;

		internal ImpEvent(Action onTrigger = null)
		{
			this.onTrigger += onTrigger;
		}

		internal void Trigger()
		{
			this.onTrigger?.Invoke();
		}
	}
	public class ImpExternalBinding<T, R> : ImpBinding<T>
	{
		internal ImpExternalBinding(Func<T> valueGetter, ImpBinding<R> refresher, Action<T> onUpdate = null, Action<T> syncOnUpdate = null)
			: base(ImpUtils.InvokeDefaultOnNull(valueGetter), onUpdate, syncOnUpdate, ignoreRefresh: false)
		{
			ImpExternalBinding<T, R> impExternalBinding = this;
			refresher.onUpdate += delegate
			{
				impExternalBinding.Set(ImpUtils.InvokeDefaultOnNull(valueGetter));
			};
		}
	}
}
namespace Imperium.Types
{
	[Serializable]
	public class ImpVector
	{
		public float x = vector3.x;

		public float y = vector3.y;

		public float z = vector3.z;

		public ImpVector(Vector3 vector3)
		{
		}//IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references)


		public Vector3 Vector3()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(x, y, z);
		}
	}
	public record MoonData
	{
		public Dictionary<string, int> IndoorEntityRarities = new Dictionary<string, int>();

		public Dictionary<string, int> OutdoorEntityRarities = new Dictionary<string, int>();

		public Dictionary<string, int> DaytimeEntityRarities = new Dictionary<string, int>();

		public Dictionary<string, int> ScrapRarities = new Dictionary<string, int>();

		public int maxIndoorPower;

		public int maxOutdoorPower;

		public int maxDaytimePower;

		public float indoorDeviation;

		public float daytimeDeviation;
	}
	internal record VisualizerDefinition(string identifier, IdentifierType type, float size, Visualizer visualizer, Material material);
	internal enum IdentifierType
	{
		TAG,
		LAYER
	}
}
namespace Imperium.Patches.Systems
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal static class GameNetworkManagerPatch
	{
		private static bool hasSubscribedToConnectionCallbacks;

		[HarmonyPostfix]
		[HarmonyPatch("SubscribeToConnectionCallbacks")]
		private static void SubscribeToConnectionCallbacksPatch(GameNetworkManager __instance)
		{
			if (!hasSubscribedToConnectionCallbacks)
			{
				NetworkManager.Singleton.OnClientConnectedCallback += ImpNetworkManager.OnClientConnected;
				NetworkManager.Singleton.OnClientDisconnectCallback += ImpNetworkManager.OnClientDisconnected;
				hasSubscribedToConnectionCallbacks = true;
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal static class HUDManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("SetClockVisible")]
		private static bool SetClockVisiblePatch(HUDManager __instance)
		{
			if (ImpSettings.Time.PermanentClock.Value || !Imperium.Player.isInsideFactory)
			{
				__instance.Clock.targetAlpha = (Imperium.GameManager.TimeIsPaused.Value ? 0.4f : 1f);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(OutOfBoundsTrigger))]
	internal static class OutOfBoundsTriggerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnTriggerEnter")]
		private static bool OnTriggerEnterPatch()
		{
			return true;
		}
	}
	internal static class PreInitPatches
	{
		[HarmonyPatch(typeof(PreInitSceneScript))]
		internal static class PreInitSceneScriptPatch
		{
			[HarmonyPrefix]
			[HarmonyPatch("SkipToFinalSetting")]
			private static void SkipToFinalSettingPatch(IngamePlayerSettings __instance)
			{
				if (ImpSettings.Preferences.QuickloadSkipStart.Value && (!ReturnedFromGame || ImpSettings.Preferences.QuickloadOnQuit.Value))
				{
					ImpOutput.Log("[SYS] Quickload is bypassing start-up sequence...");
					SceneManager.LoadScene("InitScene");
				}
			}
		}

		[HarmonyPatch(typeof(MenuManager))]
		internal static class MenuManagerPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("Start")]
			private static void StartPatch(MenuManager __instance)
			{
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Expected O, but got Unknown
				if (ImpSettings.Preferences.QuickloadSkipMenu.Value && (!ReturnedFromGame || ImpSettings.Preferences.QuickloadOnQuit.Value))
				{
					int value = ImpSettings.Preferences.QuickloadSaveNumber.Value;
					ImpOutput.Log($"[SYS] Quickload is loading level #{value}...");
					string text = $"LCSaveFile{value}";
					if (ImpSettings.Preferences.QuickloadCleanFile.Value && ES3.FileExists(text))
					{
						ES3.DeleteFile(text);
					}
					GameNetworkManager.Instance.currentSaveFileName = text;
					GameNetworkManager.Instance.saveFileNum = ImpSettings.Preferences.QuickloadSaveNumber.Value;
					GameNetworkManager.Instance.lobbyHostSettings = new HostSettings("Imperium Test Environment", false, "");
					GameNetworkManager.Instance.StartHost();
					ImpNetworkManager.IsHost.Set(value: true);
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch("SetLoadingScreen")]
			private static bool SetLoadingScreenPatch(MenuManager __instance)
			{
				if (ImpSettings.Preferences.QuickloadSkipMenu.Value)
				{
					return ReturnedFromGame;
				}
				return true;
			}

			[HarmonyPostfix]
			[HarmonyPatch("Awake")]
			private static void AwakePatch(MenuManager __instance)
			{
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)__instance.versionNumberText != (Object)null)
				{
					((TMP_Text)__instance.versionNumberText).text = ((TMP_Text)__instance.versionNumberText).text + " (Imperium 0.1.2)";
					((TMP_Text)__instance.versionNumberText).margin = new Vector4(0f, 0f, -300f, 0f);
				}
			}
		}

		internal static bool ReturnedFromGame;
	}
	[HarmonyPatch(typeof(QuickMenuManager))]
	internal static class QuickMenuManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("LeaveGameConfirm")]
		private static void LeaveGameConfirmPatch()
		{
			PreInitPatches.ReturnedFromGame = true;
			Imperium.Unload();
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal static class RoundManagerPatch
	{
		internal static readonly Dictionary<string, List<Vector3>> spawnedEntitiesInCycle = new Dictionary<string, List<Vector3>>();

		[HarmonyPrefix]
		[HarmonyPatch("SpawnScrapInLevel")]
		private static void SpawnScrapInLevelPrefixPatch(RoundManager __instance)
		{
			Random random = ImpUtils.CloneRandom(__instance.AnomalyRandom);
			MoonManager.Current.ScrapAmount = (int)((float)random.Next(__instance.currentLevel.minScrap, __instance.currentLevel.maxScrap) * __instance.scrapAmountMultiplier);
			MoonManager.Current.ChallengeScrapAmount = MoonManager.Current.ScrapAmount + random.Next(10, 30);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SpawnScrapInLevel")]
		private static void SpawnScrapInLevelPostfixPatch()
		{
			Imperium.ObjectManager.RefreshLevelItems();
		}

		[HarmonyPostfix]
		[HarmonyPatch("YRotationThatFacesTheNearestFromPosition")]
		private static void YRotationThatFacesTheNearestFromPositionPatch(RoundManager __instance)
		{
			if (Imperium.IsImperiumReady)
			{
				ImpOutput.Log("[ORACLE] Oracle had to re-simulate due to YRotNear");
				Imperium.Oracle.Simulate();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("YRotationThatFacesTheFarthestFromPosition")]
		private static void YRotationThatFacesTheFarthestFromPosition(RoundManager __instance)
		{
			if (Imperium.IsImperiumReady)
			{
				ImpOutput.Log("[ORACLE] Oracle had to re-simulate due to YRotFar");
				Imperium.Oracle.Simulate();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SpawnEnemyFromVent")]
		private static void SpawnEnemyFromVentPatch(RoundManager __instance)
		{
			Imperium.ObjectManager.RefreshLevelEntities();
		}

		[HarmonyPrefix]
		[HarmonyPatch("BeginEnemySpawning")]
		private static void BeginEnemySpawningPrefixPatch(RoundManager __instance)
		{
			Imperium.Oracle.Simulate(initial: true, null);
			ImpSpawnTracker.StartCycle(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("BeginEnemySpawning")]
		private static void BeginEnemySpawningPostfixPatch(RoundManager __instance)
		{
			ImpSpawnTracker.EndCycle(__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch("AdvanceHourAndSpawnNewBatchOfEnemies")]
		private static void AdvanceHourAndSpawnNewBatchOfEnemiesPrefixPatch(RoundManager __instance)
		{
			ImpSpawnTracker.StartCycle(__instance);
			Imperium.Oracle.Simulate();
		}

		[HarmonyPostfix]
		[HarmonyPatch("AdvanceHourAndSpawnNewBatchOfEnemies")]
		private static void AdvanceHourAndSpawnNewBatchOfEnemiesPostfixPatch(RoundManager __instance)
		{
			Imperium.ObjectManager.RefreshLevelEntities();
			ImpSpawnTracker.EndCycle(__instance);
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlotOutEnemiesForNextHour")]
		private static bool PlotOutEnemiesForNextHourPatch()
		{
			return !Imperium.GameManager.IndoorSpawningPaused.Value;
		}

		[HarmonyPrefix]
		[HarmonyPatch("SpawnEnemiesOutside")]
		private static bool SpawnEnemiesOutsidePatch()
		{
			return !Imperium.GameManager.OutdoorSpawningPaused.Value;
		}

		[HarmonyPrefix]
		[HarmonyPatch("SpawnDaytimeEnemiesOutside")]
		private static bool SpawnDaytimeEnemiesOutsidePatch(RoundManager __instance)
		{
			return !Imperium.GameManager.DaytimeSpawningPaused.Value;
		}

		[HarmonyPostfix]
		[HarmonyPatch("FinishGeneratingNewLevelClientRpc")]
		private static void FinishGeneratingNewLevelClientRpcPostfixPatch()
		{
			Imperium.IsSceneLoaded.SetTrue();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("unloadSceneForAllPlayers")]
		private static void unloadSceneForAllPlayersPatch(StartOfRound __instance)
		{
			Imperium.IsSceneLoaded.SetFalse();
		}

		[HarmonyPostfix]
		[HarmonyPatch("ChooseNewRandomMapSeed")]
		private static void ChooseNewRandomMapSeedPatch(StartOfRound __instance)
		{
			if (Imperium.GameManager.CustomSeed.Value != -1)
			{
				__instance.randomMapSeed = Imperium.GameManager.CustomSeed.Value;
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	public class TimeOfDayPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("MoveGlobalTime")]
		private static bool MoveGlobalTimePrefixPatch(TimeOfDay __instance)
		{
			if (ImpSettings.Time.RealtimeClock.Value)
			{
				Imperium.HUDManager.SetClock(__instance.normalizedTimeOfDay, (float)__instance.numberOfHours, true);
			}
			if (Imperium.GameManager.TimeIsPaused.Value)
			{
				return false;
			}
			float globalTime = __instance.globalTime;
			__instance.globalTime = Mathf.Clamp(globalTime + Time.deltaTime * Imperium.GameManager.TimeSpeed.Value, 0f, __instance.globalTimeAtEndOfDay);
			__instance.timeUntilDeadline -= __instance.globalTime - globalTime;
			return false;
		}
	}
}
namespace Imperium.Patches.Objects
{
	[HarmonyPatch(typeof(EnemyAICollisionDetect))]
	internal class EnemyAICollisionDetectPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("IHittable.Hit")]
		private static void HitPatch(EnemyAICollisionDetect __instance, int force)
		{
			string enemyName = __instance.mainScript.enemyType.enemyName;
			ImpOutput.Log($"Entity {enemyName} ({((Object)__instance).GetInstanceID()}) was hit by {force} damage.");
			if (!__instance.mainScript.isEnemyDead)
			{
				ImpOutput.Send($"Entity {enemyName} was hit by {force} damage.", "Imperium", isWarning: false, NotificationType.Entities);
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal static class EnemyAIPatch
	{
		private static PlayerControllerB[] playerBackup = Array.Empty<PlayerControllerB>();

		[HarmonyPrefix]
		[HarmonyPatch("PlayerIsTargetable")]
		private static bool PlayerIsTargetablePatch(EnemyAI __instance, PlayerControllerB playerScript, ref bool __result)
		{
			if (!Imperium.IsImperiumReady)
			{
				return true;
			}
			if ((Object)(object)playerScript == (Object)(object)Imperium.Player && ImpSettings.Player.Invisibility.Value)
			{
				__result = false;
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("KillEnemy")]
		private static void KillEnemyPatch(EnemyAI __instance)
		{
			if (Imperium.IsImperiumReady)
			{
				Imperium.Oracle.Simulate("Entity " + Imperium.ObjectManager.GetDisplayName(__instance.enemyType.enemyName) + " was killed.");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("CheckLineOfSightForPlayer")]
		private static void CheckLineOfSightForPlayerPrefixPatch(EnemyAI __instance)
		{
			if (Imperium.IsImperiumReady && ImpSettings.Player.Invisibility.Value)
			{
				playerBackup = Imperium.StartOfRound.allPlayerScripts;
				Imperium.StartOfRound.allPlayerScripts = Imperium.StartOfRound.allPlayerScripts.Where((PlayerControllerB player) => (Object)(object)player != (Object)(object)Imperium.Player).ToArray();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("CheckLineOfSightForPlayer")]
		private static void CheckLineOfSightForPlayerPostfixPatch(EnemyAI __instance)
		{
			if (Imperium.IsImperiumReady && ImpSettings.Player.Invisibility.Value)
			{
				Imperium.StartOfRound.allPlayerScripts = playerBackup;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("CheckLineOfSightForClosestPlayer")]
		private static void CheckLineOfSightForClosestPlayerPrefixPatch(EnemyAI __instance)
		{
			if (Imperium.IsImperiumReady && ImpSettings.Player.Invisibility.Value)
			{
				playerBackup = Imperium.StartOfRound.allPlayerScripts;
				Imperium.StartOfRound.allPlayerScripts = Imperium.StartOfRound.allPlayerScripts.Where((PlayerControllerB player) => (Object)(object)player != (Object)(object)Imperium.Player).ToArray();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("CheckLineOfSightForClosestPlayer")]
		private static void CheckLineOfSightForClosestPlayerPostfixPatch(EnemyAI __instance)
		{
			if (Imperium.IsImperiumReady && ImpSettings.Player.Invisibility.Value)
			{
				Imperium.StartOfRound.allPlayerScripts = playerBackup;
			}
		}
	}
	[HarmonyPatch(typeof(EnemyVent))]
	internal static class EnemyVentPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SyncVentSpawnTimeClientRpc")]
		private static void SyncVentSpawnTimeClientRpcPatch(EnemyVent __instance, int time, int enemyIndex)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			SpawnableEnemyWithRarity val = Imperium.RoundManager.currentLevel.Enemies[enemyIndex];
			if (RoundManagerPatch.spawnedEntitiesInCycle.TryGetValue(val.enemyType.enemyName, out var value))
			{
				if (!value.Contains(__instance.floorNode.position))
				{
					value.Add(__instance.floorNode.position);
				}
			}
			else
			{
				List<Vector3> value2 = new List<Vector3> { __instance.floorNode.position };
				RoundManagerPatch.spawnedEntitiesInCycle[val.enemyType.enemyName] = value2;
			}
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal static class GrabbableObjectPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void UpdatePatch(GrabbableObject __instance)
		{
			if (ImpSettings.Player.InfiniteBattery.Value)
			{
				__instance.insertedBattery.charge = 1f;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("EquipItem")]
		internal static void EquipItemPatch(GrabbableObject __instance)
		{
			Shovel val = (Shovel)(object)((__instance is Shovel) ? __instance : null);
			if (val == null)
			{
				KnifeItem val2 = (KnifeItem)(object)((__instance is KnifeItem) ? __instance : null);
				if (val2 != null)
				{
					Imperium.Visualization.KnifeIndicators.Refresh(val2, isActivelyHolding: true);
				}
			}
			else
			{
				Imperium.Visualization.ShovelIndicators.Refresh(val, isActivelyHolding: true);
			}
			Imperium.Interface.Get<ImperiumUI>().ObjectExplorerWindow.Refresh();
		}

		[HarmonyPostfix]
		[HarmonyPatch("PocketItem")]
		internal static void PocketItemPatch(GrabbableObject __instance)
		{
			Shovel val = (Shovel)(object)((__instance is Shovel) ? __instance : null);
			if (val == null)
			{
				KnifeItem val2 = (KnifeItem)(object)((__instance is KnifeItem) ? __instance : null);
				if (val2 != null)
				{
					Imperium.Visualization.KnifeIndicators.Refresh(val2, isActivelyHolding: false);
				}
			}
			else
			{
				Imperium.Visualization.ShovelIndicators.Refresh(val, isActivelyHolding: false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("DiscardItem")]
		internal static void DiscardItemPatch(GrabbableObject __instance)
		{
			Imperium.Interface.Get<ImperiumUI>().ObjectExplorerWindow.Refresh();
		}
	}
	[HarmonyPatch(typeof(HangarShipDoor))]
	internal static class HangarShipDoorPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("PlayDoorAnimation")]
		private static bool PlayDoorAnimationPatch(HangarShipDoor __instance, bool closed)
		{
			if (ImpSettings.Game.OverwriteShipDoors.Value)
			{
				__instance.shipDoorsAnimator.SetBool("Closed", closed);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(KnifeItem))]
	internal static class KnifePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("DiscardItem")]
		internal static void DiscardItemPatch(KnifeItem __instance)
		{
			Imperium.Visualization.KnifeIndicators.Refresh(__instance, isActivelyHolding: false);
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	internal static class LandminePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Detonate")]
		internal static void DetonatePatch(Landmine __instance)
		{
			Imperium.Visualization.LandmineIndicators.SnapshotPlayerHitbox(((Object)__instance).GetInstanceID());
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnTriggerEnter")]
		internal static void OnTriggerEnterPrefixPatch(Landmine __instance)
		{
			if (ImpSettings.Preferences.OptimizeLogs.Value)
			{
				Debug.unityLogger.logEnabled = false;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnTriggerEnter")]
		internal static void OnTriggerEnterPostfixPatch(Landmine __instance)
		{
			if (ImpSettings.Preferences.OptimizeLogs.Value)
			{
				Debug.unityLogger.logEnabled = true;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnTriggerExit")]
		internal static void OnTriggerExitPrefixPatch(Landmine __instance)
		{
			if (ImpSettings.Preferences.OptimizeLogs.Value)
			{
				Debug.unityLogger.logEnabled = false;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnTriggerExit")]
		internal static void OnTriggerExitPostfixPatch(Landmine __instance)
		{
			if (ImpSettings.Preferences.OptimizeLogs.Value)
			{
				Debug.unityLogger.logEnabled = true;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("SpawnExplosion")]
		internal static void SpawnExplosionPrefixPatch(Landmine __instance)
		{
			if (ImpSettings.Preferences.OptimizeLogs.Value)
			{
				Debug.unityLogger.logEnabled = false;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SpawnExplosion")]
		internal static void SpawnExplosionPostfixPatch(Landmine __instance)
		{
			if (ImpSettings.Preferences.OptimizeLogs.Value)
			{
				Debug.unityLogger.logEnabled = true;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class PlayerControllerPatch
	{
		[HarmonyPatch(typeof(PlayerControllerB))]
		internal static class PreloadPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("ConnectClientToPlayerObject")]
			private static void ConnectClientToPlayerObjectPatch(PlayerControllerB __instance)
			{
				if (Imperium.IsImperiumReady && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)__instance))
				{
					Imperium.Player = __instance;
					ImpNetCommunication.Instance.RequestImperiumAccessServerRpc(NetworkManager.Singleton.LocalClientId);
				}
			}
		}

		private static bool gameHasStartedBridge;

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void UpdatePatch(PlayerControllerB __instance)
		{
			if (ImpSettings.Player.InfiniteSprint.Value)
			{
				__instance.sprintMeter = 1f;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("DamagePlayer")]
		private static void DamagePlayerPatch(PlayerControllerB __instance, int damageNumber, CauseOfDeath causeOfDeath)
		{
			if (ImpSettings.Player.GodMode.Value)
			{
				__instance.takingFallDamage = false;
				__instance.criticallyInjured = false;
				__instance.health = 100;
				ImpOutput.Send($"God mode negated {damageNumber} damage from '{((object)(CauseOfDeath)(ref causeOfDeath)).ToString()}'", "Imperium", isWarning: false, NotificationType.GodMode);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("KillPlayer")]
		private static void KillPlayerPatch(PlayerControllerB __instance, CauseOfDeath causeOfDeath)
		{
			if (ImpSettings.Player.GodMode.Value)
			{
				ImpOutput.Send("God mode saved you from death by '" + ((object)(CauseOfDeath)(ref causeOfDeath)).ToString() + "'", "Imperium", isWarning: false, NotificationType.GodMode);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("AllowPlayerDeath")]
		private static bool AllowPlayerDeathPatch(PlayerControllerB __instance, ref bool __result)
		{
			if (Imperium.PlayerManager.AllowPlayerDeathOverride)
			{
				__result = true;
				return false;
			}
			if (ImpSettings.Player.GodMode.Value)
			{
				__result = false;
				return false;
			}
			__result = true;
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("KillPlayerClientRpc")]
		private static void KillPlayerClientRpc(PlayerControllerB __instance, int playerId)
		{
			ImpOutput.Send("Employee " + __instance.playerUsername + " has died!");
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlayFootstepLocal")]
		private static bool PlayFootstepLocalPatch(PlayerControllerB __instance)
		{
			return !ImpSettings.Player.Muted.Value;
		}

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void UpdatePostfixPatch(PlayerControllerB __instance)
		{
			if (ImpSettings.Player.DisableLocking.Value)
			{
				__instance.snapToServerPosition = false;
				__instance.inSpecialInteractAnimation = false;
			}
			if (!(ImpSettings.Player.CustomFieldOfView.Value < 0f))
			{
				float num = ImpSettings.Player.CustomFieldOfView.Value;
				if (__instance.isSprinting)
				{
					num += 2f;
				}
				__instance.gameplayCamera.fieldOfView = num;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("BeginGrabObject")]
		private static void BeginGrabObjectPrefixPatch(PlayerControllerB __instance)
		{
			gameHasStartedBridge = GameNetworkManager.Instance.gameHasStarted;
			if (ImpSettings.Player.PickupOverwrite.Value)
			{
				GameNetworkManager.Instance.gameHasStarted = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("BeginGrabObject")]
		private static void BeginGrabObjectPostfixPatch(PlayerControllerB __instance)
		{
			GameNetworkManager.Instance.gameHasStarted = gameHasStartedBridge;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Discard_performed")]
		private static bool Discard_performedPatch(PlayerControllerB __instance)
		{
			if (!__instance.quickMenuManager.isMenuOpen)
			{
				return !__instance.isFreeCamera;
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("ScrollMouse_performed")]
		private static bool ScrollMouse_performedPatch(PlayerControllerB __instance)
		{
			if (!__instance.quickMenuManager.isMenuOpen)
			{
				return !__instance.isFreeCamera;
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Jump_performed")]
		private static bool Jump_performedPatch(PlayerControllerB __instance)
		{
			if (!__instance.quickMenuManager.isMenuOpen)
			{
				return !__instance.isFreeCamera;
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("Crouch_performed")]
		private static bool Crouch_performedPatch(PlayerControllerB __instance)
		{
			if (!__instance.quickMenuManager.isMenuOpen)
			{
				return !__instance.isFreeCamera;
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("ActivateItem_performed")]
		private static bool ActivateItem_performedPatch(PlayerControllerB __instance)
		{
			if (!__instance.quickMenuManager.isMenuOpen)
			{
				return !__instance.isFreeCamera;
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("InspectItem_performed")]
		private static bool InspectItem_performedPatch(PlayerControllerB __instance)
		{
			if (!__instance.quickMenuManager.isMenuOpen)
			{
				return !__instance.isFreeCamera;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(SandSpiderAI))]
	internal static class SandSpiderAIPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SpawnWebTrapClientRpc")]
		private static void SpawnWebTrapClientRpcPatch()
		{
			Imperium.Visualization.RefreshOverlays();
			Imperium.ObjectManager.RefreshLevelObstacles();
		}
	}
	[HarmonyPatch(typeof(ShotgunItem))]
	internal static class ShotgunItemPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ShootGun")]
		private static void ShootGunPatch(ShotgunItem __instance)
		{
			if (ImpSettings.Shotgun.InfiniteAmmo.Value)
			{
				__instance.shellsLoaded = 2;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		private static void UpdatePatch(ShotgunItem __instance)
		{
			if (((GrabbableObject)__instance).isHeld)
			{
				((GrabbableObject)__instance).useCooldown = (ImpSettings.Shotgun.FullAuto.Value ? 0f : 0.7f);
				if (ImpSettings.Shotgun.InfiniteAmmo.Value)
				{
					__instance.shellsLoaded = 2;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("EquipItem")]
		private static void EquipItemPostfixPatch(ShotgunItem __instance)
		{
			Imperium.Visualization.ShotgunIndicators.Refresh(__instance, isActivelyHolding: true);
		}

		[HarmonyPrefix]
		[HarmonyPatch("PocketItem")]
		private static void PocketItemPrefixPatch(ShotgunItem __instance)
		{
			((GrabbableObject)__instance).useCooldown = 0.7f;
			Imperium.Visualization.ShotgunIndicators.Refresh(__instance, isActivelyHolding: false);
		}

		[HarmonyPrefix]
		[HarmonyPatch("DiscardItem")]
		private static void DiscardItemPrefixPatch(ShotgunItem __instance)
		{
			((GrabbableObject)__instance).useCooldown = 0.7f;
			Imperium.Visualization.ShotgunIndicators.Refresh(__instance, isActivelyHolding: false);
		}
	}
	[HarmonyPatch(typeof(Shovel))]
	internal static class ShovelPatch
	{
		private static readonly int ShovelHit = Animator.StringToHash("shovelHit");

		private static readonly int ReelingUp = Animator.StringToHash("reelingUp");

		[HarmonyPostfix]
		[HarmonyPatch("DiscardItem")]
		internal static void DiscardItemPatch(Shovel __instance)
		{
			Imperium.Visualization.ShovelIndicators.Refresh(__instance, isActivelyHolding: false);
		}

		[HarmonyPrefix]
		[HarmonyPatch("ItemActivate")]
		internal static bool ItemActivate(Shovel __instance, bool used, bool buttonDown = true)
		{
			if (!ImpSettings.Shovel.Speedy.Value || !Object.op_Implicit((Object)(object)((GrabbableObject)__instance).playerHeldBy))
			{
				((GrabbableObject)__instance).playerHeldBy.playerBodyAnimator.speed = 1f;
				return true;
			}
			__instance.isHoldingButton = buttonDown;
			if (!__instance.reelingUp && buttonDown)
			{
				((GrabbableObject)__instance).playerHeldBy.playerBodyAnimator.speed = 3f;
				__instance.reelingUp = true;
				Reflection.Set<Shovel, PlayerControllerB>(__instance, "previousPlayerHeldBy", ((GrabbableObject)__instance).playerHeldBy);
				Coroutine val = Reflection.Get<Shovel, Coroutine>(__instance, "reelingUpCoroutine");
				if (val != null)
				{
					((MonoBehaviour)__instance).StopCoroutine(val);
				}
				Reflection.Set<Shovel, Coroutine>(__instance, "reelingUpCoroutine", ((MonoBehaviour)__instance).StartCoroutine(reelUpShovelPatch(__instance)));
			}
			return false;
		}

		private static IEnumerator reelUpShovelPatch(Shovel shovel)
		{
			((GrabbableObject)shovel).playerHeldBy.activatingItem = true;
			((GrabbableObject)shovel).playerHeldBy.twoHanded = true;
			((GrabbableObject)shovel).playerHeldBy.playerBodyAnimator.ResetTrigger(ShovelHit);
			((GrabbableObject)shovel).playerHeldBy.playerBodyAnimator.SetBool(ReelingUp, true);
			shovel.shovelAudio.PlayOneShot(shovel.reelUp);
			shovel.ReelUpSFXServerRpc();
			yield return (object)new WaitUntil((Func<bool>)(() => !shovel.isHoldingButton || !((GrabbableObject)shovel).isHeld));
			shovel.SwingShovel(!((GrabbableObject)shovel).isHeld);
			yield return (object)new WaitForEndOfFrame();
			shovel.HitShovel(!((GrabbableObject)shovel).isHeld);
			shovel.reelingUp = false;
			Reflection.Set<Shovel, Coroutine>(shovel, "reelingUpCoroutine", null);
			yield return null;
		}
	}
	[HarmonyPatch(typeof(SprayPaintItem))]
	internal static class SprayPaintItemPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("LateUpdate")]
		private static void LateUpdatePatch(SprayPaintItem __instance)
		{
			if (ImpSettings.Player.InfiniteBattery.Value)
			{
				Reflection.Set<SprayPaintItem, int>(__instance, "sprayCanTank", 1);
				Reflection.Set<SprayPaintItem, int>(__instance, "sprayCanShakeMeter", 1);
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal static class TerminalPatch
	{
		[HarmonyPatch(typeof(Terminal))]
		internal static class PreloadPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("Start")]
			private static void StartPatch()
			{
				GameObject val = GameObject.Find("IngamePlayerHUD");
				if (Object.op_Implicit((Object)(object)val))
				{
					Transform obj = val.transform.Find("BottomMiddle/SystemsOnline/TipLeft1");
					((Component)obj).GetComponent<TMP_Text>().text = "GREETINGS, PADAWAN";
					((Component)obj).GetComponent<TMP_Text>().fontSize = 30f;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("BeginUsingTerminal")]
		private static void BeginUsingTerminalPatch()
		{
			Imperium.Interface.Close();
		}
	}
}
namespace Imperium.Oracle
{
	internal class Oracle
	{
		internal readonly ImpBinding<OracleState> State = new ImpBinding<OracleState>(new OracleState());

		internal void Simulate()
		{
			Simulate(initial: false, null);
		}

		internal void Simulate(string reason)
		{
			Simulate(initial: false, reason);
		}

		internal void Simulate(bool initial, string reason)
		{
			int num = Reflection.Get<RoundManager, int>(Imperium.RoundManager, "currentHour");
			if (!initial)
			{
				num += Imperium.RoundManager.hourTimeBetweenEnemySpawnBatches;
			}
			Random anomalySimulator = ImpUtils.CloneRandom(Imperium.RoundManager.AnomalyRandom);
			Random entitySimulator = ImpUtils.CloneRandom(Imperium.RoundManager.EnemySpawnRandom);
			Random outsideEntitySimulator = ImpUtils.CloneRandom(Imperium.RoundManager.OutsideEnemySpawnRandom);
			RoundManager roundManager = Imperium.RoundManager;
			SelectableLevel currentLevel = roundManager.currentLevel;
			float num2 = Imperium.TimeOfDay.currentDayTime;
			float currentPower = roundManager.currentEnemyPower;
			float currentPower2 = roundManager.currentOutsideEnemyPower;
			float currentPower3 = roundManager.currentDaytimeEnemyPower;
			bool cannotSpawnMoreInsideEnemies = roundManager.cannotSpawnMoreInsideEnemies;
			Dictionary<EnemyType, int> entitySpawnCounts = currentLevel.Enemies.ToDictionary((SpawnableEnemyWithRarity entity) => entity.enemyType, (SpawnableEnemyWithRarity entity) => entity.enemyType.numberSpawned);
			Dictionary<EnemyType, int> entitySpawnCounts2 = currentLevel.OutsideEnemies.ToDictionary((SpawnableEnemyWithRarity entity) => entity.enemyType, (SpawnableEnemyWithRarity entity) => entity.enemyType.numberSpawned);
			Dictionary<EnemyType, int> entitySpawnCounts3 = currentLevel.DaytimeEnemies.ToDictionary((SpawnableEnemyWithRarity entity) => entity.enemyType, (SpawnableEnemyWithRarity entity) => entity.enemyType.numberSpawned);
			bool firstTimeSpawning = Reflection.Get<RoundManager, bool>(roundManager, "firstTimeSpawningEnemies");
			bool firstTimeSpawning2 = Reflection.Get<RoundManager, bool>(roundManager, "firstTimeSpawningOutsideEnemies");
			bool firstTimeSpawning3 = Reflection.Get<RoundManager, bool>(roundManager, "firstTimeSpawningDaytimeEnemies");
			State.Value.currentCycle = Mathf.RoundToInt((float)num * Imperium.TimeOfDay.lengthOfHours / Imperium.TimeOfDay.totalTime * 9f);
			for (int i = State.Value.currentCycle; i <= 9; i++)
			{
				State.Value.cycles[i].cycleTime = num2;
				if (!Imperium.GameManager.DaytimeSpawningPaused.Value)
				{
					State.Value.daytimeCycles[i] = SimulateDaytimeSpawnCycle(anomalySimulator, entitySimulator, ref currentPower3, entitySpawnCounts3, ref firstTimeSpawning3, num, num2);
				}
				if (!Imperium.GameManager.OutdoorSpawningPaused.Value)
				{
					State.Value.outdoorCycles[i] = SimulateOutdoorSpawnCycle(anomalySimulator, outsideEntitySimulator, ref currentPower2, entitySpawnCounts2, ref firstTimeSpawning2, num, num2);
				}
				List<int> list = new List<int>();
				if (!Imperium.GameManager.IndoorSpawningPaused.Value)
				{
					State.Value.indoorCycles[i] = SimulateIndoorSpawnCycle(anomalySimulator, entitySimulator, ref currentPower, entitySpawnCounts, ref cannotSpawnMoreInsideEnemies, ref firstTimeSpawning, num, num2);
					list = State.Value.indoorCycles[i].Select((SpawnReport report) => report.spawnTime).ToList();
				}
				float num3 = Imperium.TimeOfDay.lengthOfHours * (float)num;
				State.Value.cycles[i].minSpawnTime = (int)(10f + num3);
				State.Value.cycles[i].maxSpawnTime = (float)((int)Imperium.TimeOfDay.lengthOfHours * roundManager.hourTimeBetweenEnemySpawnBatches) + num3 - 1f;
				list.Add((num + 1) * (int)Imperium.TimeOfDay.lengthOfHours);
				int num4 = list.Max();
				State.Value.cycles[i].nextCycleTime = num4;
				num += Imperium.RoundManager.hourTimeBetweenEnemySpawnBatches;
				num2 = num4;
			}
			State.Value.PrintLog();
			if (!string.IsNullOrEmpty(reason))
			{
				ImpOutput.Send("Spawn predictions updated due to " + reason + "!", "Imperium", isWarning: false, NotificationType.OracleUpdate);
			}
			State.Refresh();
		}

		private static List<SpawnReport> SimulateIndoorSpawnCycle(Random anomalySimulator, Random entitySimulator, ref float currentPower, IDictionary<EnemyType, int> entitySpawnCounts, ref bool cannotSpawnMoreInsideEnemies, ref bool firstTimeSpawning, int currentHour, float currentDayTime)
		{
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			RoundManager roundManager = Imperium.RoundManager;
			List<SpawnReport> list = new List<SpawnReport>();
			List<EnemyVent> list2 = Imperium.RoundManager.allEnemyVents.Where((EnemyVent t) => !t.occupied).ToList();
			float num = Imperium.TimeOfDay.lengthOfHours * (float)currentHour;
			if (!list2.Any() | cannotSpawnMoreInsideEnemies)
			{
				return list;
			}
			float num2 = roundManager.currentLevel.enemySpawnChanceThroughoutDay.Evaluate(currentDayTime / roundManager.timeScript.totalTime);
			if (StartOfRound.Instance.isChallengeFile)
			{
				num2 += 1f;
			}
			float num3 = num2 + (float)Mathf.Abs(Imperium.TimeOfDay.daysUntilDeadline - 3) / 1.6f;
			int num4 = Mathf.Clamp(anomalySimulator.Next((int)(num3 - roundManager.currentLevel.spawnProbabilityRange), (int)(num2 + roundManager.currentLevel.spawnProbabilityRange)), roundManager.minEnemiesToSpawn, 20);
			num4 = Mathf.Clamp(num4, 0, list2.Count);
			if (currentPower >= roundManager.currentMaxInsidePower)
			{
				cannotSpawnMoreInsideEnemies = true;
				return list;
			}
			for (int i = 0; i < num4; i++)
			{
				List<int> list3 = new List<int>();
				int spawnTime = anomalySimulator.Next((int)(10f + num), (int)(Imperium.TimeOfDay.lengthOfHours * (float)roundManager.hourTimeBetweenEnemySpawnBatches + num));
				EnemyVent val = list2[anomalySimulator.Next(list2.Count)];
				for (int j = 0; j < roundManager.currentLevel.Enemies.Count; j++)
				{
					EnemyType enemyType = roundManager.currentLevel.Enemies[j].enemyType;
					bool num5 = enemyType.spawningDisabled || enemyType.PowerLevel > roundManager.currentMaxInsidePower - currentPower || entitySpawnCounts[enemyType] >= enemyType.MaxCount;
					if (firstTimeSpawning)
					{
						firstTimeSpawning = false;
						entitySpawnCounts[enemyType] = 0;
					}
					if (num5)
					{
						list3.Add(0);
						continue;
					}
					int item = ((roundManager.increasedInsideEnemySpawnRateIndex == j) ? 100 : ((!enemyType.useNumberSpawnedFalloff) ? ((int)((float)roundManager.currentLevel.Enemies[j].rarity * enemyType.probabilityCurve.Evaluate(currentDayTime / roundManager.timeScript.totalTime))) : ((int)((float)roundManager.currentLevel.Enemies[j].rarity * (enemyType.probabilityCurve.Evaluate(currentDayTime / roundManager.timeScript.totalTime) * enemyType.numberSpawnedFalloff.Evaluate((float)entitySpawnCounts[enemyType] / 10f))))));
					list3.Add(item);
				}
				if (list3.Sum() != 0)
				{
					int randomWeightedIndex = roundManager.GetRandomWeightedIndex(list3.ToArray(), entitySimulator);
					EnemyType enemyType2 = roundManager.currentLevel.Enemies[randomWeightedIndex].enemyType;
					currentPower += enemyType2.PowerLevel;
					entitySpawnCounts[enemyType2]++;
					list.Add(new SpawnReport
					{
						entity = enemyType2,
						position = val.floorNode.position,
						spawnTime = spawnTime
					});
				}
			}
			return list;
		}

		private static List<SpawnReport> SimulateOutdoorSpawnCycle(Random anomalySimulator, Random outsideEntitySimulator, ref float currentPower, IDictionary<EnemyType, int> entitySpawnCounts, ref bool firstTimeSpawning, int currentHour, float currentDayTime)
		{
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			RoundManager roundManager = Imperium.RoundManager;
			List<SpawnReport> list = new List<SpawnReport>();
			if (currentPower > roundManager.currentMaxOutsidePower)
			{
				return list;
			}
			float num = Imperium.TimeOfDay.lengthOfHours * (float)currentHour;
			float num2 = (float)(int)(roundManager.currentLevel.outsideEnemySpawnChanceThroughDay.Evaluate(num / Imperium.TimeOfDay.totalTime) * 100f) / 100f;
			if (Imperium.StartOfRound.isChallengeFile)
			{
				num2 += 1f;
			}
			int num3 = (int)(num2 + (float)Mathf.Abs(Imperium.TimeOfDay.daysUntilDeadline - 3) / 1.6f - 3f);
			int num4 = (int)(num2 + 3f);
			int num5 = Mathf.Clamp(outsideEntitySimulator.Next(Mathf.Min(num3, num4), Mathf.Max(num3, num4)), roundManager.minOutsideEnemiesToSpawn, 20);
			GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
			for (int i = 0; i < num5; i++)
			{
				List<int> list2 = new List<int>();
				for (int j = 0; j < roundManager.currentLevel.OutsideEnemies.Count; j++)
				{
					EnemyType enemyType = roundManager.currentLevel.OutsideEnemies[j].enemyType;
					if (firstTimeSpawning)
					{
						firstTimeSpawning = false;
						entitySpawnCounts[enemyType] = 0;
					}
					if (enemyType.PowerLevel > roundManager.currentMaxOutsidePower - currentPower || entitySpawnCounts[enemyType] >= enemyType.MaxCount || enemyType.spawningDisabled)
					{
						list2.Add(0);
						continue;
					}
					int item = ((roundManager.increasedOutsideEnemySpawnRateIndex == j) ? 100 : ((!enemyType.useNumberSpawnedFalloff) ? ((int)((float)roundManager.currentLevel.OutsideEnemies[j].rarity * enemyType.probabilityCurve.Evaluate(num / Imperium.TimeOfDay.totalTime))) : ((int)((float)roundManager.currentLevel.OutsideEnemies[j].rarity * (enemyType.probabilityCurve.Evaluate(num / Imperium.TimeOfDay.totalTime) * enemyType.numberSpawnedFalloff.Evaluate((float)entitySpawnCounts[enemyType] / 10f))))));
					list2.Add(item);
				}
				if (list2.Sum() == 0)
				{
					continue;
				}
				int randomWeightedIndex = roundManager.GetRandomWeightedIndex(list2.ToArray(), outsideEntitySimulator);
				EnemyType spawningEntity = roundManager.currentLevel.OutsideEnemies[randomWeightedIndex].enemyType;
				if (spawningEntity.requireNestObjectsToSpawn && Object.FindObjectsByType<EnemyAINestSpawnObject>((FindObjectsSortMode)0).All((EnemyAINestSpawnObject t) => (Object)(object)t.enemyType != (Object)(object)spawningEntity))
				{
					continue;
				}
				float num6 = Mathf.Max(spawningEntity.spawnInGroupsOf, 1);
				for (int k = 0; (float)k < num6; k++)
				{
					if (spawningEntity.PowerLevel > roundManager.currentMaxOutsidePower - currentPower)
					{
						break;
					}
					Vector3 position = array[anomalySimulator.Next(0, array.Length)].transform.position;
					position = roundManager.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), anomalySimulator, roundManager.GetLayermaskForEnemySizeLimit(spawningEntity));
					position = PositionWithDenialPointsChecked(position, array, spawningEntity, anomalySimulator);
					currentPower += spawningEntity.PowerLevel;
					entitySpawnCounts[spawningEntity]++;
					list.Add(new SpawnReport
					{
						entity = spawningEntity,
						position = position,
						spawnTime = (int)currentDayTime
					});
				}
			}
			return list;
		}

		private static List<SpawnReport> SimulateDaytimeSpawnCycle(Random anomalySimulator, Random entitySimulator, ref float currentPower, IDictionary<EnemyType, int> entitySpawnCounts, ref bool firstTimeSpawning, int currentHour, float currentDayTime)
		{
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			RoundManager roundManager = Imperium.RoundManager;
			List<SpawnReport> list = new List<SpawnReport>();
			List<SpawnableEnemyWithRarity> daytimeEnemies = roundManager.currentLevel.DaytimeEnemies;
			if (daytimeEnemies == null || daytimeEnemies.Count <= 0 || currentPower > (float)roundManager.currentLevel.maxDaytimeEnemyPowerCount)
			{
				return list;
			}
			float num = Imperium.TimeOfDay.lengthOfHours * (float)currentHour;
			float num2 = roundManager.currentLevel.daytimeEnemySpawnChanceThroughDay.Evaluate(num / Imperium.TimeOfDay.totalTime);
			int num3 = Mathf.Clamp(anomalySimulator.Next((int)(num2 - roundManager.currentLevel.daytimeEnemiesProbabilityRange), (int)(num2 + roundManager.currentLevel.daytimeEnemiesProbabilityRange)), 0, 20);
			GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
			int num4 = 0;
			if (num4 < num3)
			{
				List<int> list2 = new List<int>();
				foreach (SpawnableEnemyWithRarity daytimeEnemy in roundManager.currentLevel.DaytimeEnemies)
				{
					if (firstTimeSpawning)
					{
						firstTimeSpawning = false;
						entitySpawnCounts[daytimeEnemy.enemyType] = 0;
					}
					if (daytimeEnemy.enemyType.PowerLevel > (float)roundManager.currentLevel.maxDaytimeEnemyPowerCount - currentPower || entitySpawnCounts[daytimeEnemy.enemyType] >= daytimeEnemy.enemyType.MaxCount || daytimeEnemy.enemyType.normalizedTimeInDayToLeave < currentDayTime / roundManager.timeScript.totalTime || daytimeEnemy.enemyType.spawningDisabled)
					{
						list2.Add(0);
						continue;
					}
					int item = (int)((float)daytimeEnemy.rarity * daytimeEnemy.enemyType.probabilityCurve.Evaluate(num / roundManager.timeScript.totalTime));
					list2.Add(item);
				}
				if (list2.Sum() != 0)
				{
					int randomWeightedIndex = roundManager.GetRandomWeightedIndex(list2.ToArray(), entitySimulator);
					EnemyType enemyType = roundManager.currentLevel.DaytimeEnemies[randomWeightedIndex].enemyType;
					float num5 = Mathf.Max(enemyType.spawnInGroupsOf, 1);
					for (int i = 0; (float)i < num5; i++)
					{
						if (enemyType.PowerLevel > (float)roundManager.currentLevel.maxDaytimeEnemyPowerCount - currentPower)
						{
							break;
						}
						Vector3 position = array[anomalySimulator.Next(0, array.Length)].transform.position;
						position = roundManager.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), entitySimulator, roundManager.GetLayermaskForEnemySizeLimit(enemyType));
						position = PositionWithDenialPointsChecked(position, array, enemyType, anomalySimulator);
						currentPower += enemyType.PowerLevel;
						entitySpawnCounts[enemyType]++;
						list.Add(new SpawnReport
						{
							entity = enemyType,
							position = position,
							spawnTime = (int)currentDayTime
						});
					}
				}
			}
			return list;
		}

		private static Vector3 PositionWithDenialPointsChecked(Vector3 spawnPosition, IReadOnlyList<GameObject> spawnPoints, EnemyType enemyType, Random randomSimulator)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (spawnPoints.Count == 0)
			{
				return spawnPosition;
			}
			int num = 0;
			bool flag = false;
			for (int i = 0; i < spawnPoints.Count - 1; i++)
			{
				GameObject[] spawnDenialPoints = Imperium.RoundManager.spawnDenialPoints;
				foreach (GameObject val in spawnDenialPoints)
				{
					flag = true;
					if (Vector3.Distance(spawnPosition, val.transform.position) < 16f)
					{
						num = (num + 1) % spawnPoints.Count;
						spawnPosition = spawnPoints[num].transform.position;
						spawnPosition = Imperium.RoundManager.GetRandomNavMeshPositionInBoxPredictable(spawnPosition, 10f, default(NavMeshHit), randomSimulator, Imperium.RoundManager.GetLayermaskForEnemySizeLimit(enemyType));
						flag = false;
						break;
					}
				}
				if (flag)
				{
					break;
				}
			}
			return spawnPosition;
		}
	}
	public record CycleInformation
	{
		public float cycleTime;

		public float nextCycleTime;

		public float minSpawnTime;

		public float maxSpawnTime;
	}
	public record SpawnReport
	{
		public EnemyType entity;

		public Vector3 position;

		public int spawnTime;

		[CompilerGenerated]
		protected virtual bool PrintMembers(StringBuilder builder)
		{
			RuntimeHelpers.EnsureSufficientExecutionStack();
			builder.Append("entity = ");
			builder.Append(entity);
			builder.Append(", position = ");
			builder.Append(((object)(Vector3)(ref position)).ToString());
			builder.Append(", spawnTime = ");
			builder.Append(spawnTime.ToString());
			return true;
		}
	}
	public record OracleState
	{
		public int currentCycle;

		public readonly CycleInformation[] cycles = new CycleInformation[10]
		{
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation(),
			new CycleInformation()
		};

		public readonly List<SpawnReport>[] indoorCycles = new List<SpawnReport>[10]
		{
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>()
		};

		public readonly List<SpawnReport>[] outdoorCycles = new List<SpawnReport>[10]
		{
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>()
		};

		public readonly List<SpawnReport>[] daytimeCycles = new List<SpawnReport>[10]
		{
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<SpawnReport>(),
			new List<Spaw