Decompiled source of The Timestopper v1.6.6

The Timestopper.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using PluginConfiguratorComponents;
using Sandbox.Arm;
using TMPro;
using ULTRAKILL.Cheats;
using ULTRAKILL.Portal;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("The Timestopper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("The Timestopper")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c602a639-0d74-4ae5-a633-6ae2db957a9e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace The_Timestopper;

public class CustomTime : MonoBehaviour
{
	public struct TimeLayer
	{
		public float _timeScale;

		public float _fixedDeltaTime;

		public TimeLayer(float timeScale = 1f, float fixedDeltaTime = 0.02f)
		{
			_timeScale = timeScale;
			_fixedDeltaTime = fixedDeltaTime;
		}
	}

	private static Dictionary<int, TimeLayer> layers = new Dictionary<int, TimeLayer>();

	private static Dictionary<int, int> contributors = new Dictionary<int, int>();

	private static Dictionary<GameObject, CustomTime> gameObjectBindings = new Dictionary<GameObject, CustomTime>();

	private static Dictionary<GameObject, int> gameObjectids = new Dictionary<GameObject, int>();

	private static TimeLayer currentLayer = default(TimeLayer);

	private static GameObject currentGameObject;

	public static bool allPersistent = false;

	private int _layer = 0;

	public static float timeScale => currentLayer._timeScale;

	public static float deltaTime => Time.unscaledDeltaTime * currentLayer._timeScale;

	public static float fixedDeltaTime => currentLayer._fixedDeltaTime;

	public int layer
	{
		get
		{
			return _layer;
		}
		set
		{
			contributors[_layer]--;
			if (contributors[_layer] == 0 && !allPersistent)
			{
				contributors.Remove(_layer);
			}
			_layer = value;
			if (contributors[value] == -1)
			{
				contributors[value]++;
			}
			contributors[value]++;
			gameObjectids[((Component)this).gameObject] = value;
			if ((Object)(object)currentGameObject == (Object)(object)((Component)this).gameObject)
			{
				currentLayer = layers[value];
			}
		}
	}

	public static int Layer
	{
		get
		{
			return Object.op_Implicit((Object)(object)currentGameObject) ? gameObjectids[currentGameObject] : 0;
		}
		set
		{
			if (Object.op_Implicit((Object)(object)currentGameObject))
			{
				gameObjectBindings[currentGameObject].layer = value;
			}
		}
	}

	public static void CreateTimeLayer(int id, TimeLayer layer)
	{
		if (!layers.TryAdd(id, layer))
		{
			throw new Exception("Cannot create a layer in the spot that already exists.");
		}
		contributors[id] = -1;
	}

	public static void SetTimeLayer(int id, TimeLayer timeLayer)
	{
		if (!layers.ContainsKey(id))
		{
			contributors[id] = -1;
		}
		layers[id] = timeLayer;
	}

	public static void BindLayer(int bindLayer)
	{
		currentLayer = layers[bindLayer];
	}

	public static void Bind(TimeLayer timeLayer)
	{
		currentLayer = timeLayer;
	}

	public static void Bind(GameObject go)
	{
		if (!gameObjectBindings.ContainsKey(go))
		{
			go.AddComponent<CustomTime>();
		}
		currentLayer = layers[gameObjectids[go]];
		currentGameObject = go;
	}

	private void Awake()
	{
		if (!layers.ContainsKey(layer))
		{
			CreateTimeLayer(layer, default(TimeLayer));
		}
		gameObjectBindings.Add(((Component)this).gameObject, this);
		gameObjectids.Add(((Component)this).gameObject, layer);
		if (contributors[layer] == -1)
		{
			contributors[layer]++;
		}
		contributors[layer]++;
	}

	private void OnDestroy()
	{
		gameObjectBindings.Remove(((Component)this).gameObject);
		gameObjectids.Remove(((Component)this).gameObject);
		contributors[layer]--;
		if (contributors[layer] == 0 && !allPersistent)
		{
			contributors.Remove(layer);
		}
	}

	public void Bind()
	{
		currentLayer = layers[layer];
	}

	public void SetCurrentLayerTimeScale(float TimeScale)
	{
		layers[layer] = new TimeLayer(TimeScale, layers[layer]._fixedDeltaTime);
	}
}
[Serializable]
public class TimestopperProgress
{
	public bool hasArm;

	public bool equippedArm;

	public bool firstWarning;

	public int upgradeCount;

	public float maxTime = 3f;

	public float version = 0.9f;

	public const float latestVersion = 1f;

	private static TimestopperProgress _instance;

	private const string PROGRESS_FILE = "timestopper.state";

	public static TimestopperProgress Instance
	{
		get
		{
			if (_instance == null)
			{
				_instance = Read();
			}
			return _instance;
		}
		set
		{
			_instance = value;
			Write(_instance);
		}
	}

	public static bool HasArm => Instance.hasArm;

	public static bool EquippedArm => Instance.equippedArm;

	public static bool FirstWarning => Instance.firstWarning;

	public static int UpgradeCount => Instance.upgradeCount;

	public static string UpgradeText => "<align=\"center\"><color=#FFFF42>" + GenerateTextBar('▮', Instance.upgradeCount) + "</color>";

	public static float MaxTime => Instance.maxTime;

	public static float UpgradeCost => 150000 + Instance.upgradeCount * 66000;

	public int upgradeCost => 150000 + upgradeCount * 66000;

	public new static string ToString()
	{
		TimestopperProgress timestopperProgress = Read();
		return $"Timestopper saved progress:\r\n            - has arm: {timestopperProgress.hasArm}\r\n            - equipped: {timestopperProgress.equippedArm}\r\n            - firstwarning: {timestopperProgress.firstWarning}\r\n            - upgrades: {timestopperProgress.upgradeCount}\r\n            - max time: {timestopperProgress.maxTime}\r\n            - version: {timestopperProgress.version}";
	}

	private static string GenerateTextBar(char c, int b)
	{
		string text = "";
		for (int i = 0; i < b; i++)
		{
			text += c;
		}
		return text;
	}

	public static void UpgradeArm()
	{
		GameProgressSaver.AddMoney(-Instance.upgradeCost);
		Instance.maxTime += 1f + 1f / ((float)Instance.upgradeCount + 0.5f);
		Instance.upgradeCount++;
		Write(Instance);
	}

	public static void ForceDowngradeArm()
	{
		if (Timestopper.maxUpgrades.value < 0)
		{
			Timestopper.maxUpgrades.value = 1;
		}
		while (Instance.upgradeCount > Timestopper.maxUpgrades.value)
		{
			Instance.upgradeCount--;
			Instance.maxTime -= 1f + 1f / ((float)Instance.upgradeCount + 0.5f);
		}
		Write(Instance);
	}

	public static void AcceptWarning()
	{
		Instance.firstWarning = true;
		Write(Instance);
	}

	public static void GiveArm()
	{
		Instance.hasArm = true;
		Instance.equippedArm = true;
		Write(Instance);
		Timestopper.mls.LogInfo((object)"Received Golden Arm");
		Playerstopper.Instance.EquipTimeArm();
	}

	public static void ChangeEquipmentStatus()
	{
		if ((Object)(object)Timestopper.LatestTerminal != (Object)null)
		{
			EquipArm(((TMP_Text)((Component)Timestopper.LatestTerminal.transform.Find("Canvas/Background/Main Panel/Weapons/Arm Window/Variation Screen/Variations/Arm Panel (Gold)/Equipment/Equipment Status/Text (TMP)")).GetComponent<TextMeshProUGUI>()).text[0] == 'E');
		}
		else
		{
			Timestopper.mls.LogWarning((object)"LatestTerminal is Null!");
		}
		TimeHUD.ReconsiderAll();
		Timestopper.Log("Changed equipment status", extensive: true, 1);
	}

	public static void EquipArm(bool equipped)
	{
		if (!((Object)(object)Playerstopper.Instance.timeArm == (Object)null))
		{
			if (Instance.hasArm)
			{
				Instance.equippedArm = equipped;
				Playerstopper.Instance.timeArm.SetActive(equipped);
				Timestopper.Log("Gold Arm Equipment Status changed: " + Instance.equippedArm, extensive: true, 1);
				Write(Instance);
			}
			else
			{
				Timestopper.Log("Invalid request of arm equipment, user doesn't have the arm yet!", extensive: true, 2);
				GiveArm();
			}
		}
	}

	public static void Reset()
	{
		string text = Path.Combine(GameProgressSaver.SavePath, "timestopper.state");
		if (File.Exists(text))
		{
			File.Delete(text);
		}
		Timestopper.mls.LogWarning((object)("Deleting save file at: " + text));
		Instance = new TimestopperProgress();
	}

	public static TimestopperProgress Read()
	{
		try
		{
			string path = Path.Combine(GameProgressSaver.SavePath, "timestopper.state");
			if (File.Exists(path))
			{
				string text = File.ReadAllText(path);
				Instance = JsonUtility.FromJson<TimestopperProgress>(text);
				if (Instance == null)
				{
					_instance = new TimestopperProgress();
				}
			}
			else
			{
				_instance = new TimestopperProgress();
			}
		}
		catch (Exception ex)
		{
			Timestopper.mls.LogError((object)$"Failed to read progress: {ex.Message}, resetting save file {GameProgressSaver.currentSlot}");
			Instance = new TimestopperProgress();
		}
		return Instance;
	}

	public static void Write(TimestopperProgress progress)
	{
		try
		{
			string path = Path.Combine(GameProgressSaver.SavePath, "timestopper.state");
			string contents = JsonUtility.ToJson((object)progress, true);
			File.WriteAllText(path, contents);
		}
		catch (Exception ex)
		{
			Timestopper.mls.LogError((object)("Failed to write progress: " + ex.Message));
		}
	}
}
public class SceneTreeChangeWatcher : MonoBehaviour
{
	private static HashSet<GameObject> oldRootGameObjects = new HashSet<GameObject>();

	private static List<GameObject> rootGameObjects = new List<GameObject>();

	public static void StartWatchingSceneForTreeChanges()
	{
		StatsManager instance = MonoSingleton<StatsManager>.Instance;
		if (instance != null)
		{
			((Component)instance).gameObject.AddComponent<SceneTreeChangeWatcher>();
		}
	}

	private void Update()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		Scene activeScene = SceneManager.GetActiveScene();
		((Scene)(ref activeScene)).GetRootGameObjects(rootGameObjects);
		foreach (GameObject rootGameObject in rootGameObjects)
		{
			if (!oldRootGameObjects.Contains(rootGameObject))
			{
				ExecuteOnTreeChange.ExecuteOnNewGameObject(rootGameObject);
			}
		}
		oldRootGameObjects = rootGameObjects.ToHashSet();
	}
}
public class ExecuteOnTreeChange : MonoBehaviour
{
	private HashSet<Transform> oldChildren = new HashSet<Transform>();

	private List<Transform> newChildren = new List<Transform>();

	public static event Action<GameObject> onNewGameObject;

	public static void ExecuteOnNewGameObject(GameObject go)
	{
		ExecuteOnTreeChange.onNewGameObject?.Invoke(go);
		if (!Object.op_Implicit((Object)(object)go.GetComponent<ExecuteOnTreeChange>()))
		{
			ExecuteOnTreeChange executeOnTreeChange = go.AddComponent<ExecuteOnTreeChange>();
			executeOnTreeChange.OnTransformChildrenChanged();
		}
	}

	private void OnEnable()
	{
		OnTransformChildrenChanged();
	}

	private void OnTransformChildrenChanged()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		newChildren.Clear();
		foreach (Transform item in ((Component)this).transform)
		{
			Transform val = item;
			newChildren.Add(val);
			if (!oldChildren.Contains(val))
			{
				ExecuteOnNewGameObject(((Component)val).gameObject);
			}
		}
		oldChildren = new HashSet<Transform>(newChildren);
	}
}
[BepInPlugin("dev.galvin.timestopper", "The Timestopper", "1.6.6")]
public class Timestopper : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Action <>9__101_0;

		public static Action <>9__101_1;

		public static Func<string, bool> <>9__103_0;

		public static Func<string, bool> <>9__103_1;

		public static Func<string, bool> <>9__103_2;

		public static BoolValueChangeEventDelegate <>9__104_1;

		public static FloatValueChangeEventDelegate <>9__104_2;

		public static FloatValueChangeEventDelegate <>9__104_3;

		public static FloatValueChangeEventDelegate <>9__104_4;

		public static FloatValueChangeEventDelegate <>9__104_5;

		public static FloatValueChangeEventDelegate <>9__104_6;

		public static FloatValueChangeEventDelegate <>9__104_7;

		public static FloatValueChangeEventDelegate <>9__104_8;

		public static ColorValueChangeEventDelegate <>9__104_9;

		public static FloatValueChangeEventDelegate <>9__104_10;

		public static OnClick <>9__104_12;

		public static IntValueChangeEventDelegate <>9__104_13;

		public static Func<string, bool> <>9__107_0;

		public static Func<string, bool> <>9__107_1;

		public static Func<string, bool> <>9__107_2;

		public static Action <>9__109_0;

		public static Action <>9__109_1;

		public static Func<bool> <>9__114_0;

		internal void <OnSceneLoaded>b__101_0()
		{
			HudMessageReceiver instance = MonoSingleton<HudMessageReceiver>.Instance;
			if (instance != null)
			{
				((MonoBehaviour)instance).Invoke("Done", 0f);
			}
			firstLoad = false;
		}

		internal void <OnSceneLoaded>b__101_1()
		{
			HudMessageReceiver instance = MonoSingleton<HudMessageReceiver>.Instance;
			if (instance != null)
			{
				((MonoBehaviour)instance).Invoke("Done", 0f);
			}
			firstLoad = false;
		}

		internal bool <ReloadSoundProfilesList>b__103_0(string file)
		{
			return file.EndsWith(".wav") || file.EndsWith(".ogg");
		}

		internal bool <ReloadSoundProfilesList>b__103_1(string file)
		{
			return file.EndsWith(".wav") || file.EndsWith(".ogg");
		}

		internal bool <ReloadSoundProfilesList>b__103_2(string file)
		{
			return file.EndsWith(".wav") || file.EndsWith(".ogg");
		}

		internal void <InitializeConfig>b__104_1(BoolValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_2(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_3(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_4(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_5(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_6(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_7(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_8(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_9(ColorValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_10(FloatValueChangeEvent e)
		{
			Grayscaler.UpdateShaderSettings();
		}

		internal void <InitializeConfig>b__104_12()
		{
			Application.OpenURL(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds"));
		}

		internal void <InitializeConfig>b__104_13(IntValueChangeEvent e)
		{
			if (e.value < 1)
			{
				e.value = 1;
				maxUpgrades.value = 1;
			}
		}

		internal bool <LoadSoundProfiles>b__107_0(string file)
		{
			return file.EndsWith(".wav") || file.EndsWith(".ogg");
		}

		internal bool <LoadSoundProfiles>b__107_1(string file)
		{
			return file.EndsWith(".wav") || file.EndsWith(".ogg");
		}

		internal bool <LoadSoundProfiles>b__107_2(string file)
		{
			return file.EndsWith(".wav") || file.EndsWith(".ogg");
		}

		internal void <UpdateTerminal>b__109_0()
		{
			Log("this is good", extensive: false, 2);
		}

		internal void <UpdateTerminal>b__109_1()
		{
			Log("this is good", extensive: false, 3);
		}

		internal bool <InstantiateMenuItems>b__114_0()
		{
			return LoadDone;
		}
	}

	public const string GUID = "dev.galvin.timestopper";

	public const string Name = "The Timestopper";

	public const string Version = "1.6.6";

	public const string SubVersion = "0";

	private readonly Harmony harmony = new Harmony("dev.galvin.timestopper");

	public static Timestopper Instance;

	public static ManualLogSource mls = Logger.CreateLogSource("The Timestopper");

	public const string ARM_PICKUP_MESSAGE = "<color=#FFFF23>TIMESTOPPER</color>: Use \"<color=#FF4223>{0}</color>\" to stop and start time at will.";

	public const string ARM_DESCRIPTION = "A Godfist that <color=#FFFF43>stops</color> time.\r\n\r\nRecharges very slow, but <color=#FF4343>parrying</color> helps it recharge faster.\r\n\r\nCan be <color=#FFFF24>upgraded</color> through terminals.\r\n";

	public const string ARM_NEW_MESSAGE = "Somewhere in the depths of <color=#FF0000>Violence /// First</color>, a new <color=#FFFF23>golden</color> door appears";

	public const string TIMESTOP_STYLE = "<color=#FFCF21>TIME STOP</color>";

	public static Shader grayscaleShader;

	public static Shader depthShader;

	public static AudioClip[] TimestopSounds;

	public static AudioClip[] StoppedTimeAmbiences;

	public static AudioClip[] TimestartSounds;

	public static Texture2D armGoldLogo;

	public static Texture2D modLogo;

	public static GameObject armTimeText;

	public static GameObject Dummy;

	public static GameObject LatestTerminal;

	public static GameObject TheCube;

	public static GameObject MenuCanvas;

	public static bool TimeStop;

	public static float StoppedTimeAmount;

	public static bool LoadDone;

	public static float realTimeScale = 1f;

	public static bool fixedCall;

	public static bool firstLoad = true;

	public static bool cybergrind;

	public static int cybergrindWave;

	public static bool UnscaleTimeSince;

	public static PrivateInsideTimer messageTimer = new PrivateInsideTimer();

	private GameObject currentLevelInfo;

	private TimeSince timeSinceLastTimestop = TimeSince.op_Implicit(0f);

	private IEnumerator timeStopper;

	private IEnumerator timeStarter;

	public static bool Compatability_JukeBox;

	public static BoolField alterMainMenu;

	public static BoolField aprilFools;

	public static KeyCodeField stopKey;

	public static StringListField stopSound;

	public static StringListField stoppedSound;

	public static StringListField startSound;

	public static ButtonField soundFileButton;

	public static ButtonField soundReloadButton;

	public static FloatField stopSpeed;

	public static FloatField startSpeed;

	public static FloatField affectSpeed;

	public static FloatField animationSpeed;

	public static FloatSliderField soundEffectVolume;

	public static BoolField filterMusic;

	public static FloatSliderField stoppedMusicPitch;

	public static FloatSliderField stoppedMusicVolume;

	public static BoolField grayscale;

	public static BoolField bubbleEffect;

	public static FloatField overallEffectIntensity;

	public static FloatField grayscaleIntensity;

	public static FloatField bubbleSmoothness;

	public static FloatField colorInversionArea;

	public static FloatField skyTransitionTreshold;

	public static FloatField bubbleDistance;

	public static FloatField bubbleProgression;

	public static ColorField grayscaleColorSpace;

	public static FloatField grayscaleColorSpaceIntensity;

	public static BoolField timestopHardDamage;

	public static IntField maxUpgrades;

	public static BoolField forceDowngrade;

	public static BoolField specialMode;

	public static BoolField extensiveLogging;

	public static FloatField lowerTreshold;

	public static FloatField refillMultiplier;

	public static FloatField bonusTimeForParry;

	public static FloatField antiHpMultiplier;

	public static ButtonField resetSaveButton;

	public static ButtonField giveArmButton;

	public static ColorField timeJuiceColorNormal;

	public static ColorField timeJuiceColorInsufficient;

	public static ColorField timeJuiceColorUsing;

	public static ColorField timeJuiceColorNoCooldown;

	private PluginConfigurator config;

	public static Sprite[] aprilFoolsPFPList = (Sprite[])(object)new Sprite[0];

	public static GameObject rickrollObject;

	public static string rickrollPath;

	public static GameObject newTimeArm;

	public static GameObject newArmAltar;

	public static readonly HashSet<string> forbiddenSceneList = new HashSet<string> { "b3e7f2f8052488a45b35549efb98d902", "Bootstrap", "241a6a8caec7a13438a5ee786040de32", "4c18368dae54f154da2ae65baf0e630e", "d8e7c3bbb0c2f3940aa7c51dc5849781" };

	public static bool frameLaterer;

	private bool menuOpenLastFrame;

	private float time;

	private static Type portalManagerV2Type = AccessTools.TypeByName("PortalManagerV2");

	private static Type simplePortalTravelerType = AccessTools.TypeByName("SimplePortalTraveler");

	private FieldInfo travellersField = AccessTools.Field(portalManagerV2Type, "travellers");

	private MethodInfo cacheTravelerValues = AccessTools.Method(simplePortalTravelerType, "CacheTravelerValues", (Type[])null, (Type[])null);

	public static bool isInForbiddenScene;

	public static GameObject Player
	{
		get
		{
			if ((Object)(object)MonoSingleton<NewMovement>.Instance == (Object)null)
			{
				return null;
			}
			return ((Component)MonoSingleton<NewMovement>.Instance).gameObject;
		}
	}

	[DefaultValue(1f)]
	public static float playerTimeScale { get; private set; }

	public static float playerDeltaTime
	{
		get
		{
			if (fixedCall)
			{
				return Time.fixedDeltaTime;
			}
			if (TimeStop)
			{
				return Time.unscaledDeltaTime * playerTimeScale;
			}
			return Time.deltaTime;
		}
	}

	public static float playerFixedDeltaTime
	{
		get
		{
			if (fixedCall)
			{
				return Time.fixedDeltaTime;
			}
			if (TimeStop)
			{
				return Time.fixedDeltaTime * playerTimeScale;
			}
			return Time.fixedDeltaTime;
		}
	}

	public static bool isAprilFools => aprilFools.value || (DateTime.Today.Month == 4 && DateTime.Today.Day == 1);

	public static void Log(string log, bool extensive = false, int err_lvl = 0)
	{
		if (!(extensiveLogging != null && !extensiveLogging.value && extensive))
		{
			switch (err_lvl)
			{
			case 0:
			case 1:
				mls.LogInfo((object)log);
				break;
			case 2:
				mls.LogWarning((object)log);
				break;
			case 3:
				mls.LogError((object)log);
				break;
			case 4:
				mls.LogFatal((object)log);
				break;
			default:
				mls.LogInfo((object)log);
				break;
			}
		}
	}

	public static void FixedUpdateFix(Transform target)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		if ((Object)(object)((Component)target).GetComponent(typeof(MonoBehaviour)) != (Object)null && (Object)(object)((Component)target).GetComponent<FixedUpdateCaller>() == (Object)null)
		{
			((Component)target).gameObject.AddComponent<FixedUpdateCaller>();
		}
		foreach (Transform item in target)
		{
			Transform val = item;
			if ((Object)(object)((Component)val).GetComponent(typeof(MonoBehaviour)) != (Object)null && (Object)(object)((Component)val).GetComponent<FixedUpdateCaller>() == (Object)null)
			{
				((Component)val).gameObject.AddComponent<FixedUpdateCaller>();
			}
			FixedUpdateFix(val);
		}
	}

	private void Awake()
	{
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Expected O, but got Unknown
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		Log("The Timestopper has awakened!");
		try
		{
			bool flag = (Object)(object)MonoSingleton<PortalManagerV2>.Instance == (Object)null;
		}
		catch
		{
			mls.LogFatal((object)"ULTRAKILL source code does not define PortalManagerV2, make sure you are running the Timestopper mod with the appropriate version of the game!");
			mls.LogFatal((object)"Otherwise expect lots of bugs");
		}
		InitializeConfig();
		playerTimeScale = 1f;
		harmony.PatchAll();
		Type typeFromHandle = typeof(CameraController);
		MethodInfo method = typeFromHandle.GetMethod("LateUpdate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (method == null)
		{
			method = typeFromHandle.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (method == null)
			{
				mls.LogFatal((object)"ULTRAKILL source code does not define an Update nor LateUpdate method for CameraController, are you sure this is the right version for the game!?");
			}
			else
			{
				mls.LogFatal((object)"CameraController defines an Update method instead of LateUpdate, are you sure you are running the latest version of ULTRAKILL?");
			}
		}
		else
		{
			MethodInfo method2 = typeof(TranspileCameraController).GetMethod("Transpiler", BindingFlags.Static | BindingFlags.NonPublic);
			harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null);
		}
		TheCube = GameObject.CreatePrimitive((PrimitiveType)3);
		((Object)TheCube).name = "The Cube";
		SceneManager.sceneLoaded += OnSceneLoaded;
		SceneManager.sceneUnloaded += OnSceneUnloaded;
		ExecuteOnTreeChange.onNewGameObject += OnNewGameObject;
	}

	private static void OnNewGameObject(GameObject go)
	{
		if ((Object)(object)go == (Object)(object)Player || go.transform.IsChildOf(Player.transform))
		{
			if (((Object)go).name == "Main Camera" && TimestopperProgress.HasArm)
			{
				Grayscaler.UpdateShaderSettings();
			}
			return;
		}
		if (Object.op_Implicit((Object)(object)go.GetComponent<Rigidbody>()) && !Object.op_Implicit((Object)(object)go.GetComponent<RigidbodyStopper>()))
		{
			go.AddComponent<RigidbodyStopper>();
		}
		if (Object.op_Implicit((Object)(object)go.GetComponent<AudioSource>()) && !Object.op_Implicit((Object)(object)go.GetComponent<AudioPitcher>()))
		{
			go.AddComponent<AudioPitcher>();
		}
		FakeFallZone component = go.GetComponent<FakeFallZone>();
		if (Object.op_Implicit((Object)(object)component))
		{
			FixedUpdateCaller fixedUpdateCaller = go.AddComponent<FixedUpdateCaller>();
			fixedUpdateCaller.targets = (Component[])(object)new Component[1] { (Component)component };
		}
	}

	public static void LoadHUDIfAppropriate()
	{
		if (TimestopperProgress.HasArm && TimestopperProgress.EquippedArm)
		{
			((MonoBehaviour)Instance).StartCoroutine(Instance.LoadHUD());
		}
	}

	public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0396: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_03de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0447: Unknown result type (might be due to invalid IL or missing references)
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_051e: Unknown result type (might be due to invalid IL or missing references)
		HashSet<string> hashSet = forbiddenSceneList;
		Scene activeScene = SceneManager.GetActiveScene();
		isInForbiddenScene = hashSet.Contains(((Scene)(ref activeScene)).name);
		if (((Scene)(ref scene)).name == "b3e7f2f8052488a45b35549efb98d902")
		{
			mls.LogWarning((object)"main menu loaded");
			if ((Object)(object)armTimeText == (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(LoadBundle());
			}
			if (alterMainMenu.value)
			{
				((MonoBehaviour)this).StartCoroutine(InstantiateMenuItems());
			}
		}
		if (!isInForbiddenScene)
		{
			SceneTreeChangeWatcher.StartWatchingSceneForTreeChanges();
			InvokeCaller.ClearMonos();
			InvokeCaller.RegisterMethods(typeof(Coin), new string[2] { "StartCheckingSpeed", "TripleTime" });
			InvokeCaller.RegisterType(typeof(ScaleNFade));
			Playerstopper.Instance.AddInvokeCallers(((Component)Playerstopper.Instance).transform);
			if (forceDowngrade.value)
			{
				TimestopperProgress.ForceDowngradeArm();
			}
			if (TimestopperProgress.HasArm && TimestopperProgress.EquippedArm)
			{
				((MonoBehaviour)this).StartCoroutine(LoadHUD());
			}
			StatsManager.checkpointRestart += ResetGoldArm;
			if (firstLoad && !TimestopperProgress.HasArm)
			{
				HudMessageReceiver instance = MonoSingleton<HudMessageReceiver>.Instance;
				if (instance != null)
				{
					instance.SendHudMessage("Somewhere in the depths of <color=#FF0000>Violence /// First</color>, a new <color=#FFFF23>golden</color> door appears", "", "", 2, false, false, true);
				}
				PrivateInsideTimer privateInsideTimer = messageTimer;
				privateInsideTimer.done = (Action)Delegate.Combine(privateInsideTimer.done, (Action)delegate
				{
					HudMessageReceiver instance5 = MonoSingleton<HudMessageReceiver>.Instance;
					if (instance5 != null)
					{
						((MonoBehaviour)instance5).Invoke("Done", 0f);
					}
					firstLoad = false;
				});
				messageTimer.SetTimer(6f, _scaled: true);
			}
			if (isAprilFools)
			{
				HudMessageReceiver instance2 = MonoSingleton<HudMessageReceiver>.Instance;
				if (instance2 != null)
				{
					instance2.SendHudMessage("Meet me at the terminal.", "", "", 2, false, false, true);
				}
				PrivateInsideTimer privateInsideTimer2 = messageTimer;
				privateInsideTimer2.done = (Action)Delegate.Combine(privateInsideTimer2.done, (Action)delegate
				{
					HudMessageReceiver instance4 = MonoSingleton<HudMessageReceiver>.Instance;
					if (instance4 != null)
					{
						((MonoBehaviour)instance4).Invoke("Done", 0f);
					}
					firstLoad = false;
				});
				messageTimer.SetTimer(6f, _scaled: true);
			}
			FishObjectReference[] array = Object.FindObjectsOfType<FishObjectReference>(true);
			foreach (FishObjectReference val in array)
			{
				if (((Object)((Component)val).gameObject).name == "GoldArmPickup")
				{
					((Component)val).gameObject.AddComponent<TimeArmPickup>();
				}
			}
			StyleHUD instance3 = MonoSingleton<StyleHUD>.Instance;
			if (instance3 != null)
			{
				instance3.RegisterStyleItem("timestopper.timestop", "<color=#FFCF21>TIME STOP</color>");
			}
		}
		else
		{
			timeStopper = CStopTime(0f);
			timeStarter = CStartTime(0f);
		}
		if (ConfirmLevel("VIOLENCE /// FIRST"))
		{
			Log("7-1 level detected", extensive: true);
			GameObject val2 = Object.Instantiate<GameObject>(GameObject.Find("Crossroads -> Forward Hall"), GameObject.Find("Stairway Down").transform);
			((Object)val2).name = "Stairway Down -> Gold Arm Hall";
			val2.transform.position = new Vector3(-14.6292f, -25.0312f, 590.2311f);
			val2.transform.eulerAngles = new Vector3(0f, 270f, 0f);
			((Renderer)((Component)val2.transform.GetChild(0)).GetComponent<MeshRenderer>()).materials[1].color = Color.yellow;
			((Renderer)((Component)val2.transform.GetChild(0)).GetComponent<MeshRenderer>()).materials[2].color = Color.yellow;
			((Renderer)((Component)val2.transform.GetChild(1)).GetComponent<MeshRenderer>()).materials[1].color = Color.yellow;
			((Renderer)((Component)val2.transform.GetChild(1)).GetComponent<MeshRenderer>()).materials[2].color = Color.yellow;
			val2.GetComponent<Door>().Close(false);
			val2.GetComponent<Door>().Lock();
			val2.GetComponent<Door>().activatedRooms = (GameObject[])(object)new GameObject[0];
			GameObject val3 = Object.Instantiate<GameObject>(newArmAltar, GameObject.Find("Stairway Down").transform);
			val3.transform.position = new Vector3(-10.0146f, -24.9875f, 590.0158f);
			val3.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			Log("Added The New Arm Altar", extensive: true);
		}
		if (((Scene)(ref scene)).name == "9240e656c89994d44b21940f65ab57da")
		{
			cybergrind = true;
			if (!Chainloader.PluginInfos.ContainsKey("dev.flazhik.jukebox"))
			{
				return;
			}
			Compatability_JukeBox = true;
			Type type = Type.GetType("Jukebox.Components.NowPlayingHud, Jukebox");
			if (type != null)
			{
				Object obj = Object.FindObjectOfType(type);
				Component val4 = (Component)(object)((obj is Component) ? obj : null);
				if ((Object)(object)val4 != (Object)null)
				{
					Transform transform = val4.gameObject.transform;
					transform.localPosition += new Vector3(0f, 60f, 0f);
				}
				else
				{
					Log("Component C is null!", extensive: true, 3);
				}
			}
			else
			{
				Log("Could not get Jukebox.Components.NowPlayingHud, Cybergrind Music Explorer may have errors", extensive: true, 3);
			}
		}
		else
		{
			cybergrind = false;
			Compatability_JukeBox = false;
		}
	}

	public void ReloadStringListField(StringListField slf, IEnumerable<string> values)
	{
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		FieldInfo field = typeof(StringListField).GetField("values", BindingFlags.Instance | BindingFlags.NonPublic);
		FieldInfo field2 = typeof(StringListField).GetField("currentUi", BindingFlags.Instance | BindingFlags.NonPublic);
		string[] source = (values as string[]) ?? values.ToArray();
		field?.SetValue(slf, source.ToList());
		if (!source.ToArray().Contains(slf.defaultValue))
		{
			slf.defaultValue = source.ToList()[0];
		}
		if (field2 != null && field2.GetValue(slf) != null)
		{
			((ConfigDropdownField)field2.GetValue(slf)).dropdown.options.Clear();
			string[] array = source.ToArray();
			foreach (string text in array)
			{
				((ConfigDropdownField)field2.GetValue(slf)).dropdown.options.Add(new OptionData(text));
			}
		}
		typeof(ConfigPanel).GetMethod("ProtectedInternalMethod", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)?.Invoke(((ConfigField)slf).parentPanel, null);
	}

	public void ReloadSoundProfilesList()
	{
		//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ae: Expected O, but got Unknown
		//IL_060a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0614: Expected O, but got Unknown
		//IL_0671: Unknown result type (might be due to invalid IL or missing references)
		//IL_067b: Expected O, but got Unknown
		bool flag = false;
		string[] array = new string[3] { "Stopping", "Stopped", "Starting" };
		if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds")))
		{
			string[] array2 = array;
			foreach (string path in array2)
			{
				if (!Directory.Exists(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", path)) || Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", path), "*.*").Length == 0)
				{
					flag = true;
					break;
				}
			}
		}
		else
		{
			flag = true;
		}
		if (flag)
		{
			string text = "";
			Log("searching modpath ", extensive: false, 3);
			Log("found mod files: " + Directory.GetDirectories(Paths.PluginPath).Length, extensive: false, 3);
			string[] directories = Directory.GetDirectories(Paths.PluginPath);
			foreach (string text2 in directories)
			{
				if (File.Exists(Path.Combine(text2, "The Timestopper.dll")))
				{
					Log("FOUND TIMESTOPPER: " + text2, extensive: false, 2);
					text = text2;
					break;
				}
			}
			Directory.CreateDirectory(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds"));
			string[] array3 = array;
			foreach (string sounddirectory in array3)
			{
				Directory.CreateDirectory(Path.Combine(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", sounddirectory)));
				foreach (string item in from filename in Directory.GetFiles(text, "*.*").Select(Path.GetFileName)
					where filename.EndsWith(".ogg") && filename.StartsWith(sounddirectory)
					select filename)
				{
					Log("copying over sound file: " + sounddirectory + "/" + item, extensive: false, 1);
					if (!File.Exists(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", sounddirectory, item)))
					{
						File.Copy(Path.Combine(text, sounddirectory + "-" + item.TrimStart((sounddirectory + "-").ToCharArray())), Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", sounddirectory, item.TrimStart((sounddirectory + "-").ToCharArray())));
					}
				}
			}
			if (!File.Exists(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "README.txt")))
			{
				File.Copy(Path.Combine(text, "Sounds-readme.txt"), Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "README.txt"));
			}
		}
		string[] array4 = (from file in Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "Stopping"), "*.*")
			where file.EndsWith(".wav") || file.EndsWith(".ogg")
			select file).Select(Path.GetFileNameWithoutExtension).ToArray();
		string[] array5 = (from file in Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "Stopped"), "*.*")
			where file.EndsWith(".wav") || file.EndsWith(".ogg")
			select file).Select(Path.GetFileNameWithoutExtension).ToArray();
		string[] array6 = (from file in Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "Starting"), "*.*")
			where file.EndsWith(".wav") || file.EndsWith(".ogg")
			select file).Select(Path.GetFileNameWithoutExtension).ToArray();
		if (array4.Length < 1)
		{
			Log("No time stop sounds found!", extensive: false, 3);
			array4 = new string[1] { "FILE ERROR" };
		}
		if (array5.Length < 1)
		{
			Log("No time stop sounds found!", extensive: false, 3);
			array5 = new string[1] { "FILE ERROR" };
		}
		if (array6.Length < 1)
		{
			Log("No time stop sounds found!", extensive: false, 3);
			array6 = new string[1] { "FILE ERROR" };
		}
		string text3 = "Classic";
		string text4 = "Classic";
		string text5 = "Classic";
		if (!array4.Contains(text3))
		{
			text3 = array4[0];
		}
		if (!array5.Contains(text4))
		{
			text4 = array5[0];
		}
		if (!array6.Contains(text5))
		{
			text5 = array6[0];
		}
		if (stopSound == null)
		{
			stopSound = new StringListField(config.rootPanel, "Timestop Sound", "timestopprofile", array4, text3);
		}
		else
		{
			ReloadStringListField(stopSound, array4);
		}
		if (!array4.Contains(stopSound.value))
		{
			stopSound.value = array4[0];
		}
		if (stoppedSound == null)
		{
			stoppedSound = new StringListField(config.rootPanel, "Stopped Time Ambience", "ambienceprofile", array5, text4);
		}
		else
		{
			ReloadStringListField(stoppedSound, array5);
		}
		if (!array5.Contains(stoppedSound.value))
		{
			stoppedSound.value = array5[0];
		}
		if (startSound == null)
		{
			startSound = new StringListField(config.rootPanel, "Timestart Sound", "timestartprofile", array6, text5);
		}
		else
		{
			ReloadStringListField(startSound, array6);
		}
		if (!array6.Contains(startSound.value))
		{
			startSound.value = array6[0];
		}
	}

	private void InitializeConfig()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_007b: Expected O, but got Unknown
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Expected O, but got Unknown
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Expected O, but got Unknown
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Expected O, but got Unknown
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Expected O, but got Unknown
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Expected O, but got Unknown
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Expected O, but got Unknown
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Expected O, but got Unknown
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Expected O, but got Unknown
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Expected O, but got Unknown
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Expected O, but got Unknown
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Expected O, but got Unknown
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Expected O, but got Unknown
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Expected O, but got Unknown
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Expected O, but got Unknown
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Expected O, but got Unknown
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Expected O, but got Unknown
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Expected O, but got Unknown
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Expected O, but got Unknown
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Expected O, but got Unknown
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Expected O, but got Unknown
		//IL_033b: 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_0346: Expected O, but got Unknown
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0370: Expected O, but got Unknown
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Expected O, but got Unknown
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Expected O, but got Unknown
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Expected O, but got Unknown
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		//IL_0418: Expected O, but got Unknown
		//IL_0437: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Expected O, but got Unknown
		//IL_0461: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Expected O, but got Unknown
		//IL_048b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0490: Unknown result type (might be due to invalid IL or missing references)
		//IL_0496: Expected O, but got Unknown
		//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_051d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0527: Expected O, but got Unknown
		//IL_0550: Unknown result type (might be due to invalid IL or missing references)
		//IL_055a: Expected O, but got Unknown
		//IL_0583: Unknown result type (might be due to invalid IL or missing references)
		//IL_058d: Expected O, but got Unknown
		//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ad: Expected O, but got Unknown
		//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d3: Expected O, but got Unknown
		//IL_05df: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e9: Expected O, but got Unknown
		//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0609: Expected O, but got Unknown
		//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c0: Expected O, but got Unknown
		//IL_0643: Unknown result type (might be due to invalid IL or missing references)
		//IL_065b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0678: Unknown result type (might be due to invalid IL or missing references)
		//IL_067d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0689: Expected O, but got Unknown
		//IL_0622: Unknown result type (might be due to invalid IL or missing references)
		//IL_0627: Unknown result type (might be due to invalid IL or missing references)
		//IL_062d: Expected O, but got Unknown
		//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d7: Expected O, but got Unknown
		//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fb: Expected O, but got Unknown
		//IL_0711: Unknown result type (might be due to invalid IL or missing references)
		//IL_0716: Unknown result type (might be due to invalid IL or missing references)
		//IL_071e: Unknown result type (might be due to invalid IL or missing references)
		//IL_072b: Expected O, but got Unknown
		//IL_073b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0753: Unknown result type (might be due to invalid IL or missing references)
		//IL_0782: Unknown result type (might be due to invalid IL or missing references)
		//IL_0787: Unknown result type (might be due to invalid IL or missing references)
		//IL_0791: Expected O, but got Unknown
		//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c9: Expected O, but got Unknown
		//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0801: Expected O, but got Unknown
		//IL_082a: Unknown result type (might be due to invalid IL or missing references)
		//IL_082f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0839: Expected O, but got Unknown
		//IL_0849: Unknown result type (might be due to invalid IL or missing references)
		//IL_0861: Unknown result type (might be due to invalid IL or missing references)
		//IL_087c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0882: Expected O, but got Unknown
		//IL_0892: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ae: Expected O, but got Unknown
		//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c4: Expected O, but got Unknown
		//IL_08d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_08de: Expected O, but got Unknown
		//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f8: Expected O, but got Unknown
		//IL_090d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0917: Expected O, but got Unknown
		//IL_0923: Unknown result type (might be due to invalid IL or missing references)
		//IL_092d: Expected O, but got Unknown
		//IL_0943: Unknown result type (might be due to invalid IL or missing references)
		//IL_094d: Expected O, but got Unknown
		//IL_0959: Unknown result type (might be due to invalid IL or missing references)
		//IL_0963: Expected O, but got Unknown
		//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ad: Expected O, but got Unknown
		if (config != null)
		{
			return;
		}
		config = PluginConfigurator.Create("The Timestopper", "dev.galvin.timestopper");
		new ConfigSpace(config.rootPanel, 6f);
		new ConfigHeader(config.rootPanel, "-- GENERAL --", 24);
		alterMainMenu = new BoolField(config.rootPanel, "Alter Main Menu", "altermainmenu", true);
		stopKey = new KeyCodeField(config.rootPanel, "Timestopper Key", "stopkey", (KeyCode)118);
		timestopHardDamage = new BoolField(config.rootPanel, "Timestop Hard Damage", "harddamage", true);
		stopSpeed = new FloatField(config.rootPanel, "Timestop Speed", "stopspeed", 0.6f);
		startSpeed = new FloatField(config.rootPanel, "Timestart Speed", "startspeed", 0.8f);
		affectSpeed = new FloatField(config.rootPanel, "Interaction Speed", "interactionspeed", 1f);
		animationSpeed = new FloatField(config.rootPanel, "Animation Speed", "animationspeed", 1.3f);
		aprilFools = new BoolField(config.rootPanel, "Enable April Fools Mode", "aprilfools", false);
		new ConfigSpace(config.rootPanel, 4f);
		new ConfigHeader(config.rootPanel, "-- GRAPHICS --", 24);
		grayscale = new BoolField(config.rootPanel, "Do Shader Effects", "doGrayscale", false);
		ConfigDivision grayscaleOptions = new ConfigDivision(config.rootPanel, "grayscaleOptions")
		{
			interactable = grayscale.value
		};
		grayscale.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
		{
			((ConfigField)grayscaleOptions).interactable = e.value;
			Grayscaler.UpdateShaderSettings();
		};
		ConfigPanel val = new ConfigPanel((ConfigPanel)(object)grayscaleOptions, "SHADER OPTIONS", "shaderoptions");
		bubbleEffect = new BoolField(val, "Expanding Bubble Effect", "bubbleeffect", true);
		overallEffectIntensity = new FloatField(val, "Overall Intensity", "overalleffectintensity", 1f);
		grayscaleIntensity = new FloatField(val, "Grayscale Intensity", "grayscaleintensity", 1f);
		bubbleSmoothness = new FloatField(val, "Bubble Border Smoothness", "bubblesmoothness", 0.1f);
		colorInversionArea = new FloatField(val, "Inverted Border Thickness", "colorinversionarea", 0.01f);
		skyTransitionTreshold = new FloatField(val, "Sky Transition Treshold", "skytransitiontreshold", 10f);
		bubbleDistance = new FloatField(val, "Bubble Expansion rate", "bubbledistance", 20f);
		bubbleProgression = new FloatField(val, "Inverse Color Intensity", "bubbleprogression", 1f);
		grayscaleColorSpace = new ColorField(val, "Grayscale Color Space", "grayscalecolorspace", new Color(0.299f, 0.587f, 0.114f));
		grayscaleColorSpaceIntensity = new FloatField(val, "Grayscale Color Space Multiplier", "grayscalecolorspaceintensity", 1f);
		BoolField obj = bubbleEffect;
		object obj2 = <>c.<>9__104_1;
		if (obj2 == null)
		{
			BoolValueChangeEventDelegate val2 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_1 = val2;
			obj2 = (object)val2;
		}
		obj.onValueChange += (BoolValueChangeEventDelegate)obj2;
		FloatField obj3 = overallEffectIntensity;
		object obj4 = <>c.<>9__104_2;
		if (obj4 == null)
		{
			FloatValueChangeEventDelegate val3 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_2 = val3;
			obj4 = (object)val3;
		}
		obj3.onValueChange += (FloatValueChangeEventDelegate)obj4;
		FloatField obj5 = grayscaleIntensity;
		object obj6 = <>c.<>9__104_3;
		if (obj6 == null)
		{
			FloatValueChangeEventDelegate val4 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_3 = val4;
			obj6 = (object)val4;
		}
		obj5.onValueChange += (FloatValueChangeEventDelegate)obj6;
		FloatField obj7 = bubbleSmoothness;
		object obj8 = <>c.<>9__104_4;
		if (obj8 == null)
		{
			FloatValueChangeEventDelegate val5 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_4 = val5;
			obj8 = (object)val5;
		}
		obj7.onValueChange += (FloatValueChangeEventDelegate)obj8;
		FloatField obj9 = colorInversionArea;
		object obj10 = <>c.<>9__104_5;
		if (obj10 == null)
		{
			FloatValueChangeEventDelegate val6 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_5 = val6;
			obj10 = (object)val6;
		}
		obj9.onValueChange += (FloatValueChangeEventDelegate)obj10;
		FloatField obj11 = skyTransitionTreshold;
		object obj12 = <>c.<>9__104_6;
		if (obj12 == null)
		{
			FloatValueChangeEventDelegate val7 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_6 = val7;
			obj12 = (object)val7;
		}
		obj11.onValueChange += (FloatValueChangeEventDelegate)obj12;
		FloatField obj13 = bubbleDistance;
		object obj14 = <>c.<>9__104_7;
		if (obj14 == null)
		{
			FloatValueChangeEventDelegate val8 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_7 = val8;
			obj14 = (object)val8;
		}
		obj13.onValueChange += (FloatValueChangeEventDelegate)obj14;
		FloatField obj15 = bubbleProgression;
		object obj16 = <>c.<>9__104_8;
		if (obj16 == null)
		{
			FloatValueChangeEventDelegate val9 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_8 = val9;
			obj16 = (object)val9;
		}
		obj15.onValueChange += (FloatValueChangeEventDelegate)obj16;
		ColorField obj17 = grayscaleColorSpace;
		object obj18 = <>c.<>9__104_9;
		if (obj18 == null)
		{
			ColorValueChangeEventDelegate val10 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_9 = val10;
			obj18 = (object)val10;
		}
		obj17.onValueChange += (ColorValueChangeEventDelegate)obj18;
		FloatField obj19 = grayscaleColorSpaceIntensity;
		object obj20 = <>c.<>9__104_10;
		if (obj20 == null)
		{
			FloatValueChangeEventDelegate val11 = delegate
			{
				Grayscaler.UpdateShaderSettings();
			};
			<>c.<>9__104_10 = val11;
			obj20 = (object)val11;
		}
		obj19.onValueChange += (FloatValueChangeEventDelegate)obj20;
		new ConfigSpace(config.rootPanel, 4f);
		new ConfigHeader(config.rootPanel, "-- AUDIO --", 24);
		soundEffectVolume = new FloatSliderField(config.rootPanel, "Sound Effects Volume", "effectvolume", new Tuple<float, float>(0f, 2f), 1f);
		stoppedMusicPitch = new FloatSliderField(config.rootPanel, "Music Pitch in Stopped Time", "musicpitch", new Tuple<float, float>(0f, 1f), 0.6f);
		stoppedMusicVolume = new FloatSliderField(config.rootPanel, "Music volume in Stopped Time", "musicvolume", new Tuple<float, float>(0f, 1f), 0.8f);
		filterMusic = new BoolField(config.rootPanel, "Filter Music in Stopped Time", "filtermusic", false);
		ReloadSoundProfilesList();
		soundReloadButton = new ButtonField(config.rootPanel, "Reload Sound Profiles", "soundprofilebutton");
		soundReloadButton.onClick += (OnClick)delegate
		{
			((MonoBehaviour)this).StartCoroutine(LoadSoundProfiles());
		};
		soundFileButton = new ButtonField(config.rootPanel, "Open Sound Profile Folder", "soundprofilebutton");
		ButtonField obj21 = soundFileButton;
		object obj22 = <>c.<>9__104_12;
		if (obj22 == null)
		{
			OnClick val12 = delegate
			{
				Application.OpenURL(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds"));
			};
			<>c.<>9__104_12 = val12;
			obj22 = (object)val12;
		}
		obj21.onClick += (OnClick)obj22;
		new ConfigSpace(config.rootPanel, 4f);
		new ConfigHeader(config.rootPanel, "-- GAMEPLAY --", 24);
		maxUpgrades = new IntField(config.rootPanel, "Maximum Number of Upgrades", "maxupgrades", 10)
		{
			minimumValue = 1
		};
		IntField obj23 = maxUpgrades;
		object obj24 = <>c.<>9__104_13;
		if (obj24 == null)
		{
			IntValueChangeEventDelegate val13 = delegate(IntValueChangeEvent e)
			{
				if (e.value < 1)
				{
					e.value = 1;
					maxUpgrades.value = 1;
				}
			};
			<>c.<>9__104_13 = val13;
			obj24 = (object)val13;
		}
		obj23.onValueChange += (IntValueChangeEventDelegate)obj24;
		refillMultiplier = new FloatField(config.rootPanel, "Passive Income Multiplier", "refillmultiplier", 0.1f);
		bonusTimeForParry = new FloatField(config.rootPanel, "Time Juice Refill Per Parry", "bonustimeperparry", 1f);
		specialMode = new BoolField(config.rootPanel, "Special Mode", "specialmode", false)
		{
			interactable = false,
			value = false
		};
		new ConfigSpace(config.rootPanel, 4f);
		new ConfigHeader(config.rootPanel, "-- COLORS --", 24);
		timeJuiceColorNormal = new ColorField(config.rootPanel, "Time Juice Bar Normal Color", "timejuicecolornormal", new Color(1f, 1f, 0f, 1f));
		timeJuiceColorInsufficient = new ColorField(config.rootPanel, "Time Juice Bar Insufficient Color", "timejuicecolorinsufficient", new Color(1f, 0f, 0f, 1f));
		timeJuiceColorUsing = new ColorField(config.rootPanel, "Time Juice Bar Draining Color", "timejuicecolorusing", new Color(1f, 0.6f, 0f, 1f));
		timeJuiceColorNoCooldown = new ColorField(config.rootPanel, "Time Juice Bar No Cooldown Color", "timejuicecolornocooldown", new Color(0f, 1f, 1f, 1f));
		new ConfigSpace(config.rootPanel, 4f);
		new ConfigHeader(config.rootPanel, "-- ADVANCED OPTIONS --", 24);
		ConfigPanel val14 = new ConfigPanel(config.rootPanel, "ADVANCED", "advancedoptions");
		new ConfigSpace(config.rootPanel, 8f);
		extensiveLogging = new BoolField(val14, "Extensive Logging", "extensivelogging", false);
		forceDowngrade = new BoolField(val14, "Force Downgrade Arm", "forcedowngrade", true);
		lowerTreshold = new FloatField(val14, "Min Time Juice to Stop Time", "lowertreshold", 2f);
		antiHpMultiplier = new FloatField(val14, "Hard Damage Buildup Multiplier", "antihpmultiplier", 30f);
		resetSaveButton = new ButtonField(config.rootPanel, "RESET TIMESTOPPER PROGRESS", "resetsavebutton");
		resetSaveButton.onClick += new OnClick(TimestopperProgress.Reset);
		giveArmButton = new ButtonField(config.rootPanel, "GIVE TIMESTOPPER ARM", "givearmbutton");
		giveArmButton.onClick += new OnClick(TimestopperProgress.GiveArm);
	}

	public IEnumerator LoadSoundProfiles()
	{
		((ConfigField)stopSound).interactable = false;
		((ConfigField)startSound).interactable = false;
		((ConfigField)stoppedSound).interactable = false;
		((ConfigField)soundReloadButton).interactable = false;
		ReloadSoundProfilesList();
		string[] timestopSoundsList = (from file in Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "Stopping"), "*.*")
			where file.EndsWith(".wav") || file.EndsWith(".ogg")
			select file).ToArray();
		TimestopSounds = (AudioClip[])(object)new AudioClip[timestopSoundsList.Length];
		for (int i = 0; i < timestopSoundsList.Length; i++)
		{
			AudioType audioType = (AudioType)20;
			if (timestopSoundsList[i].EndsWith(".ogg"))
			{
				audioType = (AudioType)14;
			}
			if (timestopSoundsList[i].EndsWith(".wav"))
			{
				audioType = (AudioType)20;
			}
			if (timestopSoundsList[i].EndsWith(".mp3"))
			{
				audioType = (AudioType)13;
			}
			UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file://" + timestopSoundsList[i], audioType);
			try
			{
				yield return request.SendWebRequest();
				TimestopSounds[i] = DownloadHandlerAudioClip.GetContent(request);
				Log("downloaded timestop audio cussessfully!");
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}
		string[] stopambienceSoundsList = (from file in Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "Stopped"), "*.*")
			where file.EndsWith(".wav") || file.EndsWith(".ogg")
			select file).ToArray();
		StoppedTimeAmbiences = (AudioClip[])(object)new AudioClip[stopambienceSoundsList.Length];
		for (int j = 0; j < stopambienceSoundsList.Length; j++)
		{
			AudioType audioType2 = (AudioType)20;
			if (stopambienceSoundsList[j].EndsWith(".ogg"))
			{
				audioType2 = (AudioType)14;
			}
			if (stopambienceSoundsList[j].EndsWith(".wav"))
			{
				audioType2 = (AudioType)20;
			}
			if (stopambienceSoundsList[j].EndsWith(".mp3"))
			{
				audioType2 = (AudioType)13;
			}
			UnityWebRequest request2 = UnityWebRequestMultimedia.GetAudioClip("file://" + stopambienceSoundsList[j], audioType2);
			try
			{
				yield return request2.SendWebRequest();
				StoppedTimeAmbiences[j] = DownloadHandlerAudioClip.GetContent(request2);
				Log("downloaded stopambience audio successfully!");
			}
			finally
			{
				((IDisposable)request2)?.Dispose();
			}
		}
		string[] timestartSoundsList = (from file in Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Timestopper", "Sounds", "Starting"), "*.*")
			where file.EndsWith(".wav") || file.EndsWith(".ogg")
			select file).ToArray();
		TimestartSounds = (AudioClip[])(object)new AudioClip[timestartSoundsList.Length];
		for (int k = 0; k < timestartSoundsList.Length; k++)
		{
			AudioType audioType3 = (AudioType)20;
			if (timestartSoundsList[k].EndsWith(".ogg"))
			{
				audioType3 = (AudioType)14;
			}
			if (timestartSoundsList[k].EndsWith(".wav"))
			{
				audioType3 = (AudioType)20;
			}
			if (timestartSoundsList[k].EndsWith(".mp3"))
			{
				audioType3 = (AudioType)13;
			}
			UnityWebRequest request3 = UnityWebRequestMultimedia.GetAudioClip("file://" + timestartSoundsList[k], audioType3);
			try
			{
				yield return request3.SendWebRequest();
				TimestartSounds[k] = DownloadHandlerAudioClip.GetContent(request3);
				Log("downloaded timestart audio successfully!");
			}
			finally
			{
				((IDisposable)request3)?.Dispose();
			}
		}
		((ConfigField)stopSound).interactable = true;
		((ConfigField)startSound).interactable = true;
		((ConfigField)stoppedSound).interactable = true;
		((ConfigField)soundReloadButton).interactable = true;
		ReloadSoundProfilesList();
	}

	public IEnumerator LoadBundle()
	{
		LoadDone = false;
		Type imageType = typeof(Image);
		GC.KeepAlive(imageType);
		Assembly assembler = Assembly.GetExecutingAssembly();
		string[] resourceNames = assembler.GetManifestResourceNames();
		Log("Scanning newly embedded resources: " + string.Join(", ", resourceNames), extensive: true);
		using (Stream stream2 = assembler.GetManifestResourceStream("The_Timestopper.aprilfools.bundle"))
		{
			mls.LogWarning((object)"started loading something special girrrl!");
			AssetBundle aprilFoolsBundle = AssetBundle.LoadFromStream(stream2);
			aprilFoolsPFPList = aprilFoolsBundle.LoadAllAssets<Sprite>();
			rickrollObject = aprilFoolsBundle.LoadAllAssets<GameObject>()[0];
			Object[] array = aprilFoolsBundle.LoadAllAssets();
			foreach (Object s in array)
			{
				mls.LogWarning((object)((object)s).ToString());
			}
			mls.LogWarning((object)"END ---//");
		}
		using (Stream stream = assembler.GetManifestResourceStream("The_Timestopper.timestopper_assets_assets_all.bundle"))
		{
			AssetBundle newBundle = AssetBundle.LoadFromStream(stream);
			newTimeArm = newBundle.LoadAsset<GameObject>("Assets/TimestopperMod/TimeArm.prefab");
			newArmAltar = newBundle.LoadAsset<GameObject>("Assets/TimestopperMod/TimeArmAltar.prefab");
			armTimeText = newBundle.LoadAsset<GameObject>("Assets/TimestopperMod/TimestopperText.prefab");
			armGoldLogo = newBundle.LoadAsset<Texture2D>("Assets/TimestopperMod/ArmTimestopper.png");
			modLogo = newBundle.LoadAsset<Texture2D>("Assets/TimestopperMod/icon_big.png");
			grayscaleShader = newBundle.LoadAsset<Shader>("Assets/TimestopperMod/GrayscaleObject.shader");
			depthShader = newBundle.LoadAsset<Shader>("Assets/TimestopperMod/DepthRenderer.shader");
			config.icon = Sprite.Create(modLogo, new Rect(0f, 0f, 750f, 750f), new Vector2(375f, 375f));
			Log("Total assets loaded: " + newBundle.GetAllAssetNames().Length, extensive: true, 1);
			string[] allAssetNames = newBundle.GetAllAssetNames();
			foreach (string asset in allAssetNames)
			{
				Log(asset, extensive: true, 1);
			}
			yield return LoadSoundProfiles();
		}
		Log("Scanning embedded resources: " + string.Join(", ", resourceNames), extensive: true);
		Log("      >:Bundle extraction done!", extensive: true);
		LoadDone = true;
	}

	public static GameObject UpdateTerminal(ShopZone ShopComp)
	{
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a25: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a34: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a7c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b0a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b19: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b23: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bd1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cf8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d19: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d6f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dce: Unknown result type (might be due to invalid IL or missing references)
		//IL_0540: Unknown result type (might be due to invalid IL or missing references)
		//IL_0561: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_060f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0630: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ShopComp == (Object)null)
		{
			Log("Shop Component is null, cannot update terminal!", extensive: false, 3);
			return null;
		}
		GameObject gameObject = ((Component)ShopComp).gameObject;
		if ((Object)(object)gameObject.transform.Find("Canvas/Background/Main Panel/Weapons/Arm Window") == (Object)null)
		{
			((Component)ShopComp).gameObject.AddComponent<TerminalExcluder>();
			return null;
		}
		GameObject gameObject2 = ((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Weapons/Arm Window")).gameObject;
		GameObject gameObject3 = ((Component)gameObject2.transform.Find("Variation Screen/Variations/Arm Panel (Gold)")).gameObject;
		GameObject gameObject4 = ((Component)gameObject2.transform.Find("Arm Info (Gold)")).gameObject;
		if (isAprilFools)
		{
			Debug.LogWarning((object)"You are now dawn!");
			int num = Random.Range(0, aprilFoolsPFPList.Length);
			((Component)ShopComp).gameObject.AddComponent<TerminalExcluder>();
			GameObject val = Object.Instantiate<GameObject>(rickrollObject, gameObject.transform.Find("Canvas/Background/Main Panel"));
			((Component)val.transform.Find("close")).GetComponent<ShopButton>().toActivate = (GameObject[])(object)new GameObject[2]
			{
				((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Main Menu")).gameObject,
				((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Tip of the Day")).gameObject
			};
			val.SetActive(false);
			GameObject val2 = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("Canvas/Background/Main Panel/The Cyber Grind/Cyber Grind Panel")).gameObject, gameObject.transform.Find("Canvas/Background/Main Panel"));
			((Object)val2).name = "New Mail!";
			val2.GetComponent<RectTransform>().SetSizeWithCurrentAnchors((Axis)0, 500f);
			val2.GetComponent<RectTransform>().SetSizeWithCurrentAnchors((Axis)1, 230f);
			val2.transform.localPosition = new Vector3(-9.4417f, 6f, 0.0002f);
			((Component)val2.transform.Find("Button 1")).gameObject.SetActive(false);
			((Component)val2.transform.Find("Button 2")).gameObject.SetActive(false);
			((Component)val2.transform.Find("Button 3")).gameObject.SetActive(false);
			if (Object.op_Implicit((Object)(object)val2.GetComponentInChildren<HudMessage>()))
			{
				Object.Destroy((Object)(object)((Component)val2.GetComponentInChildren<HudMessage>()).gameObject);
			}
			string text = "something is wrong...";
			if (((Object)aprilFoolsPFPList[num]).name == "brakxypfp")
			{
				text = "<color=#FF0000>@hellbrakxy123</color><color=#EEEEEE> has invited you to commit Fraud in Minecraft, accept? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "dialyultrakillnewspfp")
			{
				text = "<color=#FF0000>@dailyultrakillnewsofficialnofake</color><color=#EEEEEE> has sent you an ULTRAKILL leak, accept it? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "galvinpfp")
			{
				text = "<color=#FF0000>@xXxgalvinvoltagxXx</color><color=#EEEEEE> has invited you to a private conversation, accept it? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "hakitapfp")
			{
				text = "<color=#FF0000>@arsihakita</color><color=#EEEEEE> has invited you to a public video call, accept it? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "librarianpfp")
			{
				text = "<color=#FF0000>@thelibrarian</color><color=#EEEEEE> has sent you a very comfy and creepy pocket dimension, accept? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "markpfp")
			{
				text = "<color=#FF0000>@realmarkiplier</color><color=#EEEEEE> announced that you won a special prize, accept the suspicious link? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "martapfp")
			{
				text = "<color=#FF0000>@martaspidetty</color><color=#EEEEEE> offered you a drawing class in the Treachery layer, accept offer? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "newbloodpfp")
			{
				text = "<color=#FF0000>@newbloodofficial</color><color=#EEEEEE> has offered you a sale on merch and games, accept offer? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "newtonpfp")
			{
				text = "<color=#FF0000>@isaacnewtonrblx</color><color=#EEEEEE> has offered you a class on Einstein's relativity principle, accept? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "radiationpfp")
			{
				text = "<color=#FF0000>@tobynotradiationfox</color><color=#EEEEEE> has some of your delta rune, would you like to rob him? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "mindflayerpfp")
			{
				text = "<color=#FF0000>@sexflayer3169</color><color=#EEEEEE> has sent you and invitation to the Lust layer, alone, accept offer? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "sisyphuspfp")
			{
				text = "<color=#FF0000>@hotprimesoul</color><color=#EEEEEE> has sent you an invitation to the Greed layer, alone, accept offer? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "rickpfp")
			{
				text = "<color=#FF0000>@rickastley</color><color=#EEEEEE> announced you as his new legal daughter, accept your new self? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "earthpfp")
			{
				text = "<color=#FF0000>@earthchannotflat</color><color=#EEEEEE> has sent you a new blood-y mail, open and view it? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "linguinipfp")
			{
				text = "<color=#FF0000>@linguiniwithoutlasagna</color><color=#EEEEEE> has defeated you in 8-S speedrun already, take revenge? </color>";
			}
			if (((Object)aprilFoolsPFPList[num]).name == "gronf")
			{
				text = "<color=#FF0000>@gronf</color><color=#EEEEEE> has forgotten to install The Timestopper, remind him to do so? </color>";
			}
			((TMP_Text)((Component)val2.transform.Find("Panel/Text Inset/Text")).GetComponent<TextMeshProUGUI>()).text = text;
			((Component)val2.transform.Find("Panel/Text Inset/Text")).GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge((Edge)1, 10f, 350f);
			GameObject val3 = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Enemies/Enemies Panel/Icon")).gameObject, val2.transform.Find("Title"));
			GameObject val4 = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Enemies/Enemies Panel/Icon")).gameObject, val2.transform.Find("Title"));
			val4.transform.localPosition = new Vector3(-37f, 0f, 0f);
			val3.transform.localPosition = new Vector3(190f, 0f, 0f);
			((TMP_Text)((Component)val2.transform.Find("Title")).GetComponent<TextMeshProUGUI>()).text = "NEWBLOOD-Y MAIL";
			((TMP_Text)((Component)val2.transform.Find("Title")).GetComponent<TextMeshProUGUI>()).transform.localPosition = new Vector3(-100f, 116f, 0f);
			GameObject gameObject5 = ((Component)val2.transform.Find("Icon")).gameObject;
			gameObject5.transform.SetParent(val2.transform.Find("Panel/Text Inset"), true);
			gameObject5.transform.localPosition = new Vector3(-225f, 40f, 0f);
			gameObject5.transform.localScale = new Vector3(2f, 2f, 2f);
			gameObject5.GetComponent<Image>().sprite = aprilFoolsPFPList[num];
			GameObject gameObject6 = ((Component)val2.transform.Find("Panel/Enter Button")).gameObject;
			((TMP_Text)((Component)gameObject6.transform.Find("Text")).GetComponent<TextMeshProUGUI>()).text = "YES";
			((Graphic)gameObject6.GetComponent<Image>()).color = new Color(0f, 1f, 0f, 1f);
			((Object)gameObject6).name = "Accept Button";
			Object.Destroy((Object)(object)gameObject6.GetComponent<AbruptLevelChanger>());
			val2.SetActive(true);
			((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Main Menu")).gameObject.SetActive(false);
			((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Tip of the Day")).gameObject.SetActive(false);
			gameObject6.GetComponent<ShopButton>().PointerClickSuccess += delegate
			{
				Log("this is good", extensive: false, 2);
			};
			gameObject6.GetComponent<ShopButton>().toDeactivate = (GameObject[])(object)new GameObject[1] { val2 };
			gameObject6.GetComponent<ShopButton>().toActivate = (GameObject[])(object)new GameObject[1] { val };
			gameObject6.GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge((Edge)1, 10f, 220f);
			GameObject val5 = Object.Instantiate<GameObject>(gameObject6, gameObject6.transform.parent, true);
			val5.GetComponent<RectTransform>().SetInsetAndSizeFromParentEdge((Edge)0, 10f, 220f);
			((TMP_Text)((Component)val5.transform.Find("Text")).GetComponent<TextMeshProUGUI>()).text = "NOOo";
			((Graphic)val5.GetComponent<Image>()).color = new Color(1f, 0f, 0f, 1f);
			Object.Destroy((Object)(object)val5.GetComponent<AbruptLevelChanger>());
			val5.GetComponent<ShopButton>().PointerClickSuccess += delegate
			{
				Log("this is good", extensive: false, 3);
			};
			val5.GetComponent<ShopButton>().toDeactivate = (GameObject[])(object)new GameObject[1] { val2 };
			val5.GetComponent<ShopButton>().toActivate = (GameObject[])(object)new GameObject[2]
			{
				((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Tip of the Day")).gameObject,
				((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Main Menu")).gameObject
			};
			((Object)val5).name = "Decline Button";
		}
		if (TimestopperProgress.HasArm)
		{
			((Component)ShopComp).gameObject.AddComponent<TerminalExcluder>();
			gameObject3.GetComponent<ShopButton>().toActivate = (GameObject[])(object)new GameObject[1] { gameObject4 };
			((TMP_Text)((Component)gameObject3.transform.Find("Variation Name")).GetComponent<TextMeshProUGUI>()).text = "TIMESTOPPER";
			((Behaviour)gameObject3.GetComponent<VariationInfo>()).enabled = true;
			gameObject3.GetComponent<VariationInfo>().alreadyOwned = true;
			gameObject3.GetComponent<VariationInfo>().varPage = gameObject4;
			gameObject3.GetComponent<VariationInfo>().weaponName = "arm4";
			gameObject3.GetComponent<ShopButton>().PointerClickSuccess += gameObject.GetComponent<TerminalExcluder>().OverrideInfoMenu;
			((Component)gameObject4.transform.Find("Panel/Purchase Button")).GetComponent<ShopButton>().PointerClickSuccess += TimestopperProgress.UpgradeArm;
			((Component)gameObject4.transform.Find("Panel/Purchase Button")).GetComponent<ShopButton>().PointerClickSuccess += gameObject.GetComponent<TerminalExcluder>().OverrideInfoMenu;
			gameObject3.GetComponent<VariationInfo>().cost = (int)TimestopperProgress.UpgradeCost;
			((Component)gameObject3.transform.Find("Equipment/Equipment Status")).GetComponent<ShopButton>().PointerClickSuccess += TimestopperProgress.ChangeEquipmentStatus;
			((Component)gameObject3.transform.Find("Equipment/Buttons/Previous Button")).GetComponent<ShopButton>().PointerClickSuccess += TimestopperProgress.ChangeEquipmentStatus;
			((Component)gameObject3.transform.Find("Equipment/Buttons/Next Button")).GetComponent<ShopButton>().PointerClickSuccess += TimestopperProgress.ChangeEquipmentStatus;
			Sprite sprite = Sprite.Create(armGoldLogo, new Rect(0f, 0f, 750f, 750f), new Vector2(750f, 750f) / 2f);
			((Component)gameObject3.transform.Find("Weapon Icon")).GetComponent<Image>().sprite = sprite;
			((Graphic)((Component)gameObject3.transform.Find("Weapon Icon")).GetComponent<Image>()).color = Color.yellow;
			((TMP_Text)((Component)gameObject4.transform.Find("Title")).GetComponent<TextMeshProUGUI>()).text = "Timestopper";
			((TMP_Text)((Component)gameObject4.transform.Find("Panel/Name")).GetComponent<TextMeshProUGUI>()).text = "TIMESTOPPER";
			((TMP_Text)((Component)gameObject4.transform.Find("Panel/Description")).GetComponent<TextMeshProUGUI>()).text = "A Godfist that <color=#FFFF43>stops</color> time.\r\n\r\nRecharges very slow, but <color=#FF4343>parrying</color> helps it recharge faster.\r\n\r\nCan be <color=#FFFF24>upgraded</color> through terminals.\r\n" + TimestopperProgress.UpgradeText;
			Sprite sprite2 = Sprite.Create(armGoldLogo, new Rect(0f, 0f, 750f, 750f), new Vector2(750f, 750f) / 2f);
			((Component)gameObject4.transform.Find("Panel/Icon Inset/Icon")).GetComponent<Image>().sprite = sprite2;
			if (!TimestopperProgress.FirstWarning)
			{
				GameObject val6 = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("Canvas/Background/Main Panel/The Cyber Grind/Cyber Grind Panel")).gameObject, gameObject.transform.Find("Canvas/Background/Main Panel"));
				((Object)val6).name = "Warning Panel";
				if (Object.op_Implicit((Object)(object)val6.GetComponentInChildren<HudMessage>()))
				{
					Object.Destroy((Object)(object)((Component)val6.GetComponentInChildren<HudMessage>()).gameObject);
				}
				val6.transform.localPosition = new Vector3(-9.4417f, 6f, 0.0002f);
				((Component)val6.transform.Find("Button 1")).gameObject.SetActive(false);
				((Component)val6.transform.Find("Button 2")).gameObject.SetActive(false);
				((Component)val6.transform.Find("Button 3")).gameObject.SetActive(false);
				((Component)val6.transform.Find("Icon")).gameObject.SetActive(false);
				Object.Destroy((Object)(object)val6.transform.Find("GameObject"));
				((TMP_Text)((Component)val6.transform.Find("Panel/Text Inset/Text")).GetComponent<TextMeshProUGUI>()).text = "<color=#FF4343>!!! Extreme Hazard Detected !!!</color> \r\n\r\nYou have <color=#FF4343>The Timestopper</color> in your possession. Using this item may cause disturbance in space-time continuum.\r\n\r\n<color=#FF4343>Please acknowledge the consequences before proceeding further.</color>";
				GameObject val7 = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Enemies/Enemies Panel/Icon")).gameObject, val6.transform.Find("Title"));
				GameObject val8 = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Enemies/Enemies Panel/Icon")).gameObject, val6.transform.Find("Title"));
				val8.transform.localPosition = new Vector3(-37.1206f, -0.0031f, 0f);
				val7.transform.localPosition = new Vector3(97.8522f, -0.0031f, 0f);
				((TMP_Text)((Component)val6.transform.Find("Title")).GetComponent<TextMeshProUGUI>()).text = "WARNING";
				((TMP_Text)((Component)val6.transform.Find("Title")).GetComponent<TextMeshProUGUI>()).transform.localPosition = new Vector3(-51.5847f, 189.9997f, 0f);
				GameObject gameObject7 = ((Component)val6.transform.Find("Panel/Enter Button")).gameObject;
				((TMP_Text)((Component)gameObject7.transform.Find("Text")).GetComponent<TextMeshProUGUI>()).text = "ACCEPT";
				((Graphic)gameObject7.GetComponent<Image>()).color = new Color(0f, 1f, 0f, 1f);
				((Object)gameObject7).name = "Accept Button";
				Object.Destroy((Object)(object)gameObject7.GetComponent<AbruptLevelChanger>());
				val6.SetActive(false);
				((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Main Menu")).gameObject.SetActive(false);
				((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Tip of the Day")).gameObject.SetActive(false);
				gameObject7.GetComponent<ShopButton>().PointerClickSuccess += TimestopperProgress.AcceptWarning;
				gameObject7.GetComponent<ShopButton>().toDeactivate = (GameObject[])(object)new GameObject[1] { val6 };
				gameObject7.GetComponent<ShopButton>().toActivate = (GameObject[])(object)new GameObject[2]
				{
					((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Tip of the Day")).gameObject,
					((Component)gameObject.transform.Find("Canvas/Background/Main Panel/Main Menu")).gameObject
				};
				return val6;
			}
		}
		else
		{
			((Behaviour)gameObject3.GetComponent<VariationInfo>()).enabled = true;
			gameObject3.GetComponent<VariationInfo>().alreadyOwned = false;
			gameObject3.GetComponent<VariationInfo>().varPage = gameObject4;
		}
		return null;
	}

	public void PreventNull()
	{
		if ((Object)(object)Player.GetComponent<TerminalUpdater>() == (Object)null)
		{
			Player.AddComponent<TerminalUpdater>();
		}
		if ((Object)(object)MenuCanvas == (Object)null)
		{
			MenuCanvas = FindRootGameObject("Canvas");
		}
	}

	public IEnumerator LoadHUD()
	{
		if (!TimestopperProgress.HasArm)
		{
			yield break;
		}
		float elapsedTime = 0f;
		Log("Loading HUD Elements...", extensive: true);
		do
		{
			if (elapsedTime > 5f)
			{
				Log("Time Juice Bar creation failed after 5 seconds!", extensive: false, 3);
				yield break;
			}
			elapsedTime += Time.unscaledDeltaTime;
			yield return null;
		}
		while ((Object)(object)Player.transform.Find("Main Camera/HUD Camera/HUD/GunCanvas/StatsPanel/Filler/AltRailcannonPanel") == (Object)null);
		GameObject[] TimeHUD = (GameObject[])(object)new GameObject[3]
		{
			Object.Instantiate<GameObject>(((Component)Player.transform.Find("Main Camera/HUD Camera/HUD/GunCanvas/StatsPanel/Filler/AltRailcannonPanel")).gameObject, Player.transform.Find("Main Camera/HUD Camera/HUD/GunCanvas/StatsPanel/Filler")),
			default(GameObject),
			default(GameObject)
		};
		TimeHUD[0].SetActive(true);
		((Object)TimeHUD[0]).name = "Golden Time";
		TimeHUD[0].transform.localPosition = new Vector3(0f, 124.5f, 0f);
		((Component)TimeHUD[0].transform.Find("Image")).gameObject.GetComponent<Image>().fillAmount = 0f;
		Sprite mm = Sprite.Create(armGoldLogo, new Rect(0f, 0f, 750f, 750f), new Vector2(750f, 750f) / 2f);
		((Component)TimeHUD[0].transform.Find("Icon")).gameObject.GetComponent<Image>().sprite = mm;
		TimeHUD[0].AddComponent<TimeHUD>();
		TimeHUD[0].GetComponent<TimeHUD>().type = 0;
		Transform transform = ((Component)HudController.Instance.speedometer).gameObject.transform;
		transform.localPosition += new Vector3(0f, 64f, 0f);
		Log("Time Juice Bar created successfully.", extensive: true);
		GameObject obj;
		do
		{
			if (elapsedTime > 5f)
			{
				Log("Time Juice Alt HUD creation failed after 5 seconds!", extensive: false, 3);
				yield break;
			}
			elapsedTime += Time.unscaledDeltaTime;
			yield return null;
			obj = FindRootGameObject("Canvas");
		}
		while ((Object)(object)((obj != null) ? obj.transform.Find("Crosshair Filler/AltHud/Filler/Speedometer") : null) == (Object)null);
		TimeHUD[1] = Object.Instantiate<GameObject>(((Component)FindRootGameObject("Canvas").transform.Find("Crosshair Filler/AltHud/Filler/Speedometer")).gameObject, FindRootGameObject("Canvas").transform.Find("Crosshair Filler/AltHud/Filler"));
		TimeHUD[2] = Object.Instantiate<GameObject>(((Component)FindRootGameObject("Canvas").transform.Find("Crosshair Filler/AltHud (2)/Filler/Speedometer")).gameObject, FindRootGameObject("Canvas").transform.Find("Crosshair Filler/AltHud (2)/Filler"));
		((TMP_Text)((Component)TimeHUD[1].transform.Find("Text (TMP)")).GetComponent<TextMeshProUGUI>()).fontMaterial = ((TMP_Text)((Component)TimeHUD[1].transform.Find("Text (TMP)")).GetComponent<TextMeshProUGUI>()).fontSharedMaterial;
		((Graphic)((Component)TimeHUD[1].transform.Find("Text (TMP)")).GetComponent<TextMeshProUGUI>()).SetMaterialDirty();
		((Graphic)((Component)TimeHUD[1].transform.Find("Text (TMP)")).GetComponent<TextMeshProUGUI>()).color = new Color(1f, 0.9f, 0.2f);
		((TMP_Text)((Component)TimeHUD[1].transform.Find("Title")).GetComponent<TextMeshProUGUI>()).text = "TIME";
		TimeHUD[1].transform.localPosition = new Vector3(360f, -360f, 0f);
		Object.Destroy((Object)(object)TimeHUD[1].GetComponent<Speedometer>());
		((Object)TimeHUD[1]).name = "Time Juice";
		((TMP_Text)((Component)TimeHUD[2].transform.Find("Title")).GetComponent<TextMeshProUGUI>()).text = "TIME";
		TimeHUD[2].transform.localPosition = new Vector3(360f, -360f, 0f);
		Object.Destroy((Object)(object)TimeHUD[2].GetComponent<Speedometer>());
		((Object)TimeHUD[2]).name = "Time Juice";
		TimeHUD[1].AddComponent<TimeHUD>();
		TimeHUD[1].GetComponent<TimeHUD>().type = 1;
		TimeHUD[2].AddComponent<TimeHUD>();
		TimeHUD[2].GetComponent<TimeHUD>().type = 2;
		Log("Golden Time Alt HUD created successfully.", extensive: true);
	}

	public static void ResetGoldArm()
	{
		StartTime(0f);
		if ((Object)(object)TimeArm.Instance != (Object)null)
		{
			TimeArm.Instance.Reset();
		}
	}

	public GameObject FindRootGameObject(string _name)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		Scene activeScene = SceneManager.GetActiveScene();
		return ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject G) => ((Object)G).name == _name));
	}

	public IEnumerator InstantiateMenuItems()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => LoadDone));
		Log("custom menu items are loaded", extensive: false, 2);
		GameObject timeArmText = Object.Instantiate<GameObject>(armTimeText, FindRootGameObject("Canvas").transform.Find("Main Menu (1)/V1"));
		timeArmText.SetActive(TimestopperProgress.HasArm);
		GameObject timeArmText2 = Object.Instantiate<GameObject>(armTimeText, FindRootGameObject("Canvas").transform.Find("Difficulty Select (1)/Info Background/V1"));
		((Graphic)timeArmText2.GetComponent<Image>()).color = new Color(0.125f, 0.125f, 0.125f, 1f);
		timeArmText2.SetActive(TimestopperProgress.HasArm);
	}

	public void OnSceneUnloaded(Scene scene)
	{
	}

	private bool ConfirmLevel(string LayerName)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)currentLevelInfo == (Object)null)
		{
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				if (((Object)val).name == "Level Info")
				{
					currentLevelInfo = val;
					if (((MapInfoBase)val.GetComponent<StockMapInfo>()).layerName == LayerName)
					{
						return true;
					}
				}
			}
		}
		else if (((MapInfoBase)currentLevelInfo.GetComponent<StockMapInfo>()).layerName == LayerName)
		{
			return true;
		}
		return false;
	}

	public IEnumerator CStopTime(float speed)
	{
		if (isInForbiddenScene)
		{
			yield break;
		}
		((MonoBehaviour)this).StopCoroutine(timeStarter);
		StoppedTimeAmount = 0f;
		if (filterMusic.value)
		{
			MusicManager instance = MonoSingleton<MusicManager>.Instance;
			if (instance != null)
			{
				instance.FilterMusic();
			}
		}
		Physics.simulationMode = (SimulationMode)2;
		RigidbodyStopper.FreezeAll();
		Animator[] array = Object.FindObjectsOfType<Animator>();
		foreach (Animator A in array)
		{
			if (((Component)A).gameObject.transform.IsChildOf(Player.transform) && (int)A.updateMode == 0)
			{
				A.updateMode = (AnimatorUpdateMode)2;
			}
		}
		if (speed == 0f)
		{
			Time.timeScale = 0f;
			realTimeScale = 0f;
			playerTimeScale = 1f;
			yield break;
		}
		while (Object.op_Implicit((Object)(object)MonoSingleton<OptionsManager>.Instance))
		{
			Time.timeScale -= Time.unscaledDeltaTime / speed * (float)((!MonoSingleton<OptionsManager>.Instance.paused) ? 1 : 0);
			realTimeScale -= Time.unscaledDeltaTime / speed * (float)((!MonoSingleton<OptionsManager>.Instance.paused) ? 1 : 0);
			yield return null;
			if (!(Time.timeScale > Time.unscaledDeltaTime / speed))
			{
				break;
			}
		}
		Time.timeScale = 0f;
		realTimeScale = 0f;
	}

	public IEnumerator CStartTime(float speed, bool preventStyle = false)
	{
		if (isInForbiddenScene)
		{
			yield break;
		}
		((MonoBehaviour)this).StopCoroutine(timeStopper);
		if (filterMusic.value)
		{
			MusicManager instance = MonoSingleton<MusicManager>.Instance;
			if (instance != null)
			{
				instance.UnfilterMusic();
			}
		}
		Physics.simulationMode = (SimulationMode)0;
		RigidbodyStopper.UnfreezeAll();
		Animator[] array = Object.FindObjectsOfType<Animator>();
		foreach (Animator A in array)
		{
			if (((Component)A).gameObject.transform.IsChildOf(Player.transform) && (int)A.updateMode == 2)
			{
				A.updateMode = (AnimatorUpdateMode)0;
			}
		}
		if (speed == 0f)
		{
			Time.timeScale = 1f;
			realTimeScale = 1f;
			StoppedTimeAmount = 0f;
			yield break;
		}
		if (Time.timeScale < 0f)
		{
			Time.timeScale = 0f;
		}
		while (Object.op_Implicit((Object)(object)MonoSingleton<OptionsManager>.Instance))
		{
			Time.timeScale += Time.unscaledDeltaTime / speed * (float)((!MonoSingleton<OptionsManager>.Instance.paused) ? 1 : 0);
			realTimeScale += Time.unscaledDeltaTime / speed * (float)((!MonoSingleton<OptionsManager>.Instance.paused) ? 1 : 0);
			yield return null;
			if (!(Time.timeScale < 1f))
			{
				break;
			}
		}
		if (!preventStyle && StoppedTimeAmount > 2f)
		{
			StyleHUD instance2 = MonoSingleton<StyleHUD>.Instance;
			if (instance2 != null)
			{
				instance2.AddPoints((int)StoppedTimeAmount * 100, "timestopper.timestop", ((Component)Playerstopper.Instance).gameObject, (EnemyIdentifier)null, -1, "", "");
			}
		}
		StoppedTimeAmount = 0f;
		Time.timeScale = 1f;
		realTimeScale = 1f;
	}

	public static void StopTime(float time)
	{
		if (!isInForbiddenScene)
		{
			Instance.timeStopper = Instance.CStopTime(time);
			((MonoBehaviour)Instance).StartCoroutine(Instance.timeStopper);
			TimeStop = true;
		}
	}

	public static void StartTime(float time, bool preventStyle = false)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		if (!isInForbiddenScene)
		{
			Instance.timeStarter = Instance.CStartTime(time, preventStyle);
			((MonoBehaviour)Instance).StartCoroutine(Instance.timeStarter);
			Instance.timeSinceLastTimestop = TimeSince.op_Implicit(0f);
			TimeStop = false;
		}
	}

	private void HandleHitstop()
	{
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Expected O, but got Unknown
		if ((float)AccessTools.Field(typeof(TimeController), "currentStop").GetValue(MonoSingleton<TimeController>.Instance) <= 0f)
		{
			if (!(playerTimeScale <= 0f))
			{
				return;
			}
			playerTimeScale = 1f;
			Time.timeScale = 0f;
			TimeController instance = MonoSingleton<TimeController>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.timeScaleModifier = 1f;
			}
			object? value = AccessTools.Field(typeof(TimeController), "parryFlash").GetValue(MonoSingleton<TimeController>.Instance);
			object? obj = ((value is GameObject) ? value : null);
			if (obj != null)
			{
				((GameObject)obj).SetActive(false);
			}
			{
				foreach (Transform item in ((Component)Player.transform.Find("Main Camera/New Game Object")).transform)
				{
					Transform val = item;
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
				return;
			}
		}
		frameLaterer = true;
		playerTimeScale = 0f;
		Time.timeScale = 0f;
	}

	private void HandleMenuPause()
	{
		if (Object.op_Implicit((Object)(object)MonoSingleton<OptionsManager>.Instance) && MonoSingleton<OptionsManager>.Instance.paused)
		{
			playerTimeScale = 0f;
		}
		else if (menuOpenLastFrame != MonoSingleton<OptionsManager>.Instance?.paused)
		{
			playerTimeScale = 1f;
		}
		if (Object.op_Implicit((Object)(object)MonoSingleton<OptionsManager>.Instance))
		{
			menuOpenLastFrame = MonoSingleton<OptionsManager>.Instance.paused;
		}
	}

	public void FakeFixedUpdate()
	{
		if (TimeStop && Object.op_Implicit((Object)(object)MonoSingleton<OptionsManager>.Instance) && !MonoSingleton<OptionsManager>.Instance.paused)
		{
			Time.timeScale = realTimeScale;
			FixedUpdateCaller.CallAllFixedUpdates();
			if (playerDeltaTime > 0f)
			{
				Physics.Simulate(Mathf.Max(Time.fixedDeltaTime * (1f - realTimeScale), 0f));
			}
		}
	}

	public Vector3 GetPlayerVelocity(bool trueVelocity = false)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: 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_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance))
		{
			return Vector3.zero;
		}
		Vector3 val = MonoSingleton<NewMovement>.Instance.rb.velocity;
		if (!trueVelocity && MonoSingleton<NewMovement>.Instance.boost && !MonoSingleton<NewMovement>.Instance.sliding)
		{
			val /= 3f;
		}
		if (Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance.ridingRocket))
		{
			val += MonoSingleton<NewMovement>.Instance.ridingRocket.rb.velocity;
		}
		if (Object.op_Implicit((Object)(object)MonoSingleton<PlayerMovementParenting>.Instance))
		{
			Vector3 val2 = MonoSingleton<PlayerMovementParenting>.Instance.currentDelta * 60f;
			val += val2;
		}
		return val;
	}

	private void Update()
	{
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0349: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Expected O, but got Unknown
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		if (TimeStop)
		{
			HandleHitstop();
			HandleMenuPause();
			time += Time.unscaledDeltaTime;
			if (time > Time.maximumDeltaTime)
			{
				time = Time.maximumDeltaTime;
			}
			UnscaleTimeSince = true;
			fixedCall = true;
			while (time >= Time.fixedDeltaTime)
			{
				time -= Time.fixedDeltaTime;
				FakeFixedUpdate();
			}
			fixedCall = false;
		}
		InvokeCaller.Update();
		if (isInForbiddenScene)
		{
			return;
		}
		if (TimeStop)
		{
			foreach (IPortalTraveller item in (List<IPortalTraveller>)travellersField.GetValue(MonoSingleton<PortalManagerV2>.Instance))
			{
				SimplePortalTraveler val = (SimplePortalTraveler)(object)((item is SimplePortalTraveler) ? item : null);
				if (val != null)
				{
					cacheTravelerValues.Invoke(val, null);
				}
			}
			if (!Object.op_Implicit((Object)(object)Dummy))
			{
				Dummy = new GameObject("Player Dummy");
				Rigidbody val2 = Dummy.AddComponent<Rigidbody>();
				val2.isKinematic = true;
				GameObject val3 = new GameObject("Head");
				val3.transform.parent = Dummy.transform;
				val3.transform.localPosition = ((Component)Player.transform.Find("Main Camera").Find("New Game Object")).transform.localPosition;
				val3.transform.localRotation = ((Component)Player.transform.Find("Main Camera").Find("New Game Object")).transform.localRotation;
				Dummy.transform.position = Player.transform.Find("New Game Object").position;
				Dummy.transform.rotation = Player.transform.Find("New Game Object").rotation;
			}
			typeof(PlayerTracker).GetField("target", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(MonoSingleton<PlayerTracker>.Instance, Dummy.transform);
			typeof(PlayerTracker).GetField("player", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(MonoSingleton<PlayerTracker>.Instance, Dummy.transform.GetChild(0));
			typeof(PlayerTracker).GetField("playerRb", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(MonoSingleton<PlayerTracker>.Instance, Dummy.GetComponent<Rigidbody>());
		}
		else if (Object.op_Implicit((Object)(object)Dummy) && TimeSince.op_Implicit(timeSinceLastTimestop) > 1f)
		{
			if (Vector3.Distance(Dummy.transform.position, Player.transform.position) > 1f)
			{
				Transform transform = Dummy.transform;
				transform.position -= Vector3.Normalize(Dummy.transform.position - Player.transform.position) * (200f * playerDeltaTime);
				return;
			}
			typeof(PlayerTracker).GetField("target", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(MonoSingleton<PlayerTracker>.Instance, Player.transform.Find("Main Camera").Find("New Game Object"));
			typeof(PlayerTracker).GetField("player", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(MonoSingleton<PlayerTracker>.Instance, ((Component)Player.transform.Find("New Game Object")).transform);
			typeof(PlayerTracker).GetField("playerRb", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(MonoSingleton<PlayerTracker>.Instance, Player.GetComponent<Rigidbody>());
			Object.DestroyImmediate((Object)(object)((Component)Dummy.transform.GetChild(0)).gameObject);
			Object.DestroyImmediate((Object)(object)Dummy);
			Dummy = null;
		}
	}

	private void LateUpdate()
	{
		if ((Object)(object)Player == (Object)null || isInForbiddenScene)
		{
			return;
		}
		if (cybergrind)
		{
			if (!Object.op_Implicit((Object)(object)MonoSingleton<EndlessGrid>.Instance))
			{
				return;
			}
			if (cybergrindWave != MonoSingleton<EndlessGrid>.Instance.currentWave)
			{
				Playerstopper.Instance.timeArm.GetComponent<TimeArm>().timeLeft = TimestopperProgress.MaxTime;
				cybergrindWa