Decompiled source of FindTheGaster v0.3.5

FindTheGaster.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using GameConsole;
using GameConsole.Commands;
using HarmonyLib;
using Newtonsoft.Json;
using RepoCaos;
using TMPro;
using UltrakillStupid.Classes;
using UltrakillStupid.Scripts;
using UltrakillStupid.Scripts.Triggers;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
using plog;
using plog.Models;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RepoCaosMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ReviOS 11 24.12")]
[assembly: AssemblyProduct("RepoCaosMod")]
[assembly: AssemblyCopyright("Copyright © ReviOS 11 24.12 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b62091cf-1bc7-4d0e-be7b-011b6b98bf30")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RepoCaos
{
	[BepInPlugin("duviz.ultrakill.findthegaster", "Find the Gaster", "0.3.5")]
	public class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__26_1;

			public static UnityAction <>9__26_2;

			public static UnityAction <>9__26_3;

			public static Func<string, int> <>9__53_0;

			public static Func<string, int> <>9__53_1;

			internal void <SpawnDailyGaster>b__26_1()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Physics.gravity = Vector3.zero;
			}

			internal void <SpawnDailyGaster>b__26_2()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				Physics.gravity *= 5f;
			}

			internal void <SpawnDailyGaster>b__26_3()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject("Water");
				val.transform.localScale = new Vector3(1000f, 1000f, 1000f);
				val.transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
				val.AddComponent<BoxCollider>();
				((Collider)val.GetComponent<BoxCollider>()).isTrigger = true;
				val.layer = LayerMask.NameToLayer("Water");
				val.AddComponent<Water>();
			}

			internal int <IsRemoteVersionLower>b__53_0(string s)
			{
				if (!int.TryParse(s, out var result))
				{
					return 0;
				}
				return result;
			}

			internal int <IsRemoteVersionLower>b__53_1(string s)
			{
				if (!int.TryParse(s, out var result))
				{
					return 0;
				}
				return result;
			}
		}

		[CompilerGenerated]
		private sealed class <GetAudioFromUrl>d__37 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public Action<AudioClip> callback;

			private UnityWebRequest <www>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetAudioFromUrl>d__37(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)14);
						<>1__state = -3;
						<>2__current = <www>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<www>5__2.result != 1)
						{
							Debug.LogError((object)("Failed to load audio: " + <www>5__2.error));
							callback?.Invoke(null);
						}
						else
						{
							AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
							callback?.Invoke(content);
						}
						<>m__Finally1();
						<www>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<www>5__2 != null)
				{
					((IDisposable)<www>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GetStringFromUrl>d__38 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public Action<string> callback;

			private UnityWebRequest <www>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetStringFromUrl>d__38(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<www>5__2 = UnityWebRequest.Get(url);
						<>1__state = -3;
						<>2__current = <www>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<www>5__2.result != 1)
						{
							Debug.LogError((object)("Failed to load string: " + <www>5__2.error));
							callback?.Invoke(null);
						}
						else
						{
							callback?.Invoke(<www>5__2.downloadHandler.text);
						}
						<>m__Finally1();
						<www>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<www>5__2 != null)
				{
					((IDisposable)<www>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GetTextureFromURL>d__35 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public Action<Texture2D> callback;

			private UnityWebRequest <uwr>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetTextureFromURL>d__35(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<uwr>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<uwr>5__2 = UnityWebRequestTexture.GetTexture(url);
						<>1__state = -3;
						<>2__current = <uwr>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<uwr>5__2.result != 1)
						{
							Debug.LogError((object)("Failed to load texture: " + <uwr>5__2.error));
							callback?.Invoke(null);
						}
						else
						{
							Texture2D content = DownloadHandlerTexture.GetContent(<uwr>5__2);
							callback?.Invoke(content);
						}
						<>m__Finally1();
						<uwr>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<uwr>5__2 != null)
				{
					((IDisposable)<uwr>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadAudioFromURL>d__36 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			private UnityWebRequest <www>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadAudioFromURL>d__36(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)14);
						<>1__state = -3;
						<>2__current = <www>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<www>5__2.result != 1)
						{
							Debug.LogError((object)("Failed to load audio: " + <www>5__2.error));
						}
						else
						{
							AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
							popupSfx.clip = content;
						}
						<>m__Finally1();
						<www>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<www>5__2 != null)
				{
					((IDisposable)<www>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SetTextureToObject>d__33 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public Color? tintColor;

			public GameObject obj;

			private UnityWebRequest <uwr>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SetTextureToObject>d__33(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<uwr>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Invalid comparison between Unknown and I4
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Expected O, but got Unknown
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Expected O, but got Unknown
				//IL_0183: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<uwr>5__2 = UnityWebRequestTexture.GetTexture(url);
						<>1__state = -3;
						<>2__current = <uwr>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<uwr>5__2.result != 1)
						{
							Debug.LogError((object)("Failed to load texture: " + <uwr>5__2.error));
						}
						else
						{
							Texture2D content = DownloadHandlerTexture.GetContent(<uwr>5__2);
							((Texture)content).filterMode = (FilterMode)0;
							if (tintColor.HasValue)
							{
								Color[] pixels = content.GetPixels();
								for (int i = 0; i < pixels.Length; i++)
								{
									pixels[i] *= tintColor.Value;
								}
								content.SetPixels(pixels);
								content.Apply();
							}
							Material val = new Material(Shader.Find("Unlit/Texture"));
							if (PlayerPrefs.GetString("Gaster_Transparent") == "transparent")
							{
								val = new Material(MonoSingleton<DefaultReferenceManager>.Instance.masterShader);
								val.SetFloat("_BlendMode", 1f);
								val.SetFloat("_ZWrite", 1f);
								val.SetFloat("_Opacity", 0.9f);
								val.SetFloat("_SrcBlend", 1f);
								val.SetFloat("_DstBlend", 0f);
								val.SetColor("_Color", Color.white);
								val.renderQueue = 2450;
								val.shaderKeywords = new string[8] { "ALPHA_TEST", "VERTEX_LIGHTING", "_FOG_ON", "_GLITCHMODE_NONE", "_USEALBEDOASEMISSIVE_ON", "_VERTEXCOLORS_ON", "_VERTEXLIGHTING_ON", "_ZWRITE_ON" };
								val.EnableKeyword("VERTEX_LIGHTING");
								val.EnableKeyword("_FOG_ON");
								val.EnableKeyword("ALPHA_TEST");
								val.DisableKeyword("VERTEX_LIGHTING");
								val.DisableKeyword("_VERTEXLIGHTING_ON");
								val.EnableKeyword("_USEALBEDOEMISSIVE_ON");
							}
							val.SetTexture("_MainTex", (Texture)(object)content);
							obj.GetComponent<Renderer>().material = val;
						}
						<>m__Finally1();
						<uwr>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<uwr>5__2 != null)
				{
					((IDisposable)<uwr>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static Plugin instance;

		public List<Gaster> gasters = new List<Gaster>();

		public Texture popupTex;

		public Texture fadeTex;

		public Texture2D vignetteTex;

		public Texture2D gasterTex;

		public static AudioSource popupSfx = null;

		public static AudioClip gasterAmbienceSfx = null;

		private string[] customLevelMod = new string[1] { "com.eternalUnion.angryLevelLoader" };

		private bool pausedOnce;

		private bool extraGasters;

		private GameObject gasterMenuButton;

		public static bool showCollected = true;

		private bool spawnedDaily;

		private float timeToUpdate;

		private bool lastMovementActive;

		private bool spawnedDailyGaster;

		private bool isBusySpawning;

		public static float gasterPopupX = 0f;

		public static int gasterPopupStage = 0;

		public static float gasterPopupAlpha = 1f;

		public string overrideText = "";

		public float gastersListX = -1920f;

		public static Color? forcedColor = null;

		public Texture2D tintedVignetteTex;

		public bool showVignette;

		public void Awake()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			((Object)ThreadingHelper.Instance).hideFlags = (HideFlags)61;
			((ConfigEntry<bool>)AccessTools.Field(typeof(Chainloader), "ConfigHideBepInExGOs").GetValue(null)).Value = true;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello, the Instagram community!");
			new Harmony("duviz.ultrakill.findthegaster").PatchAll();
			instance = this;
			showCollected = PlayerPrefs.GetString("Gaster_Show_Collected", "on") == "on";
		}

		public void Start()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			SpawnDefaultGasters();
			if (customLevelMod.Any(Chainloader.PluginInfos.ContainsKey))
			{
				SpawnCustomLevelGasters();
			}
			popupSfx = new GameObject("Audio").AddComponent<AudioSource>();
			Object.DontDestroyOnLoad((Object)(object)popupSfx);
			MonoSingleton<Console>.Instance.RegisterCommand((ICommand)(object)new GasterTransparencyCommand());
			MonoSingleton<Console>.Instance.RegisterCommand((ICommand)(object)new GasterRemixCommand());
			MonoSingleton<Console>.Instance.RegisterCommand((ICommand)(object)new GasterCreditsCommand());
			MonoSingleton<Console>.Instance.RegisterCommand((ICommand)(object)new GasterObsidianCommand());
			MonoSingleton<Console>.Instance.RegisterCommand((ICommand)(object)new GasterPlayerPrefsCommand());
			MonoSingleton<Console>.Instance.RegisterCommand((ICommand)(object)new GasterListCommand());
			PointsButton.hintActive = PlayerPrefs.GetInt("Gaster_Hint") == 1;
			PlayerPrefsInformation.GasterPrefix = PlayerPrefs.GetString("Gaster_Save", "Gaster");
			new GameObject("BundlesManager").AddComponent<BundlesManager>();
		}

		public void Update()
		{
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			UpdateFunction();
			timeToUpdate = Time.realtimeSinceStartup - realtimeSinceStartup;
		}

		public void UpdateFunction()
		{
			//IL_01a0: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Expected O, but got Unknown
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MonoSingleton<NewMovement>.Instance == (Object)null || !((Component)MonoSingleton<NewMovement>.Instance).gameObject.activeSelf)
			{
				return;
			}
			if (!spawnedDaily && (Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				SpawnDailyGaster();
				spawnedDaily = true;
			}
			if ((Object)(object)MonoSingleton<AudioMixerController>.Instance != (Object)null)
			{
				popupSfx.volume = MonoSingleton<AudioMixerController>.Instance.sfxVolume;
			}
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				if (!lastMovementActive && MonoSingleton<NewMovement>.Instance.activated)
				{
					((MonoBehaviour)this).StartCoroutine(GetStringFromUrl("https://duviz.xyz/getGasterVersion", delegate(string str)
					{
						if (str != null && IsRemoteVersionLower(str, "0.3.5"))
						{
							MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Outdated Find The Gaster version!\nv0.3.5 > v" + str, "", "", 0, false, false, true);
						}
					}));
				}
				lastMovementActive = MonoSingleton<NewMovement>.Instance.activated;
			}
			Vector3 val3 = default(Vector3);
			foreach (Gaster gaster in gasters)
			{
				if ((Object)(object)gaster.instance == (Object)null && gaster.level == SceneHelper.CurrentScene && MonoSingleton<NewMovement>.Instance.activated && (showCollected || !gaster.IsCollected()))
				{
					GasterTrigger.collectingObsidian = false;
					showVignette = false;
					gaster.instance = NewGaster(gaster.position, gaster, gasterTrigger: true, endLevelTrigger: false, gaster.displayColor.HasValue ? gaster.displayColor : new Color?(gaster.allowCheats ? new Color(0.5f, 0.5f, 1f) : new Color(1f, 1f, 1f)));
				}
				if (!((Object)(object)gaster.instance != (Object)null))
				{
					continue;
				}
				string text = "unknown";
				float num = 10f;
				Vector3 val = ((Component)Camera.main).transform.position - gaster.instance.transform.position;
				Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized);
				gaster.instance.transform.rotation = Quaternion.Slerp(gaster.instance.transform.rotation, val2, 1f - Mathf.Exp((0f - num) * Time.deltaTime));
				if (CheatsActive() && !gaster.allowCheats && !gaster.IsCollected())
				{
					text = "cheats";
				}
				if (gaster.difficultyExclusive != -1 && gaster.difficultyExclusive > MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0) && !gaster.IsCollected())
				{
					text = "difficulty";
				}
				if (text != "unknown")
				{
					((Vector3)(ref val3))..ctor(0f, 2000f, 0f);
					if (gaster.instance.transform.position != val3 && text == "cheats")
					{
						MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Cheats or major assistances disable gasters!", "", "", 0, false, false, true);
					}
					if (gaster.instance.transform.position != val3 && text == "difficulty")
					{
						MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Some gasters won't appear in this difficulty!", "", "", 0, false, false, true);
					}
					gaster.instance.transform.position = val3;
					gaster.instance.gameObject.SetActive(false);
				}
			}
			if (!extraGasters && CollectedGastersWithRequirements() >= gasters.Count)
			{
				extraGasters = true;
				SpawnExtraGasters();
			}
			if (!(SceneHelper.CurrentScene == "Main Menu") || !((Object)(object)gasterMenuButton == (Object)null))
			{
				return;
			}
			WebButton[] array = Object.FindObjectsOfType<WebButton>();
			foreach (WebButton val4 in array)
			{
				if (((Object)((Component)val4).gameObject).name == "Youtube")
				{
					gasterMenuButton = Object.Instantiate<GameObject>(((Component)val4).gameObject, ((Component)val4).transform.parent);
					gasterMenuButton.transform.localPosition = ((Component)val4).transform.localPosition + new Vector3(120f, 0f, 0f);
					((Object)gasterMenuButton).name = "GasterButton";
					WebButton component = gasterMenuButton.GetComponent<WebButton>();
					component.url = "https://duviz.xyz/findthegaster";
					GameObject obj = Object.Instantiate<GameObject>(new GameObject(), ((Component)component).transform);
					obj.AddComponent<RectTransform>();
					((Transform)obj.GetComponent<RectTransform>()).localScale = Vector3.one;
					obj.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 28f);
					((Object)obj).name = "GasterImage";
					obj.AddComponent<RawImage>();
					obj.GetComponent<RawImage>().texture = popupTex;
					((Graphic)obj.GetComponent<RawImage>()).raycastTarget = false;
					((Component)gasterMenuButton.transform.GetChild(0).GetChild(0)).gameObject.SetActive(false);
					((Component)gasterMenuButton.transform.GetChild(0)).GetComponent<TMP_Text>().alpha = 0f;
					obj.AddComponent<GasterMenuButton>();
					SpawnDailyGaster();
				}
			}
		}

		public void LateUpdate()
		{
		}

		public static void LogInfo(object str)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo(str);
		}

		public static void LogError(object str)
		{
			((BaseUnityPlugin)instance).Logger.LogError(str);
		}

		public bool CheatsActive()
		{
			if (!MonoSingleton<CheatsController>.Instance.cheatsEnabled)
			{
				return MonoSingleton<StatsManager>.Instance.majorUsed;
			}
			return true;
		}

		public void SpawnDailyGaster()
		{
			if (isBusySpawning)
			{
				return;
			}
			isBusySpawning = true;
			((MonoBehaviour)this).StartCoroutine(GetStringFromUrl("https://duviz.xyz/getGasterBeta", delegate(string str)
			{
				//IL_0162: 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_023a: Unknown result type (might be due to invalid IL or missing references)
				//IL_023f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0245: Expected O, but got Unknown
				//IL_0288: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0293: 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_02d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02db: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e1: Expected O, but got Unknown
				if (str != null)
				{
					string[][] items = JsonConvert.DeserializeObject<StringArrayWrapper>("{\"items\":" + str + "}").items;
					foreach (Gaster item in gasters.ToList())
					{
						if (item.increasesDailyCount)
						{
							gasters.Remove(item);
						}
					}
					string[][] array = items;
					Vector3 pos = default(Vector3);
					Color value = default(Color);
					foreach (string[] array2 in array)
					{
						string text = array2[0];
						string obj = array2[1];
						string text2 = array2[2];
						string text3 = array2[3];
						string modifierStr = array2[4];
						string[] array3 = obj.Trim('(', ')').Split(new char[1] { ',' });
						((Vector3)(ref pos))..ctor(float.Parse(array3[0], CultureInfo.InvariantCulture), float.Parse(array3[1], CultureInfo.InvariantCulture), float.Parse(array3[2], CultureInfo.InvariantCulture));
						text3 = text3.Trim('(', ')');
						string[] array4 = text3.Split(new char[1] { ',' });
						((Color)(ref value))..ctor(float.Parse(array4[0], CultureInfo.InvariantCulture), float.Parse(array4[1], CultureInfo.InvariantCulture), float.Parse(array4[2], CultureInfo.InvariantCulture));
						Gaster gaster = new Gaster(text, pos, allowCheats: false, (text == "CreditsMuseum2") ? "Museum" : ((text == "Endless") ? "Cybergrind" : ""), value);
						gaster.extraRequirement = false;
						gaster.displayName = text2 + ": " + gaster.displayName;
						gaster.increasesDailyCount = true;
						gaster.requiresPRank = modifierStr == "prank";
						gaster.isObsidian = modifierStr == "obsidian";
						if (modifierStr == "noGravity")
						{
							gaster.isObsidian = true;
							gaster.isWeird = true;
							UnityEvent onTouch = gaster.OnTouch;
							object obj2 = <>c.<>9__26_1;
							if (obj2 == null)
							{
								UnityAction val = delegate
								{
									//IL_0000: Unknown result type (might be due to invalid IL or missing references)
									Physics.gravity = Vector3.zero;
								};
								<>c.<>9__26_1 = val;
								obj2 = (object)val;
							}
							onTouch.AddListener((UnityAction)obj2);
						}
						if (modifierStr == "moreGravity")
						{
							gaster.isObsidian = true;
							gaster.isWeird = true;
							UnityEvent onTouch2 = gaster.OnTouch;
							object obj3 = <>c.<>9__26_2;
							if (obj3 == null)
							{
								UnityAction val2 = delegate
								{
									//IL_0000: Unknown result type (might be due to invalid IL or missing references)
									//IL_000a: Unknown result type (might be due to invalid IL or missing references)
									Physics.gravity *= 5f;
								};
								<>c.<>9__26_2 = val2;
								obj3 = (object)val2;
							}
							onTouch2.AddListener((UnityAction)obj3);
						}
						if (modifierStr == "water")
						{
							gaster.isObsidian = true;
							gaster.isWeird = true;
							UnityEvent onTouch3 = gaster.OnTouch;
							object obj4 = <>c.<>9__26_3;
							if (obj4 == null)
							{
								UnityAction val3 = delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									//IL_000a: Unknown result type (might be due to invalid IL or missing references)
									//IL_001f: Unknown result type (might be due to invalid IL or missing references)
									//IL_0029: Unknown result type (might be due to invalid IL or missing references)
									//IL_0039: Unknown result type (might be due to invalid IL or missing references)
									//IL_0043: Unknown result type (might be due to invalid IL or missing references)
									//IL_004a: Unknown result type (might be due to invalid IL or missing references)
									//IL_0056: Unknown result type (might be due to invalid IL or missing references)
									GameObject val4 = new GameObject("Water");
									val4.transform.localScale = new Vector3(1000f, 1000f, 1000f);
									val4.transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
									val4.AddComponent<BoxCollider>();
									((Collider)val4.GetComponent<BoxCollider>()).isTrigger = true;
									val4.layer = LayerMask.NameToLayer("Water");
									val4.AddComponent<Water>();
								};
								<>c.<>9__26_3 = val3;
								obj4 = (object)val3;
							}
							onTouch3.AddListener((UnityAction)obj4);
						}
						if (modifierStr.StartsWith("spawn_"))
						{
							gaster.isObsidian = true;
							gaster.isWeird = true;
							gaster.OnTouch.AddListener((UnityAction)delegate
							{
								//IL_0033: Unknown result type (might be due to invalid IL or missing references)
								//IL_0038: Unknown result type (might be due to invalid IL or missing references)
								Object.Instantiate<GameObject>(Ass<GameObject>(modifierStr.Replace("spawn_", "") ?? ""), ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
							});
						}
						gasters.Add(gaster);
						spawnedDailyGaster = true;
						isBusySpawning = false;
					}
					isBusySpawning = false;
				}
				isBusySpawning = false;
			}));
		}

		public void SpawnDefaultGasters()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: 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_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0752: Unknown result type (might be due to invalid IL or missing references)
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0832: Unknown result type (might be due to invalid IL or missing references)
			//IL_086a: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0912: Unknown result type (might be due to invalid IL or missing references)
			//IL_094a: Unknown result type (might be due to invalid IL or missing references)
			gasters.Add(new Gaster("Level 0-1", new Vector3(38.25f, 228f, 589.25f)));
			gasters.Add(new Gaster("Level 0-2", new Vector3(0f, 12.5f, 100f)));
			gasters.Add(new Gaster("Level 0-3", new Vector3(-130f, -11.5f, 431.85f)));
			gasters.Add(new Gaster("Level 0-4", new Vector3(5.5f, -0.5f, 249f)));
			gasters.Add(new Gaster("Level 0-5", new Vector3(-3.695781f, -4.5f, 362.5f)));
			gasters.Add(new Gaster("Level 1-1", new Vector3(16.5f, 24.5f, 397.5f)));
			gasters.Add(new Gaster("Level 1-2", new Vector3(46.40152f, 1.428193f, 425.2201f)));
			gasters.Add(new Gaster("Level 1-3", new Vector3(44.19f, -7f, 363.75f)));
			gasters.Add(new Gaster("Level 1-4", new Vector3(0f, -30f, 423f)));
			gasters.Add(new Gaster("Level 2-1", new Vector3(22.63671f, 617.2075f, 431.9131f)));
			gasters.Add(new Gaster("Level 2-2", new Vector3(-126.2621f, 180.8f, 443.2578f)));
			gasters.Add(new Gaster("Level 2-3", new Vector3(-91.49994f, 27.78268f, 355.5f)));
			gasters.Add(new Gaster("Level 2-4", new Vector3(40.5f, -18.5f, 375.1033f)));
			gasters.Add(new Gaster("Level 3-1", new Vector3(0f, 19.5f, 350.4589f)));
			gasters.Add(new Gaster("Level 3-2", new Vector3(0f, 88.45461f, 650.3849f)));
			gasters.Add(new Gaster("Level 4-1", new Vector3(-293.1348f, 84.9838f, 1143.948f)));
			gasters.Add(new Gaster("Level 4-2", new Vector3(342.0074f, 211.133f, 470.0753f)));
			gasters.Add(new Gaster("Level 4-3", new Vector3(67.1669f, 17.5f, 373.6403f)));
			gasters.Add(new Gaster("Level 4-4", new Vector3(1123.369f, 262.4195f, 83.11234f)));
			gasters.Add(new Gaster("Level 5-1", new Vector3(270.3769f, -19.30468f, 231.6668f)));
			gasters.Add(new Gaster("Level 5-2", new Vector3(34.9902f, 991.1714f, -35.20284f)));
			gasters.Add(new Gaster("Level 5-3", new Vector3(-13.99754f, -8.5f, 317.6335f)));
			gasters.Add(new Gaster("Level 5-4", new Vector3(-1.144732f, 139.274f, 346.438f)));
			gasters.Add(new Gaster("Level 6-1", new Vector3(176.8103f, -142.6342f, -509.1721f)));
			gasters.Add(new Gaster("Level 6-2", new Vector3(-132.2011f, 12.62544f, 359.4402f)));
			gasters.Add(new Gaster("Level 7-1", new Vector3(17.51437f, 64.5f, 487.5963f)));
			gasters.Add(new Gaster("Level 7-2", new Vector3(-114.5412f, 387.4886f, 421.2605f)));
			gasters.Add(new Gaster("Level 7-3", new Vector3(-223f, 26.5f, 483.7091f)));
			gasters.Add(new Gaster("Level 7-4", new Vector3(104.0811f, -4.4107f, 847.1364f)));
			gasters.Add(new Gaster("Level P-1", new Vector3(-109.195f, -49.34299f, 70.04394f)));
			gasters.Add(new Gaster("Level P-2", new Vector3(69.5f, 49.2824f, 237.6205f)));
			gasters.Add(new Gaster("Level 0-E", new Vector3(-213.8062f, 7.5f, 311.9821f)));
			gasters.Add(new Gaster("Level 0-E", new Vector3(-43.76205f, 46.2929f, 228.9849f)));
			gasters.Add(new Gaster("Level 1-E", new Vector3(204f, 27.5f, 573.5f)));
			gasters.Add(new Gaster("Level 1-E", new Vector3(135.9412f, 166.5f, 553.1849f)));
			gasters.Add(new Gaster("Level 0-S", new Vector3(72.26433f, -14.5f, 165.4999f)));
			gasters.Add(new Gaster("Level 1-S", new Vector3(0f, -5.699751f, 134.8803f)));
			gasters.Add(new Gaster("Level 4-S", new Vector3(418.9155f, 89.5f, 154.9458f)));
			gasters.Add(new Gaster("Level 5-S", new Vector3(132.7276f, 85.49998f, -258.1491f)));
			gasters.Add(new Gaster("Level 7-S", new Vector3(-56.85102f, -12.68f, 149.4567f)));
			gasters.Add(new Gaster("Endless", new Vector3(0f, -30f, 65f), allowCheats: false, "Cybergrind"));
			gasters.Add(new Gaster("uk_construct", new Vector3(-951.3815f, 62.86881f, 584.1725f), allowCheats: true, "Sandbox"));
			gasters.Add(new Gaster("CreditsMuseum2", new Vector3(538.25f, 53.26952f, 713.1586f), allowCheats: false, "Museum"));
		}

		public void SpawnCustomLevelGasters()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			Color value = default(Color);
			((Color)(ref value))..ctor(0f, 1f, 0f);
			foreach (Gaster item in new List<Gaster>
			{
				new Gaster("punzstayfrosty", new Vector3(951.8428f, -141.375f, 418.6079f), allowCheats: false, "When hell freezes over"),
				new Gaster("ballfartchungus.aBetterTomorrow", new Vector3(-82.03432f, -14.40026f, 771.8484f), allowCheats: false, "A better tomorrow"),
				new Gaster("mag.indulgence.thedeathofparadigm", new Vector3(-274.7996f, 185.7045f, 377.2779f), allowCheats: false, "Indulgence: I-1"),
				new Gaster("BENCE.CLARITY.49", new Vector3(-348.7352f, 19.156f, 134.4591f), allowCheats: false, "Clarity: Trilogy"),
				new Gaster("BLISS.BENCE.FIRST", new Vector3(40.6951f, 960.3764f, 1580.036f), allowCheats: false, "BLISS: B-1")
			})
			{
				item.displayColor = value;
				item.extraRequirement = false;
				gasters.Add(item);
			}
		}

		public void SpawnExtraGasters()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0729: Unknown result type (might be due to invalid IL or missing references)
			//IL_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0830: Unknown result type (might be due to invalid IL or missing references)
			Color value = default(Color);
			((Color)(ref value))..ctor(1f, 0f, 0f);
			foreach (Gaster item in new List<Gaster>
			{
				new Gaster("Tutorial", new Vector3(65.64801f, 30.7f, 297.9344f)),
				new Gaster("Level 0-1", new Vector3(-0.6464477f, 119.7f, 253.5164f)),
				new Gaster("Level 0-2", new Vector3(-49.01336f, -1.53109f, 132.9333f)),
				new Gaster("Level 0-3", new Vector3(82.73406f, 76.5f, 426.1935f)),
				new Gaster("Level 0-4", new Vector3(-31.5f, 8.104531f, 352.7244f)),
				new Gaster("Level 0-5", new Vector3(194.1393f, 45f, 382.2445f)),
				new Gaster("Level 1-1", new Vector3(2.946469f, 232.0233f, 376.0338f)),
				new Gaster("Level 1-2", new Vector3(-205.7693f, 63.94686f, 304.9183f)),
				new Gaster("Level 1-3", new Vector3(0.02359945f, -18.25731f, 437.1486f)),
				new Gaster("Level 1-4", new Vector3(0.5014049f, 26.5f, 608.3572f)),
				new Gaster("Level 2-1", new Vector3(19.8496f, -164.285f, 234.3448f)),
				new Gaster("Level 2-1", new Vector3(35.11102f, -75.58088f, 394f)),
				new Gaster("Level 2-1", new Vector3(42.44817f, 71.30463f, 546.5776f)),
				new Gaster("Level 2-2", new Vector3(-314.4177f, 137.5f, 362.3129f)),
				new Gaster("Level 2-3", new Vector3(-146.6073f, 67.5751f, 483.3467f)),
				new Gaster("Level 2-4", new Vector3(23.60453f, 0.8778399f, 467.8522f)),
				new Gaster("Level 3-1", new Vector3(-69.73652f, -74.375f, 452.855f)),
				new Gaster("Level 3-2", new Vector3(-0.9552683f, -29.96024f, 254.9717f)),
				new Gaster("Level 4-1", new Vector3(-279.7554f, 37.25537f, 428.9385f)),
				new Gaster("Level 4-2", new Vector3(-1049.207f, 758.4415f, 550.069f)),
				new Gaster("Level 4-3", new Vector3(229.6724f, 22f, 529.3333f)),
				new Gaster("Level 4-4", new Vector3(0f, 3.353203f, 296.4533f)),
				new Gaster("Level 5-1", new Vector3(0.3724104f, -101.6131f, 395.7795f)),
				new Gaster("Level 5-2", new Vector3(109.724f, -11.90203f, 899.0867f)),
				new Gaster("Level 5-3", new Vector3(-243.2753f, 156.4371f, 348.4111f)),
				new Gaster("Level 5-4", new Vector3(640.9997f, 819.7258f, 18.63654f)),
				new Gaster("Level 6-1", new Vector3(1.938595f, -122.9554f, 741f)),
				new Gaster("Level 6-2", new Vector3(104.3508f, -21.19061f, 479.1222f)),
				new Gaster("Level 7-1", new Vector3(-88f, -11f, 345.6973f)),
				new Gaster("Level 7-2", new Vector3(-115.558f, 379.6547f, 409.4634f)),
				new Gaster("Level 7-4", new Vector3(-0.1096315f, 368.2268f, 670.9736f)),
				new Gaster("Level 7-4", new Vector3(-111.6039f, 403.8758f, 679.1782f)),
				new Gaster("Level P-1", new Vector3(404.8203f, -445.8927f, 110.3314f)),
				new Gaster("Level P-2", new Vector3(55.6429f, 364.25f, 60.6687f)),
				new Gaster("Level 0-E", new Vector3(94.05121f, -5.108382f, 314.9218f)),
				new Gaster("Level 1-E", new Vector3(292.5919f, 249.1026f, 448.4347f)),
				new Gaster("Level 4-S", new Vector3(409.2071f, 90.75f, 163.5f)),
				new Gaster("Level 5-S", new Vector3(82.01675f, -13.75659f, -278.9781f)),
				new Gaster("Level 7-S", new Vector3(-3859.486f, 904.4676f, -1906.405f)),
				new Gaster("Endless", new Vector3(0.2048489f, 729.2f, -47.05206f), allowCheats: false, "Cybergrind")
			})
			{
				gasters.Add(item);
				item.displayColor = value;
			}
		}

		public int CollectedGasters()
		{
			int num = 0;
			foreach (Gaster gaster in gasters)
			{
				if (gaster.IsCollected())
				{
					num++;
				}
			}
			return num;
		}

		public int CollectedGastersWithRequirements()
		{
			int num = 0;
			foreach (Gaster gaster in gasters)
			{
				if (gaster.IsCollected() || !gaster.extraRequirement)
				{
					num++;
				}
			}
			return num;
		}

		public GameObject NewGaster(Vector3 pos, Gaster gaster, bool gasterTrigger = true, bool endLevelTrigger = false, Color? tintColor = null)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			SetTextureToObjectAssetBundle(val, tintColor);
			((Object)val).name = "Gaster";
			val.transform.position = pos;
			val.transform.localScale = new Vector3(1.2f, 3f, 0.01f);
			((Collider)val.GetComponent<BoxCollider>()).isTrigger = true;
			if (endLevelTrigger)
			{
				val.AddComponent<EndLevelTrigger>();
			}
			if (gasterTrigger)
			{
				val.AddComponent<GasterTrigger>();
				val.GetComponent<GasterTrigger>().gaster = gaster;
				val.AddComponent<GasterAudioController>();
				val.AddComponent<GasterRequirements>();
				val.GetComponent<GasterRequirements>().gaster = gaster;
			}
			return val;
		}

		[IteratorStateMachine(typeof(<SetTextureToObject>d__33))]
		private IEnumerator SetTextureToObject(GameObject obj, Color? tintColor = null, string url = "https://duviz.xyz/static/img/mod/gaster.png")
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SetTextureToObject>d__33(0)
			{
				obj = obj,
				tintColor = tintColor,
				url = url
			};
		}

		private void SetTextureToObjectAssetBundle(GameObject obj, Color? tintColor = null)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(((Texture)gasterTex).width, ((Texture)gasterTex).height);
			val.SetPixels(gasterTex.GetPixels());
			((Texture)val).filterMode = (FilterMode)0;
			if (tintColor.HasValue)
			{
				Color[] pixels = val.GetPixels();
				for (int i = 0; i < pixels.Length; i++)
				{
					pixels[i] *= tintColor.Value;
				}
				val.SetPixels(pixels);
				val.Apply();
			}
			Material val2 = new Material(Shader.Find("Unlit/Texture"));
			if (PlayerPrefs.GetString("Gaster_Transparent") == "transparent")
			{
				val2 = new Material(MonoSingleton<DefaultReferenceManager>.Instance.masterShader);
				val2.SetFloat("_BlendMode", 1f);
				val2.SetFloat("_ZWrite", 1f);
				val2.SetFloat("_Opacity", 0.9f);
				val2.SetFloat("_SrcBlend", 1f);
				val2.SetFloat("_DstBlend", 0f);
				val2.SetColor("_Color", Color.white);
				val2.renderQueue = 2450;
				val2.shaderKeywords = new string[8] { "ALPHA_TEST", "VERTEX_LIGHTING", "_FOG_ON", "_GLITCHMODE_NONE", "_USEALBEDOASEMISSIVE_ON", "_VERTEXCOLORS_ON", "_VERTEXLIGHTING_ON", "_ZWRITE_ON" };
				val2.EnableKeyword("VERTEX_LIGHTING");
				val2.EnableKeyword("_FOG_ON");
				val2.EnableKeyword("ALPHA_TEST");
				val2.DisableKeyword("VERTEX_LIGHTING");
				val2.DisableKeyword("_VERTEXLIGHTING_ON");
				val2.EnableKeyword("_USEALBEDOEMISSIVE_ON");
			}
			val2.SetTexture("_MainTex", (Texture)(object)val);
			obj.GetComponent<Renderer>().material = val2;
		}

		[IteratorStateMachine(typeof(<GetTextureFromURL>d__35))]
		public IEnumerator GetTextureFromURL(string url, Action<Texture2D> callback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetTextureFromURL>d__35(0)
			{
				url = url,
				callback = callback
			};
		}

		[IteratorStateMachine(typeof(<LoadAudioFromURL>d__36))]
		public IEnumerator LoadAudioFromURL(string url)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadAudioFromURL>d__36(0)
			{
				url = url
			};
		}

		[IteratorStateMachine(typeof(<GetAudioFromUrl>d__37))]
		public IEnumerator GetAudioFromUrl(string url, Action<AudioClip> callback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetAudioFromUrl>d__37(0)
			{
				url = url,
				callback = callback
			};
		}

		[IteratorStateMachine(typeof(<GetStringFromUrl>d__38))]
		public IEnumerator GetStringFromUrl(string url, Action<string> callback)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetStringFromUrl>d__38(0)
			{
				url = url,
				callback = callback
			};
		}

		public AudioClip MakeClipLouder(AudioClip clip, float multiplier)
		{
			float[] array = new float[clip.samples * clip.channels];
			clip.GetData(array, 0);
			for (int i = 0; i < array.Length; i++)
			{
				array[i] *= multiplier;
			}
			AudioClip obj = AudioClip.Create(((Object)clip).name + "_louder", clip.samples, clip.channels, clip.frequency, false);
			obj.SetData(array, 0);
			return obj;
		}

		public T Ass<T>(string path)
		{
			//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)
			return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
		}

		public bool IsPaused(bool ignorePauseMenu = false)
		{
			if (MonoSingleton<Console>.Instance.consoleOpen)
			{
				return false;
			}
			if (ignorePauseMenu)
			{
				if (!((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null))
				{
					return false;
				}
				return MonoSingleton<OptionsManager>.Instance.paused;
			}
			if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && MonoSingleton<OptionsManager>.Instance.paused)
			{
				if (!((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null))
				{
					return false;
				}
				return MonoSingleton<OptionsManager>.Instance.pauseMenu.activeSelf;
			}
			return false;
		}

		public bool IsInSettings()
		{
			if (!((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null))
			{
				return false;
			}
			return !MonoSingleton<OptionsManager>.Instance.pauseMenu.activeSelf;
		}

		public void OnGUI()
		{
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			OnGUIFunction();
			realtimeSinceStartup = Time.realtimeSinceStartup - realtimeSinceStartup;
		}

		public void OnGUIFunction()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: 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_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp(Time.unscaledDeltaTime, 0f, 1f / 15f);
			GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3((float)Screen.width / 1920f, (float)Screen.height / 1080f, 1f));
			string text = overrideText;
			if (showVignette)
			{
				GUI.DrawTexture(new Rect(0f, 0f, 1920f, 1080f), (Texture)(object)tintedVignetteTex);
			}
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.alignment = (TextAnchor)4;
			val.fontSize = 24;
			float num2 = 1920f;
			float num3 = 100f;
			float num4 = (1920f - num2) / 2f;
			float num5 = 1080f - num3;
			GUI.Label(new Rect(num4, num5, num2, num3), text, val);
			num2 = 300f;
			num3 = 300f;
			num4 = gasterPopupX - 300f;
			num5 = 1080f - num3;
			if (gasterPopupX > 0f && gasterPopupStage == 0)
			{
				gasterPopupX -= (301f - gasterPopupX) * Time.deltaTime;
			}
			if (gasterPopupX < 299.9f && gasterPopupStage == 1)
			{
				gasterPopupX -= (gasterPopupX - 300f) * Time.deltaTime * 5f;
			}
			else
			{
				gasterPopupStage = 0;
			}
			if ((Object)(object)popupTex != (Object)null && gasterPopupX > 0f)
			{
				float num6 = 1f;
				float num7 = 1f;
				float num8 = 1f;
				if (forcedColor.HasValue)
				{
					num6 = forcedColor.Value.r;
					num7 = forcedColor.Value.g;
					num8 = forcedColor.Value.b;
				}
				GUI.color = new Color(num6, num7, num8, gasterPopupAlpha);
				GUI.DrawTexture(new Rect(num4, num5, num2, num3), popupTex, (ScaleMode)2, true);
				int num9 = 0;
				foreach (Gaster gaster in gasters)
				{
					if (gaster.IsCollected())
					{
						num9++;
					}
				}
				val.alignment = (TextAnchor)4;
				val.fontSize = 30;
				GUI.Label(new Rect(num4, num5 - num3 / 2f + 50f, num2, 100f), $"{num9}/{gasters.Count}", val);
			}
			int num10 = 0;
			foreach (Gaster gaster2 in gasters)
			{
				if (showCollected || !gaster2.IsCollected())
				{
					num10++;
				}
			}
			if (((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && MonoSingleton<OptionsManager>.Instance.paused && Time.timeScale == 0f) || (gastersListX > -1745.4545f && pausedOnce) || (SceneHelper.CurrentScene == "Main Menu" && Input.GetKey((KeyCode)306)))
			{
				num4 = gastersListX;
				num5 = 0f;
				float num11 = 0f;
				if ((IsPaused() && SceneHelper.CurrentScene != "Main Menu" && Time.timeScale == 0f) || (SceneHelper.CurrentScene == "Main Menu" && Input.GetKey((KeyCode)306)))
				{
					if (Input.mousePosition.x < (float)Screen.width * 0.4f)
					{
						if (num10 > 18)
						{
							num11 = (Input.mousePosition.x - (float)Screen.width * 0.3f) / (float)Screen.width * 300f;
							if (num11 < 0f)
							{
								num11 *= 10f;
							}
						}
						gastersListX -= (gastersListX - num11) * num * 5f;
					}
					else
					{
						gastersListX -= gastersListX * num * 5f;
					}
					pausedOnce = true;
				}
				if ((Object)(object)fadeTex != (Object)null)
				{
					GUI.DrawTexture(new Rect((0f - Mathf.Abs(num4)) / 1.4f - Mathf.Abs(num11), 0f, 1920f / ((num10 > 18) ? 1.5f : 3f), 1080f), fadeTex, (ScaleMode)0, true);
				}
				foreach (Gaster gaster3 in gasters)
				{
					if (showCollected || !gaster3.IsCollected())
					{
						float num12 = 60f;
						int fontSize = 14;
						float num13 = (gaster3.allowCheats ? 0.5f : 1f);
						float num14 = (gaster3.allowCheats ? 0.5f : 1f);
						float num15 = (gaster3.allowCheats ? 1f : 1f);
						if (gaster3.displayColor.HasValue)
						{
							num13 = gaster3.displayColor.Value.r;
							num14 = gaster3.displayColor.Value.g;
							num15 = gaster3.displayColor.Value.b;
						}
						if ((Object)(object)popupTex != (Object)null)
						{
							GUI.color = new Color(num13, num14, num15, gaster3.IsCollected() ? 1f : 0.5f);
							GUI.DrawTexture(new Rect(num4, num5, num12, num12), popupTex, (ScaleMode)2, true);
						}
						val.alignment = (TextAnchor)3;
						val.fontSize = fontSize;
						GUI.Label(new Rect(num4 + num12, num5, num12 * 1.4f, num12), gaster3.displayName, val);
						num5 += num12;
						if (num5 > 1080f - num12)
						{
							num5 = 0f;
							num4 += num12 * 2f;
						}
					}
				}
			}
			if ((!IsPaused() || SceneHelper.CurrentScene == "Main Menu" || !MonoSingleton<NewMovement>.Instance.activated || !pausedOnce) && (SceneHelper.CurrentScene != "Main Menu" || !Input.GetKey((KeyCode)306)))
			{
				gastersListX -= (gastersListX - 1920f * ((IsPaused(ignorePauseMenu: true) && IsInSettings() && SceneHelper.CurrentScene != "Main Menu" && MonoSingleton<NewMovement>.Instance.activated) ? (-0.6f) : (-1f))) * num * 3f;
				if (float.IsNaN(gastersListX) || float.IsInfinity(gastersListX))
				{
					gastersListX = -1920f;
				}
			}
		}

		private bool IsRemoteVersionLower(string remoteVersion, string localVersion)
		{
			int result2;
			int[] array = (from s in remoteVersion.Split(new char[1] { '.' })
				select int.TryParse(s, out result2) ? result2 : 0).ToArray();
			int result;
			int[] array2 = (from s in localVersion.Split(new char[1] { '.' })
				select int.TryParse(s, out result) ? result : 0).ToArray();
			int num = Mathf.Max(array.Length, array2.Length);
			for (int i = 0; i < num; i++)
			{
				int num2 = ((i < array.Length) ? array[i] : 0);
				int num3 = ((i < array2.Length) ? array2[i] : 0);
				if (num2 > num3)
				{
					return true;
				}
				if (num2 < num3)
				{
					return false;
				}
			}
			return false;
		}
	}
}
namespace GameConsole.Commands
{
	public class GasterCreditsCommand : ICommand, IConsoleLogger
	{
		public Logger Log { get; } = new Logger("Gaster credits");


		public string Name => "Gaster credits";

		public string Description => "Spawns a ceremonial message from the developer";

		public string Command => "gaster_credits";

		public void Execute(Console con, string[] args)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (SceneHelper.CurrentScene != "uk_construct")
			{
				Log.Info("This command can only be executed in Sandbox", (IEnumerable<Tag>)null, (string)null, (object)null);
				return;
			}
			string text = "";
			foreach (Gaster gaster in Plugin.instance.gasters)
			{
				if (!gaster.IsCollected())
				{
					string text2 = ColorUtility.ToHtmlStringRGB(gaster.displayColor.HasValue ? gaster.displayColor.Value : Color.white);
					text = text + "\n<color=#" + text2 + ">" + gaster.displayName;
				}
			}
			if (text != "")
			{
				GameObject val = Object.Instantiate<GameObject>(Plugin.instance.Ass<GameObject>("Assets/Prefabs/Items/Book.prefab"), ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
				typeof(Readable).GetField("content", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(val.GetComponent<Readable>(), "Come back when you have collected these gasters:\n" + text);
				typeof(Readable).GetField("instantScan", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(val.GetComponent<Readable>(), true);
				Log.Info("Spawned credits book", (IEnumerable<Tag>)null, (string)null, (object)null);
			}
			else
			{
				GameObject val2 = Object.Instantiate<GameObject>(Plugin.instance.Ass<GameObject>("Assets/Prefabs/Items/Book.prefab"), ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
				typeof(Readable).GetField("content", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(val2.GetComponent<Readable>(), "Hey!\n\nI'm the developer of this mod, and I must say...\n\nHow?\n\nLike, seriously, what was the purpose of all this?\nI made this mod like a way to just spend time on something and not lay in bed all day, and, honestly, why have I gotten so much support for this?\n\nIt's not a mod with an incredible idea, nor it has beautiful visual effects when collecting a secret.\n\nAnd somehow you people have been spending a lot of time on it...\n\nCredits:\nDuviz - Creator of the mod\nAxo - Helped with a lot of clips\nEggsToast - Made the Gaster's hint sound\nDoodles - Made the Gaster's hint sound\n\nYou can now send me an e-mail to [email protected] showing this book while in the pause menu, and I will make sure to add you to the leaderboard in duviz.xyz\n\n\nThank you. You are the reason why I'm still here.");
				typeof(Readable).GetField("instantScan", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(val2.GetComponent<Readable>(), true);
				Log.Info("Spawned credits book", (IEnumerable<Tag>)null, (string)null, (object)null);
			}
		}
	}
	public class GasterListCommand : ICommand, IConsoleLogger
	{
		public Logger Log { get; } = new Logger("Show collected gasters");


		public string Name => "Show collected gasters";

		public string Description => "Modify if already collected gasters should appear or not (on/off)";

		public string Command => "gaster_show_collected";

		public void Execute(Console con, string[] args)
		{
			if (args.Length != 0 && args[0] != "on" && args[0] != "off")
			{
				Log.Info("Argument must be (on/off)", (IEnumerable<Tag>)null, (string)null, (object)null);
				return;
			}
			Log.Info("Gaster show collected set to " + args[0], (IEnumerable<Tag>)null, (string)null, (object)null);
			PlayerPrefs.SetString("Gaster_Show_Collected", args[0]);
			Plugin.showCollected = PlayerPrefs.GetString("Gaster_Show_Collected", "on") == "on";
		}
	}
	public class GasterObsidianCommand : ICommand, IConsoleLogger
	{
		public Logger Log { get; } = new Logger("Gaster transparency");


		public string Name => "Gaster obsidian modifier";

		public string Description => "Makes all gasters obsidian until the game closes";

		public string Command => "gaster_obsidian";

		public void Execute(Console con, string[] args)
		{
			foreach (Gaster gaster in Plugin.instance.gasters)
			{
				gaster.isObsidian = true;
			}
			Log.Info("Made every gaster obsidian (it's not visual, you have to collect them, trust \ud83e\udd1e)", (IEnumerable<Tag>)null, (string)null, (object)null);
		}
	}
	public class GasterPlayerPrefsCommand : ICommand, IConsoleLogger
	{
		public Logger Log { get; } = new Logger("Gaster save prefix");


		public string Name => "Gaster save prefix";

		public string Description => "Modify the PlayerPrefs prefix of Gasters (<string>/Gaster | requires restart)";

		public string Command => "gaster_savefileprefix";

		public void Execute(Console con, string[] args)
		{
			string text = "";
			if (args[0] != null)
			{
				text = args[0];
			}
			Log.Info("Gaster save file prefix set to " + text + " (restart the game) (to go back use Gaster as argument)", (IEnumerable<Tag>)null, (string)null, (object)null);
			PlayerPrefs.SetString("Gaster_Save", text);
		}
	}
	public class GasterTransparencyCommand : ICommand, IConsoleLogger
	{
		public Logger Log { get; } = new Logger("Gaster transparency");


		public string Name => "Gaster transparency";

		public string Description => "Modify the transparency of gasters (transparent/opaque)";

		public string Command => "gaster_transparency";

		public void Execute(Console con, string[] args)
		{
			if (args.Length != 0 && args[0] != "transparent" && args[0] != "opaque")
			{
				Log.Info("Argument must be (transparent/opaque)", (IEnumerable<Tag>)null, (string)null, (object)null);
				return;
			}
			Log.Info("Gaster transparency set to " + args[0] + " (restart the game)", (IEnumerable<Tag>)null, (string)null, (object)null);
			PlayerPrefs.SetString("Gaster_Transparent", args[0]);
		}
	}
	public class GasterRemixCommand : ICommand, IConsoleLogger
	{
		public Logger Log { get; } = new Logger("Gaster remix");


		public string Name => "Gaster remix";

		public string Description => "Toggles between the normal gaster hint sound with a remix sound (on/off | requires restart)";

		public string Command => "gaster_remix";

		public void Execute(Console con, string[] args)
		{
			if (args.Length != 0 && args[0] != "on" && args[0] != "off")
			{
				Log.Info("Argument must be (on/off)", (IEnumerable<Tag>)null, (string)null, (object)null);
				return;
			}
			Log.Info("Gaster remix " + args[0] + ", make sure to restart your game", (IEnumerable<Tag>)null, (string)null, (object)null);
			PlayerPrefs.SetString("Gaster_Ambience_Remix", args[0]);
		}
	}
}
namespace UltrakillStupid.Scripts
{
	internal class GasterAudioController : MonoBehaviour
	{
		private AudioSource audioSource;

		public float maxDistance = 50f;

		public float minDistance = 40f;

		public bool forceOn;

		public void Start()
		{
			audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			audioSource.loop = true;
			audioSource.volume = 0f;
			audioSource.playOnAwake = false;
			audioSource.clip = null;
		}

		public void Update()
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Plugin.gasterAmbienceSfx != (Object)null && (Object)(object)audioSource.clip == (Object)null)
			{
				audioSource.clip = Plugin.gasterAmbienceSfx;
			}
			if ((Object)(object)audioSource.clip == (Object)null)
			{
				return;
			}
			audioSource.volume = MonoSingleton<AudioMixerController>.Instance.sfxVolume;
			if (PointsButton.hintActive || forceOn)
			{
				if (!audioSource.isPlaying)
				{
					audioSource.Play();
				}
			}
			else if (audioSource.isPlaying)
			{
				audioSource.Stop();
			}
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				audioSource.volume = (maxDistance - Mathf.Max(Vector3.Distance(((Component)this).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position) - minDistance, 0f)) / maxDistance;
			}
		}
	}
	public class GasterRequirements : MonoBehaviour
	{
		public Gaster gaster;

		private bool requiresPRank;

		private bool hasSpawnedMessage;

		private MeshRenderer mr;

		private BoxCollider col;

		public void Start()
		{
			mr = ((Component)this).GetComponent<MeshRenderer>();
			col = ((Component)this).GetComponent<BoxCollider>();
			requiresPRank = gaster.requiresPRank;
		}

		public void Update()
		{
			if (requiresPRank)
			{
				SetVisibility(IsPRank());
				if (!hasSpawnedMessage && IsPRank())
				{
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Something has summoned...", "", "", 0, false, false, true);
					hasSpawnedMessage = true;
				}
			}
		}

		private bool IsPRank()
		{
			string ranks = MonoSingleton<StatsManager>.Instance.GetRanks(MonoSingleton<StatsManager>.Instance.timeRanks, MonoSingleton<StatsManager>.Instance.seconds, true, false);
			string ranks2 = MonoSingleton<StatsManager>.Instance.GetRanks(MonoSingleton<StatsManager>.Instance.killRanks, (float)MonoSingleton<StatsManager>.Instance.kills, false, false);
			string ranks3 = MonoSingleton<StatsManager>.Instance.GetRanks(MonoSingleton<StatsManager>.Instance.styleRanks, (float)MonoSingleton<StatsManager>.Instance.stylePoints, false, false);
			if (ranks == "<color=#FF0000>S</color>" && ranks2 == "<color=#FF0000>S</color>")
			{
				return ranks3 == "<color=#FF0000>S</color>";
			}
			return false;
		}

		public void SetVisibility(bool visible)
		{
			((Renderer)mr).enabled = visible;
			((Collider)col).enabled = visible;
		}
	}
	internal class GasterVisualizer : MonoBehaviour
	{
	}
}
namespace UltrakillStupid.Scripts.Triggers
{
	public class EndLevelTrigger : MonoBehaviour
	{
		public void OnTriggerEnter(Collider other)
		{
			if (!(((Component)other).tag != "Player"))
			{
				SceneHelper.SpawnFinalPitAndFinish();
			}
		}
	}
	internal class GasterTrigger : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <WaitTillEndOfLevelOrPlayerDeath>d__6 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GasterTrigger <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitTillEndOfLevelOrPlayerDeath>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Expected O, but got Unknown
				//IL_00e7: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				GasterTrigger gasterTrigger = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					gasterTrigger.gaster.OnTouch.Invoke();
					gasterTrigger.collecting = true;
					collectingObsidian = true;
					gasterTrigger.restarts = MonoSingleton<StatsManager>.Instance.restarts;
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Carry it until the end.", "", "", 0, false, false, true);
					MonoSingleton<TimeController>.Instance.ParryFlash();
					((Component)gasterTrigger).GetComponent<GasterRequirements>().SetVisibility(visible: false);
					if ((Object)(object)Plugin.instance.vignetteTex != (Object)null)
					{
						Color[] array = Plugin.instance.vignetteTex.GetPixels().ToArray();
						for (int i = 0; i < array.Length; i++)
						{
							array[i] *= (gasterTrigger.gaster.displayColor.HasValue ? gasterTrigger.gaster.displayColor.Value : Color.white);
							if (gasterTrigger.gaster.isWeird)
							{
								array[i] = new Color(array[i].r, array[i].g, array[i].b, Mathf.Clamp(array[i].a - 0.2f, 0f, 1f));
							}
						}
						Plugin.instance.tintedVignetteTex.SetPixels(array);
						Plugin.instance.tintedVignetteTex.Apply();
						Plugin.instance.showVignette = true;
					}
					goto IL_01cb;
				case 1:
					<>1__state = -1;
					if (!gasterTrigger.gaster.isWeird)
					{
						MonoSingleton<NewMovement>.Instance.modNoJump = true;
						MonoSingleton<NewMovement>.Instance.modNoDashSlide = true;
					}
					goto IL_01cb;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_01cb:
					if (!MonoSingleton<NewMovement>.Instance.dead && MonoSingleton<StatsManager>.Instance.restarts == gasterTrigger.restarts && !GameStateManager.Instance.IsStateActive("pit-falling"))
					{
						<>2__current = (object)new WaitForEndOfFrame();
						<>1__state = 1;
						return true;
					}
					if (MonoSingleton<NewMovement>.Instance.dead || MonoSingleton<StatsManager>.Instance.restarts != gasterTrigger.restarts)
					{
						MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Bad luck.", "", "", 0, false, false, true);
						Plugin.popupSfx.Play();
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					break;
				}
				if (GameStateManager.Instance.IsStateActive("pit-falling"))
				{
					string[] array2 = new string[3] { "boy", "girl", "dog" };
					string text = "job";
					if (Random.Range(0, 100) == 0)
					{
						text = array2[Random.Range(0, array2.Length)];
					}
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Good " + text + ".", "", "", 0, false, false, true);
					gasterTrigger.TriggerGaster();
				}
				MonoSingleton<NewMovement>.Instance.modNoJump = false;
				MonoSingleton<NewMovement>.Instance.modNoDashSlide = false;
				gasterTrigger.collecting = false;
				collectingObsidian = false;
				Plugin.instance.showVignette = false;
				((Component)gasterTrigger).GetComponent<GasterRequirements>().SetVisibility(visible: true);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public Gaster gaster;

		private bool collecting;

		public static bool collectingObsidian;

		private int restarts;

		public void OnTriggerEnter(Collider other)
		{
			if (((Component)other).tag != "Player" || gaster.cosmeticOnly || collecting)
			{
				return;
			}
			if (gaster.isObsidian)
			{
				if (!collectingObsidian)
				{
					((MonoBehaviour)this).StartCoroutine(WaitTillEndOfLevelOrPlayerDeath());
				}
			}
			else
			{
				TriggerGaster();
			}
		}

		public void OnDestroy()
		{
			collecting = false;
			collectingObsidian = false;
			Plugin.instance.showVignette = false;
		}

		[IteratorStateMachine(typeof(<WaitTillEndOfLevelOrPlayerDeath>d__6))]
		public IEnumerator WaitTillEndOfLevelOrPlayerDeath()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitTillEndOfLevelOrPlayerDeath>d__6(0)
			{
				<>4__this = this
			};
		}

		public void TriggerGaster()
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (gaster.increasesDailyCount && !gaster.IsCollected())
			{
				PlayerPrefs.SetInt(PlayerPrefsInformation.DailyCount(), PlayerPrefs.GetInt(PlayerPrefsInformation.DailyCount(), 0) + 1);
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage($"Daily gasters count: {PlayerPrefs.GetInt(PlayerPrefsInformation.DailyCount())}", "", "", 0, false, false, true);
			}
			Plugin.gasterPopupAlpha = (gaster.IsCollected() ? 0.5f : 1f);
			gaster.SetCollected();
			Plugin.gasterPopupStage = 1;
			Plugin.popupSfx.Play();
			Plugin.forcedColor = gaster.displayColor;
			((Component)this).transform.position = new Vector3(0f, 2000f, 0f);
			((Component)this).gameObject.SetActive(false);
			MonoSingleton<TimeController>.Instance.ParryFlash();
			PointsButton.DisableHint();
			gaster.OnCollect.Invoke();
		}
	}
}
namespace UltrakillStupid.Patches
{
	[HarmonyPatch(typeof(HudMessage))]
	[HarmonyPatch("Start")]
	internal class HudMessagePatch
	{
		public static bool Prefix(HudMessage __instance)
		{
			if (((Object)__instance).name == "Hint 1" && __instance.message == "Something wicked this way comes." && ((Object)((Component)__instance).transform.parent.GetChild(3)).name == "Hint 2")
			{
				__instance.message = "Collect my gasters.";
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HudOpenEffect))]
	[HarmonyPatch("Awake")]
	internal class HudOpenEffectPatch
	{
		public static bool Prefix(HudOpenEffect __instance)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)__instance).name == "Quit Mission")
			{
				GameObject obj = Object.Instantiate<GameObject>(((Component)__instance).gameObject, ((Component)__instance).transform.parent);
				obj.AddComponent<CommunityGasterButton>();
				obj.transform.position = new Vector3(960f, 175f, 0f);
			}
			if (((Object)__instance).name == "SandboxButton")
			{
				Object.Instantiate<GameObject>(((Component)__instance).gameObject, ((Component)__instance).transform.parent).AddComponent<PointsButton>();
				Object.Instantiate<GameObject>(((Component)__instance).gameObject, ((Component)__instance).transform.parent).AddComponent<SellButton>();
				((Component)__instance).gameObject.SetActive(false);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(LeaderboardController))]
	[HarmonyPatch("SubmitLevelScore")]
	internal class LeaderboardControllerPatch
	{
		public static bool Prefix(string levelName, int difficulty, float seconds, int kills, int style, int restartCount, bool pRank = false)
		{
			return true;
		}
	}
}
namespace UltrakillStupid.Classes
{
	public class BundlesManager : MonoBehaviour
	{
		public static AssetBundle gasterBundle;

		public void Awake()
		{
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = "UltrakillStupid.Assets.gasterassets";
			using Stream stream = executingAssembly.GetManifestResourceStream(text);
			if (stream == null)
			{
				Plugin.LogError("Embedded resource '" + text + "' not found!");
				return;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			gasterBundle = AssetBundle.LoadFromMemory(array);
			if ((Object)(object)gasterBundle != (Object)null)
			{
				Plugin.LogInfo("Loaded embedded AssetBundle!");
			}
			else
			{
				Plugin.LogError("Failed to load AssetBundle from memory!");
			}
			SetupAssets();
		}

		public void SetupAssets()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			if ((Object)(object)gasterBundle == (Object)null)
			{
				Plugin.LogError("Gaster AssetBundle is null, cannot set up assets.");
				return;
			}
			Plugin.instance.vignetteTex = gasterBundle.LoadAsset<Texture2D>("vignette.png");
			Plugin.instance.tintedVignetteTex = new Texture2D(((Texture)Plugin.instance.vignetteTex).width, ((Texture)Plugin.instance.vignetteTex).height);
			Plugin.instance.popupTex = (Texture)(object)gasterBundle.LoadAsset<Texture2D>("gasterPopup.png");
			Plugin.instance.fadeTex = (Texture)(object)gasterBundle.LoadAsset<Texture2D>("fade.png");
			Plugin.instance.gasterTex = gasterBundle.LoadAsset<Texture2D>("gaster.png");
			Plugin.instance.popupTex.filterMode = (FilterMode)0;
			Plugin.instance.fadeTex.filterMode = (FilterMode)0;
			Plugin.popupSfx.clip = gasterBundle.LoadAsset<AudioClip>("alert.ogg");
			Plugin.gasterAmbienceSfx = gasterBundle.LoadAsset<AudioClip>((PlayerPrefs.GetString("Gaster_Ambience_Remix") == "on") ? "gaster_ambience.ogg" : "gaster_remix.ogg");
		}

		public void OnDestroy()
		{
			AssetBundle obj = gasterBundle;
			if (obj != null)
			{
				obj.Unload(false);
			}
		}
	}
	internal class CommunityGasterButton : MonoBehaviour
	{
		public static CommunityGasterButton instance;

		public static bool spawnedGaster;

		public TMP_Text childText;

		public Button button;

		public void Awake()
		{
			instance = this;
		}

		public void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			childText = ((Component)((Component)this).transform.GetChild(0)).GetComponent<TMP_Text>();
			childText.text = "SEND GASTER";
			button = ((Component)this).GetComponent<Button>();
			button.onClick = new ButtonClickedEvent();
			((UnityEventBase)button.onClick).RemoveAllListeners();
			((UnityEvent)button.onClick).AddListener((UnityAction)delegate
			{
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Expected O, but got Unknown
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Expected O, but got Unknown
				if (MonoSingleton<NewMovement>.Instance.activated)
				{
					childText.text = "SEND GASTER";
					GameObject target = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => ((Object)obj).name == "PauseMenuDialogs" && obj.activeInHierarchy));
					if ((Object)(object)target != (Object)null)
					{
						GameObject gameObject = ((Component)target.transform.GetChild(1)).gameObject;
						if ((Object)(object)gameObject != (Object)null)
						{
							GameObject copy = Object.Instantiate<GameObject>(gameObject, target.transform);
							((Component)target.transform.GetChild(0)).gameObject.SetActive(true);
							copy.gameObject.SetActive(true);
							((Component)copy.transform.GetChild(0).GetChild(0)).GetComponent<TMP_Text>().text = "Do you want to send your position and level to a server to be saved as a future gaster position?";
							((Component)copy.transform.GetChild(0).GetChild(1)).GetComponent<TMP_Text>().text = "Please try to keep the community fresh with fun gaster positions";
							((Component)copy.transform.GetChild(0).GetChild(2).GetChild(0)).GetComponent<TMP_Text>().text = "Cancel";
							((Component)copy.transform.GetChild(0).GetChild(3).GetChild(0)).GetComponent<TMP_Text>().text = "Send";
							((Component)copy.transform.GetChild(0).GetChild(3)).GetComponent<Button>().onClick = new ButtonClickedEvent();
							((UnityEvent)((Component)copy.transform.GetChild(0).GetChild(3)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
							{
								SendGaster();
								((Component)target.transform.GetChild(0)).gameObject.SetActive(false);
								Object.Destroy((Object)(object)copy);
							});
						}
					}
				}
			});
		}

		public void Update()
		{
		}

		public void SendGaster()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.instance.CheatsActive())
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Cheats cannot be enabled!", "", "", 0, false, false, true);
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			spawnedGaster = true;
			Gaster gaster = new Gaster(SceneHelper.CurrentScene, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Plugin.instance.CheatsActive(), "", (Color?)new Color(1f, 0.5f, 1f));
			gaster.cosmeticOnly = true;
			gaster.extraRequirement = false;
			string url = "https://duviz.xyz/submitGaster/" + gaster.level.ToString() + "/" + ((object)(Vector3)(ref gaster.position)).ToString() + "/" + gaster.allowCheats;
			((MonoBehaviour)this).StartCoroutine(Plugin.instance.GetStringFromUrl(url, delegate(string str)
			{
				if (str != null && str == "ok cutie <3")
				{
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Gaster sent for tomorrows pool!", "", "", 0, false, false, true);
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				else if (str != null)
				{
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Error: " + str, "", "", 0, false, false, true);
				}
				else
				{
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Error while sending gaster!", "", "", 0, false, false, true);
				}
			}));
		}
	}
	public class Gaster
	{
		public string level;

		public Vector3 position;

		public GameObject instance;

		public bool allowCheats;

		public string displayName = "";

		public Color? displayColor;

		public int difficultyExclusive = -1;

		public bool cosmeticOnly;

		public bool extraRequirement = true;

		public bool increasesDailyCount;

		public bool requiresPRank;

		public bool isObsidian;

		public bool isWeird;

		public bool saveInPlayerPrefs = true;

		private bool collectedCache;

		private bool hasCachedCollected;

		public UnityEvent OnCollect = new UnityEvent();

		public UnityEvent OnTouch = new UnityEvent();

		public Gaster(string lev, Vector3 pos, bool allowCheats = false, string displayName = "", Color? displayColor = null)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			level = lev;
			position = pos;
			this.allowCheats = allowCheats;
			this.displayName = displayName;
			if (displayName == "")
			{
				this.displayName = level.Replace("Level ", "");
			}
			this.displayColor = displayColor;
		}

		public bool IsCollected()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (!hasCachedCollected)
			{
				bool result = PlayerPrefs.GetInt($"{PlayerPrefsInformation.GasterPrefix}_{PlayerPrefsInformation.CollectedPrefix}_{level}_{position}") == 1 || cosmeticOnly;
				hasCachedCollected = true;
				collectedCache = result;
				return result;
			}
			return collectedCache;
		}

		public bool ForceIsCollectedAndIgnoreCosmetic()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerPrefs.GetInt($"{PlayerPrefsInformation.GasterPrefix}_{PlayerPrefsInformation.CollectedPrefix}_{level}_{position}") == 1)
			{
				return !cosmeticOnly;
			}
			return false;
		}

		public void SetCollected(int collected = 1)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (saveInPlayerPrefs)
			{
				PlayerPrefs.SetInt($"{PlayerPrefsInformation.GasterPrefix}_{PlayerPrefsInformation.CollectedPrefix}_{level}_{position}", collected);
				hasCachedCollected = false;
				collectedCache = collected == 1 || cosmeticOnly;
			}
		}
	}
	internal class GasterMenuButton : MonoBehaviour
	{
		public void Update()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)((Component)this).GetComponent<RawImage>()).color = new Color(1f, 1f, 1f, 0.4f);
			if (RectTransformUtility.RectangleContainsScreenPoint(((Component)((Component)this).transform.parent).GetComponent<RectTransform>(), Vector2.op_Implicit(Input.mousePosition)))
			{
				((Graphic)((Component)this).GetComponent<RawImage>()).color = new Color(1f, 1f, 1f, 1f);
			}
		}
	}
	[Serializable]
	public class StringArrayWrapper
	{
		public string[][] items;
	}
	internal class PointsButton : MonoBehaviour
	{
		public static PointsButton instance;

		public static bool hintActive;

		public TMP_Text childText;

		public Button button;

		public ShopButton shopButton;

		public int price = 1000000;

		public string priceText = "1.000.000";

		public void Awake()
		{
			instance = this;
		}

		public void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			childText = ((Component)((Component)this).transform.GetChild(0)).GetComponent<TMP_Text>();
			childText.text = "Buy gaster hint";
			button = ((Component)this).GetComponent<Button>();
			button.onClick = new ButtonClickedEvent();
			((UnityEventBase)button.onClick).RemoveAllListeners();
			shopButton = ((Component)this).GetComponent<ShopButton>();
			shopButton.toActivate = (GameObject[])(object)new GameObject[0];
			shopButton.toDeactivate = (GameObject[])(object)new GameObject[0];
			((UnityEvent)button.onClick).AddListener((UnityAction)delegate
			{
				//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01de: Expected O, but got Unknown
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_0210: Expected O, but got Unknown
				if (hintActive)
				{
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Hint already active!", "", "", 0, false, false, true);
				}
				else if (MonoSingleton<NewMovement>.Instance.activated)
				{
					MonoSingleton<OptionsManager>.Instance.Pause();
					GameObject target = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => ((Object)obj).name == "PauseMenuDialogs" && obj.activeInHierarchy));
					if ((Object)(object)target != (Object)null)
					{
						GameObject gameObject = ((Component)target.transform.GetChild(1)).gameObject;
						if ((Object)(object)gameObject != (Object)null)
						{
							GameObject copy = Object.Instantiate<GameObject>(gameObject, target.transform);
							((Component)target.transform.GetChild(0)).gameObject.SetActive(true);
							copy.gameObject.SetActive(true);
							((Component)copy.transform.GetChild(0).GetChild(0)).GetComponent<TMP_Text>().text = "Do you want to pay " + priceText + " P to make gasters sound?";
							((Component)copy.transform.GetChild(0).GetChild(1)).GetComponent<TMP_Text>().text = "This event will stay active until another gaster is collected. You have " + MoneyText.DivideMoney(GameProgressSaver.GetMoney()) + " P.";
							((Component)copy.transform.GetChild(0).GetChild(2).GetChild(0)).GetComponent<TMP_Text>().text = "Cancel";
							((Component)copy.transform.GetChild(0).GetChild(3).GetChild(0)).GetComponent<TMP_Text>().text = "Buy";
							((Component)copy.transform.GetChild(0).GetChild(3)).GetComponent<Button>().onClick = new ButtonClickedEvent();
							((UnityEvent)((Component)copy.transform.GetChild(0).GetChild(3)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
							{
								BuyHint();
								((Component)target.transform.GetChild(0)).gameObject.SetActive(false);
								Object.Destroy((Object)(object)copy);
							});
						}
					}
				}
			});
		}

		public void Update()
		{
		}

		public void BuyHint()
		{
			if (GameProgressSaver.GetMoney() < price)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Not enough Points!", "", "", 0, false, false, true);
				return;
			}
			GameProgressSaver.AddMoney(-price);
			hintActive = true;
			PlayerPrefs.SetInt("Gaster_Hint", 1);
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Bought hint! You will know when a gaster is near!", "", "", 0, false, false, true);
		}

		public static void ClearEvent(object target, string eventName)
		{
			FieldInfo field = target.GetType().GetField(eventName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(target, null);
			}
		}

		public static void DisableHint()
		{
			if (hintActive)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Hint used!", "", "", 0, false, false, true);
			}
			hintActive = false;
			PlayerPrefs.SetInt("Gaster_Hint", 0);
		}
	}
	internal class SellButton : MonoBehaviour
	{
		public static SellButton instance;

		public TMP_Text childText;

		public Button button;

		public ShopButton shopButton;

		public int pricePerGaster = 150000;

		public string pricePerGasterText = "150.000";

		public void Awake()
		{
			instance = this;
		}

		public void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			childText = ((Component)((Component)this).transform.GetChild(0)).GetComponent<TMP_Text>();
			childText.text = "Sell gasters";
			button = ((Component)this).GetComponent<Button>();
			button.onClick = new ButtonClickedEvent();
			((UnityEventBase)button.onClick).RemoveAllListeners();
			shopButton = ((Component)this).GetComponent<ShopButton>();
			shopButton.toActivate = (GameObject[])(object)new GameObject[0];
			shopButton.toDeactivate = (GameObject[])(object)new GameObject[0];
			((UnityEvent)button.onClick).AddListener((UnityAction)delegate
			{
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d9: Expected O, but got Unknown
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Expected O, but got Unknown
				if (PlayerPrefs.GetInt(PlayerPrefsInformation.DailyCount()) == 0)
				{
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("No daily gasters to sell!", "", "", 0, false, false, true);
				}
				else if (MonoSingleton<NewMovement>.Instance.activated)
				{
					MonoSingleton<OptionsManager>.Instance.Pause();
					GameObject target = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => ((Object)obj).name == "PauseMenuDialogs" && obj.activeInHierarchy));
					if ((Object)(object)target != (Object)null)
					{
						GameObject gameObject = ((Component)target.transform.GetChild(1)).gameObject;
						if ((Object)(object)gameObject != (Object)null)
						{
							GameObject copy = Object.Instantiate<GameObject>(gameObject, target.transform);
							((Component)target.transform.GetChild(0)).gameObject.SetActive(true);
							copy.gameObject.SetActive(true);
							((Component)copy.transform.GetChild(0).GetChild(0)).GetComponent<TMP_Text>().text = $"Do you want to sell your daily gasters ({PlayerPrefs.GetInt(PlayerPrefsInformation.DailyCount())}) for {pricePerGasterText} P each?";
							((Component)copy.transform.GetChild(0).GetChild(1)).GetComponent<TMP_Text>().text = "This will reset your daily gasters count.";
							((Component)copy.transform.GetChild(0).GetChild(2).GetChild(0)).GetComponent<TMP_Text>().text = "Cancel";
							((Component)copy.transform.GetChild(0).GetChild(3).GetChild(0)).GetComponent<TMP_Text>().text = "Sell";
							((Component)copy.transform.GetChild(0).GetChild(3)).GetComponent<Button>().onClick = new ButtonClickedEvent();
							((UnityEvent)((Component)copy.transform.GetChild(0).GetChild(3)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
							{
								BuyHint();
								((Component)target.transform.GetChild(0)).gameObject.SetActive(false);
								Object.Destroy((Object)(object)copy);
							});
						}
					}
				}
			});
		}

		public void Update()
		{
		}

		public void BuyHint()
		{
			int num = 0;
			num = pricePerGaster * PlayerPrefs.GetInt(PlayerPrefsInformation.DailyCount());
			GameProgressSaver.AddMoney(num);
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage($"Sold {PlayerPrefs.GetInt(PlayerPrefsInformation.DailyCount())} daily gasters for {StatsManager.DivideMoney(num)}!", "", "", 0, false, false, true);
			PlayerPrefs.SetInt(PlayerPrefsInformation.DailyCount(), 0);
		}

		public static void ClearEvent(object target, string eventName)
		{
			FieldInfo field = target.GetType().GetField(eventName, BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(target, null);
			}
		}
	}
	public static class Information
	{
		public const string GUID = "duviz.ultrakill.findthegaster";

		public const string Name = "Find the Gaster";

		public const string Version = "0.3.5";
	}
	internal static class PlayerPrefsInformation
	{
		public static string GasterPrefix = "Gaster";

		public static string CollectedPrefix = "Collected";

		public static string DailyPrefix = "Daily";

		public static string DailyCount()
		{
			return GasterPrefix + "_" + CollectedPrefix + "_" + DailyPrefix;
		}
	}
}