Decompiled source of StreamIntegration v1.0.0

StreamIntegration.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Newtonsoft.Json.Linq;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using SettingsMenu.Components.Pages;
using StreamIntegration.CrowdControl;
using StreamIntegration.Events;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CancerousInfection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CancerousInfection")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8777c72d-9251-4bef-bfd4-241d33975141")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StreamIntegration
{
	public class Bolder : MonoBehaviour
	{
		public TextMeshProUGUI text;

		public void Bold(bool value)
		{
			if (value)
			{
				((TMP_Text)text).fontStyle = (FontStyles)1;
			}
			else
			{
				((TMP_Text)text).fontStyle = (FontStyles)0;
			}
		}
	}
	public class PercentageCalculator : MonoBehaviour
	{
		public Event refEvent;

		public TextMeshProUGUI text;

		public string color = ColorUtility.ToHtmlStringRGBA(Plug.GetBrighterPlatformColor());

		public float currentPercent = 0f;

		public void UpdateVotePercentage(int totalVotes)
		{
			currentPercent = Mathf.Lerp(currentPercent, (float)refEvent.Votes / (float)totalVotes * 100f, 5f * Time.deltaTime);
			((TMP_Text)text).text = (refEvent.RequireOneHundredPercent ? (refEvent.Name + "\n<color=orange>(Requires 100%)</color>\n<color=#" + color + ">(" + currentPercent.ToString("F0") + "%)") : (refEvent.Name + "\n<color=#" + color + ">(" + currentPercent.ToString("F0") + "%)"));
		}
	}
	public enum KeyType
	{
		Letter,
		Number,
		Mixed
	}
	[BepInPlugin("com.d1g1tal.streamint", "StreamIntegration", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plug : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static OnClick <>9__53_0;

			internal void <Awake>b__53_0()
			{
				DisconnectFromTwitch(silent: false);
			}
		}

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

			private object <>2__current;

			public TextMeshProUGUI text1;

			public TextMeshProUGUI text2;

			public Plug <>4__this;

			private string <connected>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					<connected>5__1 = null;
					break;
				}
				if (SceneHelper.CurrentScene != "Main Menu")
				{
					return false;
				}
				<connected>5__1 = ((ConnectedPlatform == string.Empty) ? "<color=red>NULL</color>" : ("<color=#" + ColorUtility.ToHtmlStringRGBA(GetPlatformColor()) + ">" + ConnectedPlatform.ToUpper() + "</color>"));
				if ((Object)(object)text1 != (Object)null)
				{
					((TMP_Text)text1).text = "<mark=#000000>SYSTEM V1 INITIALIZED\r\nDIAGNOSTICS...OK\r\nCONNECTED STREAM..." + <connected>5__1 + "\r\nSTANDBY - WAIT FOR WAKE";
				}
				if ((Object)(object)text2 != (Object)null)
				{
					((TMP_Text)text2).text = "SYSTEM V1 INITIALIZED\r\nDIAGNOSTICS...OK\r\nCONNECTED STREAM..." + <connected>5__1 + "\r\nSTANDBY - WAIT FOR WAKE";
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}

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

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

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

			private object <>2__current;

			public Plug <>4__this;

			private TextMeshProUGUI <text1>5__1;

			private TextMeshProUGUI <text2>5__2;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<text1>5__1 = null;
				<text2>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<text1>5__1 = null;
					<text2>5__2 = null;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if ((Object)(object)<text2>5__2 == (Object)null)
				{
					<text2>5__2 = FindTMPSWithKeywordV2("SYSTEM V1 INIT", "<mark=#000000>");
				}
				if ((Object)(object)<text1>5__1 == (Object)null)
				{
					<text1>5__1 = FindTMPSWithKeyword("<mark=#000000>SYSTEM V1 INIT");
				}
				if ((Object)(object)<text1>5__1 != (Object)null && (Object)(object)<text2>5__2 != (Object)null)
				{
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.ConstantUpdateMainMenu(<text1>5__1, <text2>5__2));
					return false;
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}

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

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

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

			private object <>2__current;

			public TextMeshProUGUI text;

			public Plug <>4__this;

			private Exception <e>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Expected O, but got Unknown
				//IL_0214: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					if (!((TMP_Text)text).text.Contains("CHAT MESSAGES"))
					{
						try
						{
							TextMeshProUGUI val = text;
							((TMP_Text)val).text = ((TMP_Text)val).text + "\n\nHeres 5 <color=#6357FF>CHAT MESSAGES</color> about this <color=#FF4343>level</color>: \n" + (string.IsNullOrEmpty(<>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[0]) ? "#1: <color=#FF4343>\"NOT FOUND\"</color>\n" : ("#1: <color=#6357FF><b>\"" + <>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[0] + "\"</color></b>\n")) + (string.IsNullOrEmpty(<>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[1]) ? "#2: <color=#FF4343>\"NOT FOUND\"</color>\n" : ("#2: <color=#6357FF><b>\"" + <>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[1] + "\"</color></b>\n")) + (string.IsNullOrEmpty(<>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[2]) ? "#3: <color=#FF4343>\"NOT FOUND\"</color>\n" : ("#3: <color=#6357FF><b>\"" + <>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[2] + "\"</color></b>\n")) + (string.IsNullOrEmpty(<>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[3]) ? "#4: <color=#FF4343>\"NOT FOUND\"</color>\n" : ("#4: <color=#6357FF><b>\"" + <>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[3] + "\"</color></b>\n")) + (string.IsNullOrEmpty(<>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[4]) ? "#5: <color=#FF4343>\"NOT FOUND\"</color>\n" : ("#5: <color=#6357FF><b>\"" + <>4__this.GetMessagesAboutLevel(SceneHelper.CurrentScene)[4] + "\"</color></b>\n"));
							val = text;
							((TMP_Text)val).text = ((TMP_Text)val).text + "\nHeres a few <b>tips</b> for <b><color=#" + ColorUtility.ToHtmlStringRGBA(GetPlatformColor()) + ">" + ConnectedPlatform + "</color></b> <color=#6357FF>chat,</color>\n\n- You can change your <b>vote</b> by <color=#6357FF>voting another option</color>.\n- <b><color=red>Spamming</color></b> the same <b>option</b> you already <color=#6357FF>voted</color> will <color=red><b>NOT</color></b> add extra <color=#6357FF>votes</color>,\n- Typing a <color=#FF4343>levels name</color> in the <color=#6357FF>chat</color> will popup there in that <color=#FF4343>levels</color> <b>terminal</b>, Like over <b>here!</b>";
						}
						catch (Exception ex)
						{
							<e>5__1 = ex;
							TextMeshProUGUI obj = text;
							((TMP_Text)obj).text = ((TMP_Text)obj).text + "\n\n\nHeres 5 <color=#FF4343>CHAT MESSAGES</color> about this <color=#FF4343>level</color>: \n#1: <color=red>\"ERR\"</color>\n#2</color>: <color=red>\"ERR\"</color>\n#3</color>: <color=red>\"ERR\"</color>\n#4</color>: <color=red>\"ERR\"</color>\n#5</color>: <color=red>\"ERR\"</color>\n";
							ModLog.LogWarning((object)("Something went wrong! " + <e>5__1.Message));
						}
					}
					<>2__current = null;
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					break;
				}
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 1;
				return true;
			}

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

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

		private readonly Harmony harmony = new Harmony("com.d1g1tal.streamint");

		public static ManualLogSource ModLog;

		public static PluginConfigurator PluginConfig = PluginConfigurator.Create("Stream Integration", "com.d1g1tal.streamint");

		public static BoolField tell = new BoolField(PluginConfig.rootPanel, "???", "setuphelp", true);

		public static ConfigPanel youtubePanel = new ConfigPanel(PluginConfig.rootPanel, "YouTube", "youtube.settings");

		public static ConfigPanel twitchPanel = new ConfigPanel(PluginConfig.rootPanel, "Twitch", "twitch.settings");

		public static ConfigPanel chatPanel = new ConfigPanel(PluginConfig.rootPanel, "Chat & Crowd Control", "chat.settings");

		public static ConfigPanel crowdControlPanel = new ConfigPanel(chatPanel, "Crowd Control", "chat.crowdControl.settings");

		public static ConfigPanel eventTestPanel = new ConfigPanel(crowdControlPanel, "Events (SPOILERS)", "chat.crowdControl.events");

		public static ConfigHeader Note = new ConfigHeader(youtubePanel, "Note: API keys can only fetch chat messages, You almost must put the full \"watch?v=\" link in.", 24);

		public static StringField url = new StringField(youtubePanel, "URL", "youtube.url", "PUT LIVE STREAM URL HERE");

		public static ButtonField guide = new ButtonField(youtubePanel, "Open Guide", "youtube.guide");

		public static StringField key = new StringField(youtubePanel, "API key", "youtube.apikey", "GET API KEY FROM GUIDE");

		public static ButtonField youtubeC = new ButtonField(youtubePanel, "Connect", "youtube.connect");

		public static ButtonField youtubeD = new ButtonField(youtubePanel, "Disconnect", "youtube.disconnect");

		public static BoolField emojis = new BoolField(youtubePanel, "Announce youtube emojis as a style bonus", "youtube.emojis", true);

		public static StringField keyword = new StringField(chatPanel, "Must read keyword", "chat.keyword", "!s");

		public static BoolField read = new BoolField(chatPanel, "Display messages", "chat.display", false);

		public static BoolField logAll = new BoolField(chatPanel, "Log all chat messages", "chat.logall", false);

		public static BoolField chatBosses = new BoolField(chatPanel, "Change boss names to live chat names", "chat.boss", true);

		public static ConfigHeader VotingSection = new ConfigHeader(crowdControlPanel, "Crowd Control Voting", 24);

		public static BoolField crowdControlOn = new BoolField(crowdControlPanel, "Voting enabled", "chat.crowdControl.voting", true);

		public static FloatField waitTime = new FloatField(crowdControlPanel, "Voting wait time", "chat.crowdControl.voteWaitTime", 5f);

		public static FloatField voteTime = new FloatField(crowdControlPanel, "Voting duration", "chat.crowdControl.voteDuration", 30f);

		public static FloatField enablingEventTime = new FloatField(crowdControlPanel, "Time before event enables", "chat.crowdControl.enablingTime", 5f);

		public static FloatField restartTime = new FloatField(crowdControlPanel, "Time before voting again", "chat.crowdControl.votingAgainTime", 45f);

		public static ConfigHeader Chatting = new ConfigHeader(crowdControlPanel, "Voting Options", 24);

		public static EnumField<KeyType> keyType = new EnumField<KeyType>(crowdControlPanel, "Voting key type", "chat.crowdControl.keyType", KeyType.Mixed);

		public static IntField minAmount = new IntField(crowdControlPanel, "Minimum amount of options", "chat.crowdControl.minOp", 3);

		public static IntField maxAmount = new IntField(crowdControlPanel, "Maximum amount of options", "chat.crowdControl.maxOp", 4);

		public static StringField channel = new StringField(twitchPanel, "Twitch channel", "twitch.channel", "PUT TWITCH CHANNEL HERE");

		public static StringField token = new StringField(twitchPanel, "Token", "twitch.token", "PUT TOKEN HERE");

		public static ButtonField connect = new ButtonField(twitchPanel, "Connect", "twitch.connect");

		public static ButtonField disconnect = new ButtonField(twitchPanel, "Disconnect", "twitch.disconnect");

		public static ConfigHeader howToToken = new ConfigHeader(twitchPanel, "Find the 'access_token=' in the url of the redirected page, That will be the token you can use", 24);

		public static ButtonField getToken = new ButtonField(twitchPanel, "Get Token", "twitch.gettoken");

		public static StreamMessageGetter s;

		public static bool youtubeConnected;

		public static bool twitchConnected;

		public static bool connected = youtubeConnected || twitchConnected || (youtubeConnected && twitchConnected);

		public static bool CrowdControlEnabled;

		public static GameObject GameModifierPanel;

		public static GameObject ModifierVotePanel;

		public static GameObject ModifierWarningPanel;

		public static GameObject ModifierCurrentEnabled;

		public static string[] EnemyPaths;

		public static bool AutoCreate = false;

		public static bool HasVotingBeenOn = false;

		public static string ConnectedPlatform;

		public static Plug Instance { get; private set; }

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			SceneManager.sceneLoaded += OnSceneLoaded;
			guide.onClick += new OnClick(TutorialURLOpen);
			youtubeC.onClick += new OnClick(ConnectToYoutube);
			youtubeD.onClick += new OnClick(DisconnectFromYoutube);
			connect.onClick += new OnClick(ConnectToTwitch);
			ButtonField obj = disconnect;
			object obj2 = <>c.<>9__53_0;
			if (obj2 == null)
			{
				OnClick val = delegate
				{
					DisconnectFromTwitch(silent: false);
				};
				<>c.<>9__53_0 = val;
				obj2 = (object)val;
			}
			obj.onClick += (OnClick)obj2;
			getToken.onClick += new OnClick(AuthUserPage);
			ModLog = Logger.CreateLogSource("Stream Integration");
			PluginConfig.SetIconWithURL("file://" + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "icon.png"));
			harmony.PatchAll();
			((ConfigField)tell).hidden = true;
		}

		public static void CreatePanel()
		{
			if (MonoSingleton<NewMovement>.Instance.activated && crowdControlOn.value && (Object)(object)GameModifierPanel.GetComponent<VotingPanel>() == (Object)null && connected)
			{
				((Behaviour)GameObjectExtensions.GetOrAddComponent<VotingPanel>(GameModifierPanel)).enabled = true;
				HasVotingBeenOn = true;
			}
		}

		public static void UpdateAllTexts(Text t, bool autoSize)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: 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_0149: Unknown result type (might be due to invalid IL or missing references)
			TMP_FontAsset val = null;
			Material val2 = null;
			if ((Object)(object)MonoSingleton<OptionsManager>.Instance.pauseMenu != (Object)null)
			{
				GameObject pauseMenu = MonoSingleton<OptionsManager>.Instance.pauseMenu;
				TextMeshProUGUI component = ((Component)pauseMenu.transform.Find("Text")).GetComponent<TextMeshProUGUI>();
				val = ((TMP_Text)component).font;
				val2 = ((TMP_Text)component).fontMaterial;
			}
			if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)t != (Object)null)
			{
				GameObject gameObject = ((Component)t).gameObject;
				string text = t.text;
				int fontSize = t.fontSize;
				FontStyle fontStyle = t.fontStyle;
				Color color = ((Graphic)t).color;
				TextAnchor alignment = t.alignment;
				bool maskable = ((MaskableGraphic)t).maskable;
				HorizontalWrapMode horizontalOverflow = t.horizontalOverflow;
				VerticalWrapMode verticalOverflow = t.verticalOverflow;
				Object.DestroyImmediate((Object)(object)t);
				TextMeshProUGUI val3 = gameObject.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val3).SetText(text, true);
				((TMP_Text)val3).font = val;
				((TMP_Text)val3).fontMaterial = val2;
				((TMP_Text)val3).fontSize = fontSize;
				((TMP_Text)val3).enableWordWrapping = true;
				if (autoSize)
				{
					((TMP_Text)val3).enableAutoSizing = autoSize;
					((TMP_Text)val3).fontSizeMax = 21f;
				}
				((TMP_Text)val3).overflowMode = ConvertWrapMode(horizontalOverflow, verticalOverflow);
				((TMP_Text)val3).fontStyle = ConvertStyle(fontStyle);
				((Graphic)val3).color = color;
				((TMP_Text)val3).alignment = ConvertAnchor(alignment);
				((MaskableGraphic)val3).maskable = maskable;
			}
		}

		public static TextAlignmentOptions ConvertAnchor(TextAnchor anchor)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected I4, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			return (TextAlignmentOptions)((int)anchor switch
			{
				0 => 257, 
				2 => 260, 
				6 => 1025, 
				8 => 1028, 
				7 => 1026, 
				1 => 258, 
				3 => 513, 
				5 => 516, 
				4 => 514, 
				_ => 514, 
			});
		}

		public static TextOverflowModes ConvertWrapMode(HorizontalWrapMode horizontal, VerticalWrapMode vertical)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_003c: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)horizontal == 0 && (int)vertical == 0)
			{
				return (TextOverflowModes)3;
			}
			if ((int)horizontal == 1 && (int)vertical == 1)
			{
				return (TextOverflowModes)0;
			}
			if ((int)horizontal == 1 && (int)vertical == 0)
			{
				return (TextOverflowModes)3;
			}
			if ((int)horizontal == 0 && (int)vertical == 1)
			{
				return (TextOverflowModes)0;
			}
			return (TextOverflowModes)3;
		}

		public static FontStyles ConvertStyle(FontStyle style)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected I4, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			return (FontStyles)((int)style switch
			{
				0 => 0, 
				1 => 1, 
				2 => 2, 
				3 => 512, 
				_ => 0, 
			});
		}

		private void Start()
		{
			RegisterAllEvents();
			EnemyPaths = GetAllEnemies();
		}

		private void RegisterAllEvents()
		{
			EventManager.RegisterEvent("Idoled Mindflayer", SpawnEvents.PlayBM);
			EventManager.RegisterEvent("Idoled Stalker", SpawnEvents.PlayBS);
			EventManager.RegisterEvent("Hitman Sisyphus Prime", SpawnEvents.PlaySP).RequireOneHundredPercent = true;
			EventManager.RegisterEvent("Drone Strike", SpawnEvents.PlayDS);
			EventManager.RegisterEvent("Spawn Random Enemy", SpawnEvents.PlaySRE);
			EventManager.RegisterEvent("Spawn 10 Random Enemies", SpawnEvents.PlaySTRE).RequireOneHundredPercent = true;
			EventManager.RegisterEvent("Radiant All Enemies", EffectEvents.PlayRA);
			EventManager.RegisterEvent("Sandify All Enemies", EffectEvents.PlaySA);
			EventManager.RegisterEvent("Give All Enemies Boss Bars", EffectEvents.PlayBBA);
			EventManager.RegisterEvent("Dual Wield", EffectEvents.PlayDW);
			EventManager.RegisterEvent("X2 Health For All", EffectEvents.PlayHB);
			EventManager.RegisterEvent("You Can Only Run", EffectEvents.PlayYCOR);
			EventManager.RegisterEvent("No More Health", EffectEvents.PlayHD).RequireOneHundredPercent = true;
			EventManager.RegisterEvent("Big Enemies", EffectEvents.PlayBE);
			EventManager.RegisterEvent("Increase Game Speed", EffectEvents.PlayIGS);
			EventManager.RegisterEvent("Decrease Game Speed", EffectEvents.PlayDGS);
			EventManager.RegisterEvent("Small Enemies", EffectEvents.PlaySE);
			EventManager.RegisterEvent("Nuclear Projectiles", EffectEvents.PlayNP);
			EventManager.RegisterEvent("Random Enemy Effects", EffectEvents.PlayRE);
			EventManager.RegisterEvent("Idol All Enemies", EffectEvents.PlayBA);
			EventManager.RegisterEvent("Duplicate All Enemies", EffectEvents.PlayDA);
			EventManager.RegisterEvent("Auto \"Aim\"", EffectEvents.PlayAA).RequireOneHundredPercent = true;
			EventManager.RegisterEvent("Inverted Mouse", EffectEvents.PlayIM);
			EventManager.RegisterEvent("Wide Screen", EffectEvents.PlayWS);
			EventManager.RegisterEvent("Narrow Screen", EffectEvents.PlayNS);
			EventManager.RegisterEvent("Wet Floor", EffectEvents.PlaySG);
			EventManager.RegisterEvent("No Healing", EffectEvents.PlayNH);
			EventManager.RegisterEvent("Become Disabled", EffectEvents.PlayBD).RequireOneHundredPercent = true;
			EventManager.RegisterEvent("Evil Coins", EffectEvents.PlayEC);
			EventManager.RegisterEvent("Fast Enemies", EffectEvents.PlayQE);
			EventManager.RegisterEvent("Strong Enemies", EffectEvents.PlayTE);
			EventManager.RegisterEvent("Earthquake", EffectEvents.PlayEQ);
			EventManager.RegisterEvent("Decrease Movement Speed", EffectEvents.PlaySS);
			EventManager.RegisterEvent("Increase Movement Speed", EffectEvents.PlayFS);
			EventManager.RegisterEvent("Tunnel Vision", EffectEvents.PlayAW);
			EventManager.RegisterEvent("Quake Pro", EffectEvents.PlayQP);
			EventManager.RegisterEvent("Just Pixels...", EffectEvents.PlayJP);
			EventManager.RegisterEvent("Play 5 Random Events", EffectEvents.PlayRFEV).RequireOneHundredPercent = true;
			EventManager.RegisterEvent("Random Event", EffectEvents.PlayREV);
		}

		private void OnSceneLoaded(Scene args, LoadSceneMode args1)
		{
			if (MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0) < 2 && CrowdControlEnabled && SceneHelper.CurrentScene != "Main Menu")
			{
				Log("Hey, your current difficulty is going to interfere with some of the events, Please move to <color=orange>STANDARD</color> or above to play <color=#6357FF>CROWD CONTROL</color>.");
			}
			if (SceneHelper.CurrentScene == "Main Menu")
			{
				((MonoBehaviour)this).StartCoroutine(EditMainMenu());
			}
			AutoCreate = SceneHelper.CurrentScene == "uk_construct" || SceneHelper.CurrentScene == "Level 0-1";
			HasVotingBeenOn = false;
			s = GameObjectExtensions.GetOrAddComponent<StreamMessageGetter>(((Component)this).gameObject);
			s.connectedY = youtubeConnected;
			s.connectedT = twitchConnected;
			EffectEvents.eventToggled = false;
			MonoSingleton<NewMovement>.Instance.walkSpeed = 750f;
			MonoSingleton<NewMovement>.Instance.jumpPower = 90f;
			MonoSingleton<NewMovement>.Instance.wallJumpPower = 150f;
			MonoSingleton<CameraController>.Instance.cam.aspect = 1.7778f;
			MonoSingleton<NewMovement>.Instance.hudCam.GetComponent<Camera>().aspect = 1.7778f;
			EventManager.RefreshAll();
			if (!connected)
			{
				return;
			}
			ShopZone[] array = Object.FindObjectsOfType<ShopZone>(true);
			ShopZone[] array2 = array;
			foreach (ShopZone val in array2)
			{
				try
				{
					GameObject gameObject = ((Component)((Component)val).transform.Find("Canvas").Find("Background").Find("Main Panel")
						.Find("Tip of the Day")).gameObject;
					TextMeshProUGUI component = ((Component)gameObject.transform.Find("Title")).GetComponent<TextMeshProUGUI>();
					TextMeshProUGUI component2 = ((Component)gameObject.transform.Find("Panel").Find("Text Inset").Find("TipText")).GetComponent<TextMeshProUGUI>();
					((TMP_Text)component).text = "Facts of the Day";
					((TMP_Text)component2).fontSize = 10.75f;
					((MonoBehaviour)this).StartCoroutine(UpdateTip(component2));
				}
				catch (NullReferenceException)
				{
					ModLog.LogWarning((object)"Found a not shop terminal, skipping");
				}
			}
		}

		public static TextMeshProUGUI FindTMPSWithKeyword(string keyword)
		{
			TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
			TextMeshProUGUI[] array2 = array;
			foreach (TextMeshProUGUI val in array2)
			{
				if (((TMP_Text)val).text.Contains(keyword))
				{
					return val;
				}
			}
			return null;
		}

		public static TextMeshProUGUI FindTMPSWithKeywordV2(string keyword, string cantContain)
		{
			TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
			TextMeshProUGUI[] array2 = array;
			foreach (TextMeshProUGUI val in array2)
			{
				if (((TMP_Text)val).text.Contains(keyword) && !((TMP_Text)val).text.Contains(cantContain))
				{
					return val;
				}
			}
			return null;
		}

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

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

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

		public string[] GetMessagesAboutLevel(string level)
		{
			if (level.Contains("Level"))
			{
				level = level.Replace("Level ", "").Trim();
			}
			if (level == "Endless")
			{
				level = "Cybergrind";
			}
			if (level == "uk_construct")
			{
				level = "Sandbox";
			}
			List<string> list = new List<string>();
			foreach (string item in StreamMessageGetter.chatMessagesY)
			{
				if ((item != null && item.ToLower().Contains(level.ToLower()) && !list.Contains(item)) || (item != null && item.ToLower().Contains("gm_construct") && level == "Sandbox" && !list.Contains(item)))
				{
					list.Add(item);
				}
			}
			foreach (string item2 in StreamMessageGetter.rawMessagesT)
			{
				if ((item2 != null && item2.ToLower().Contains(level.ToLower()) && !list.Contains(item2)) || (item2 != null && item2.ToLower().Contains("gm_construct") && level == "Sandbox" && !list.Contains(item2)))
				{
					list.Add(item2);
				}
			}
			if (list.Count < 5)
			{
				while (list.Count < 5)
				{
					list.Add("");
				}
			}
			return list.ToArray();
		}

		private string[] GetAllEnemies()
		{
			List<string> list = new List<string>();
			EnemyIdentifier[] array = Resources.FindObjectsOfTypeAll<EnemyIdentifier>();
			foreach (EnemyIdentifier val in array)
			{
				if (!(((Object)val).name == "Body"))
				{
					list.Add(((Object)val).name + ".prefab");
				}
			}
			return list.ToArray();
		}

		public void Update()
		{
			try
			{
				if (EnemyPaths.Length == 0)
				{
					EnemyPaths = GetAllEnemies();
				}
				ConnectedPlatform = ((s.connectedY && !s.connectedT) ? "YouTube" : ((s.connectedT && !s.connectedY) ? "Twitch" : ((s.connectedY && s.connectedT) ? "YouTube & Twitch" : "")));
				s = GameObjectExtensions.GetOrAddComponent<StreamMessageGetter>(((Component)this).gameObject);
				connected = youtubeConnected || twitchConnected || (youtubeConnected && twitchConnected);
				GameObjectExtensions.GetOrAddComponent<SpawnEvents>(((Component)this).gameObject);
				CrowdControlEnabled = connected && crowdControlOn.value;
				GameObjectExtensions.GetOrAddComponent<EffectEvents>(((Component)this).gameObject);
				GameModifierPanel = GameObject.Find("Canvas/Game Modifiers");
				if ((Object)(object)GameModifierPanel != (Object)null)
				{
					Sprite sprite = MonoSingleton<OptionsManager>.Instance.pauseMenu.GetComponent<Image>().sprite;
					ModifierVotePanel = ((Component)GameModifierPanel.transform.Find("Game Modifier Vote")).gameObject;
					ModifierWarningPanel = ((Component)GameModifierPanel.transform.Find("Game Mod Panel")).gameObject;
					ModifierCurrentEnabled = ((Component)GameModifierPanel.transform.Find("Game Mod Compact Panel")).gameObject;
					ModifierVotePanel.GetComponent<Image>().sprite = sprite;
					ModifierWarningPanel.GetComponent<Image>().sprite = sprite;
					if (AutoCreate)
					{
						CreatePanel();
					}
				}
				if (tell.value && !connected && SceneHelper.CurrentScene != "Main Menu" && MonoSingleton<NewMovement>.Instance.activated)
				{
					Log("Go into the <color=orange>Stream Integration Config</color> to connect to your live stream! <color=red>THIS MESSAGE WILL NOT SHOW UP AGAIN.</color>");
					tell.value = false;
				}
			}
			catch
			{
			}
		}

		public static void AuthUserPage()
		{
			s.auth.AuthUser();
			Log("Enter the access token you found in the URL");
		}

		public static void ConnectToTwitch()
		{
			if (s.connectedT && s.joinedChannel == s.GetTwitchChannel(channel.value))
			{
				LogError("You're trying again even though you are already connected?");
			}
			else
			{
				ConnectToTwitchA(token.value);
			}
		}

		public static async void ConnectToTwitchA(string token)
		{
			s.connectedT = true;
			twitchConnected = true;
			await s.ConnectToTwitchAsync(token);
		}

		public static void Log(string msg)
		{
			if ((Object)(object)MonoSingleton<HudMessageReceiver>.Instance != (Object)null)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(msg, "", "", 0, false, false, true);
			}
			else
			{
				ModLog.LogInfo((object)msg);
			}
		}

		public static void LogError(string msg)
		{
			if ((Object)(object)MonoSingleton<HudMessageReceiver>.Instance != (Object)null)
			{
				AudioClip clip = GameObject.Find("Canvas/Save-Load Fail Message/Merge Consent Wrapper/Message").GetComponent<AudioSource>().clip;
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + msg + "</color>", "", "", 0, false, false, true);
				SpawnSound(clip, 0.35f, ((Component)MonoSingleton<NewMovement>.Instance).transform);
			}
			else
			{
				ModLog.LogError((object)msg);
			}
		}

		public static void TutorialURLOpen()
		{
			Application.OpenURL("https://sites.google.com/view/ukstreamintegrationmodguide/home");
		}

		public static void DisconnectFromTwitch(bool silent)
		{
			if (!s.connectedT)
			{
				LogError("Trying to disconnect without being connected");
				return;
			}
			s.DisconnectFromTwitch(silent);
			s.connectedT = false;
			twitchConnected = false;
		}

		public static void ConnectToYoutube()
		{
			if (s.connectedY && s.liveStreamId == s.GetYoutubeURL(url.value))
			{
				LogError("You're already connected to this <color=#CD201F>youtube</color> live stream!");
				return;
			}
			if (s.connectedY && s.liveStreamId != string.Empty && s.liveStreamId != s.GetYoutubeURL(url.value))
			{
				((MonoBehaviour)s).StartCoroutine(s.InitializeNewStream());
			}
			if (key.value == string.Empty)
			{
				LogError("API key is empty");
				return;
			}
			if (s.liveStreamId != s.GetYoutubeURL(url.value))
			{
				s.liveStreamId = s.GetYoutubeURL(url.value);
			}
			s.ForceConnectYoutube();
		}

		public static void DisconnectFromYoutube()
		{
			if (!s.connectedY)
			{
				LogError("Why would you disconnect if you're not even connected?");
				return;
			}
			s.liveStreamId = string.Empty;
			s.StopFetchingYoutube();
			Log("Disconnected from <color=#CD201F>youtube</color> live stream");
		}

		public static void SpawnSound(AudioClip clip, float pitch, Transform parent)
		{
			//IL_0006: 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)
			AudioSource val = new GameObject("Noise").AddComponent<AudioSource>();
			val.clip = clip;
			val.pitch = pitch;
			val.volume = 0.5f;
			((Component)val).gameObject.AddComponent<RemoveOnTime>().time = clip.length;
			((Component)val).transform.SetParent(parent, false);
			((Component)val).transform.position = parent.position;
			val.Play();
		}

		public static Color GetPlatformColor()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			ColorUtility.TryParseHtmlString((youtubeConnected && !twitchConnected) ? "#CD201F" : ((twitchConnected && !youtubeConnected) ? "#6441a5" : ((twitchConnected && youtubeConnected) ? "#6357FF" : "#FFD700")), ref result);
			return result;
		}

		public static Color GetBrighterPlatformColor()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			ColorUtility.TryParseHtmlString((youtubeConnected && !twitchConnected) ? "#FF5C5C" : ((twitchConnected && !youtubeConnected) ? "#B07CFF" : ((twitchConnected && youtubeConnected) ? "#9FA4FF" : "#FFE14C")), ref result);
			return result;
		}
	}
	public class TwitchAuth : MonoBehaviour
	{
		private string cId = "nzqyavhst1jf2zxowpgg921onie17e";

		private string uri = "https://ukstreamint";

		public void AuthUser()
		{
			string text = "https://id.twitch.tv/oauth2/authorize?client_id=" + cId + "&redirect_uri=" + uri + "&response_type=token&scope=chat:read+chat:edit";
			Application.OpenURL(text);
		}
	}
	public class StreamMessageGetter : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <ConnectToNewChannel>d__28 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public StreamMessageGetter <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.DisconnectFromTwitch(silent: true);
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>4__this.connectedT));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = <>4__this.ConnectToTwitchAsync(Plug.token.value);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					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();
			}
		}

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

			private object <>2__current;

			public StreamMessageGetter <>4__this;

			private string <msg>5__1;

			private string[] <parts>5__2;

			private int <prefix>5__3;

			private string <prefix>5__4;

			private string <user>5__5;

			private string <actualMsg>5__6;

			private string <chatMessageColor>5__7;

			private string <chatMessage>5__8;

			private Voter <voter>5__9;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<msg>5__1 = null;
				<parts>5__2 = null;
				<prefix>5__4 = null;
				<user>5__5 = null;
				<actualMsg>5__6 = null;
				<chatMessageColor>5__7 = null;
				<chatMessage>5__8 = null;
				<voter>5__9 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<>4__this.connectedT)
				{
					if (<>4__this.twitchClient.Connected && <>4__this.twitchClient.Available > 0)
					{
						<msg>5__1 = <>4__this.reader.ReadLine();
						Plug.ModLog.LogInfo((object)<msg>5__1);
						if (<msg>5__1.StartsWith("@"))
						{
							<prefix>5__3 = <msg>5__1.IndexOf(" :");
							if (<prefix>5__3 > -1)
							{
								<msg>5__1 = <msg>5__1.Substring(<prefix>5__3 + 1);
							}
						}
						<parts>5__2 = <msg>5__1.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
						if (<msg>5__1.Contains("PRIVMSG"))
						{
							<prefix>5__4 = <parts>5__2[0];
							<user>5__5 = <prefix>5__4.Substring(1, <prefix>5__4.IndexOf('!') - 1);
							<actualMsg>5__6 = <msg>5__1.Substring(<msg>5__1.IndexOf(':', 1) + 1);
							<chatMessageColor>5__7 = "<color=#" + ColorUtility.ToHtmlStringRGBA(Random.ColorHSV()) + ">" + <user>5__5 + "</color><color=#FFFF>: " + <actualMsg>5__6 + "</color>";
							<chatMessage>5__8 = <user>5__5 + ": " + <actualMsg>5__6;
							if (!chatMessagesT.Contains(<chatMessage>5__8))
							{
								chatMessagesT.Add(<chatMessage>5__8);
							}
							if ((Object)(object)VotingPanel.Instance != (Object)null && Plug.crowdControlOn.value && VotingPanel.Instance.CanMessageVote(<actualMsg>5__6))
							{
								<voter>5__9 = ((<>4__this.GetVoter(<user>5__5) != null) ? <>4__this.GetVoter(<user>5__5) : new Voter
								{
									Name = <user>5__5,
									VotedEvent = null
								});
								voters.Add(<voter>5__9);
								VotingPanel.Instance.VoteWithMessage(<actualMsg>5__6, <voter>5__9);
								<voter>5__9 = null;
							}
							if (Plug.read.value && ((<actualMsg>5__6.Contains(Plug.keyword.value) && Plug.keyword.value != string.Empty) || Plug.logAll.value))
							{
								MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(<chatMessageColor>5__7, (AudioSource)null, true);
							}
							if (!namesT.Contains(<user>5__5))
							{
								namesT.Add(<user>5__5);
							}
							if (!rawMessagesT.Contains(<actualMsg>5__6))
							{
								rawMessagesT.Add(<actualMsg>5__6);
							}
							<prefix>5__4 = null;
							<user>5__5 = null;
							<actualMsg>5__6 = null;
							<chatMessageColor>5__7 = null;
							<chatMessage>5__8 = null;
						}
						if (<msg>5__1.StartsWith("PING"))
						{
							<>4__this.writer.WriteLine("PONG :tmi.twitch.tv");
							<>4__this.writer.Flush();
						}
						<msg>5__1 = null;
						<parts>5__2 = null;
					}
					<>2__current = null;
					<>1__state = 1;
					return 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();
			}
		}

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

			private object <>2__current;

			public StreamMessageGetter <>4__this;

			private string <url>5__1;

			private UnityWebRequest <w>5__2;

			private JObject <data>5__3;

			private JToken <items>5__4;

			private IEnumerator<JToken> <>s__5;

			private JToken <item>5__6;

			private string <author>5__7;

			private string <message>5__8;

			private string <messageSent>5__9;

			private string <lastSentEmoji>5__10;

			private string[] <>s__11;

			private int <>s__12;

			private string <e>5__13;

			private string <chatMessage>5__14;

			private Voter <voter>5__15;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 4u)
				{
					try
					{
						if (num == -4 || num == 4)
						{
							try
							{
							}
							finally
							{
								<>m__Finally2();
							}
						}
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<w>5__2 = null;
				<data>5__3 = null;
				<items>5__4 = null;
				<>s__5 = null;
				<item>5__6 = null;
				<author>5__7 = null;
				<message>5__8 = null;
				<messageSent>5__9 = null;
				<lastSentEmoji>5__10 = null;
				<>s__11 = null;
				<e>5__13 = null;
				<chatMessage>5__14 = null;
				<voter>5__15 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Expected O, but got Unknown
				//IL_0713: Unknown result type (might be due to invalid IL or missing references)
				//IL_071d: Expected O, but got Unknown
				bool result;
				try
				{
					switch (<>1__state)
					{
					default:
						result = false;
						break;
					case 0:
						<>1__state = -1;
						if (string.IsNullOrEmpty(<>4__this.liveChatId))
						{
							Plug.LogError("Live chat ID is not valid or stream is not live");
							result = false;
							break;
						}
						<url>5__1 = "https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=" + <>4__this.liveChatId + "&part=snippet,authorDetails&key=" + <>4__this.apiKey;
						goto IL_074b;
					case 1:
						<>1__state = -3;
						<>4__this.messageCount = 0;
						onHold = false;
						goto IL_0119;
					case 2:
						<>1__state = -3;
						if (<w>5__2.responseCode < 400)
						{
							if (MonoSingleton<OptionsManager>.Instance.paused)
							{
								<>2__current = null;
								<>1__state = 3;
								result = true;
								break;
							}
							<data>5__3 = JObject.Parse(<w>5__2.downloadHandler.text);
							<items>5__4 = <data>5__3["items"];
							<>4__this.messageCount++;
							<>s__5 = ((IEnumerable<JToken>)<items>5__4).GetEnumerator();
							<>1__state = -4;
							goto IL_0685;
						}
						Plug.LogError("Failed to fetch chat messages: \"" + <w>5__2.error + "\", Disconnected from stream.");
						Plug.DisconnectFromYoutube();
						result = false;
						<>m__Finally1();
						break;
					case 3:
						<>1__state = -3;
						goto IL_06e0;
					case 4:
						<>1__state = -4;
						goto IL_0661;
					case 5:
						{
							<>1__state = -3;
							<>m__Finally1();
							<w>5__2 = null;
							goto IL_074b;
						}
						IL_0661:
						<author>5__7 = null;
						<message>5__8 = null;
						<messageSent>5__9 = null;
						<lastSentEmoji>5__10 = null;
						<item>5__6 = null;
						goto IL_0685;
						IL_0685:
						if (<>s__5.MoveNext())
						{
							<item>5__6 = <>s__5.Current;
							JToken obj = <item>5__6[(object)"authorDetails"];
							<author>5__7 = ((obj == null) ? null : ((object)obj[(object)"displayName"])?.ToString());
							JToken obj2 = <item>5__6[(object)"snippet"];
							<message>5__8 = ((obj2 == null) ? null : ((object)obj2[(object)"displayMessage"])?.ToString());
							JToken obj3 = <item>5__6[(object)"snippet"];
							<messageSent>5__9 = ((obj3 == null) ? null : ((object)obj3[(object)"publishedAt"])?.ToString());
							<lastSentEmoji>5__10 = string.Empty;
							if (<messageSent>5__9 != <>4__this.lastYTMessageSent && !<>4__this.times.Contains(<messageSent>5__9))
							{
								if (Plug.emojis.value && GetEmojiNames(<message>5__8).Length != 0)
								{
									<>s__11 = GetEmojiNames(<message>5__8);
									for (<>s__12 = 0; <>s__12 < <>s__11.Length; <>s__12++)
									{
										<e>5__13 = <>s__11[<>s__12];
										if (<e>5__13 == <lastSentEmoji>5__10)
										{
											<lastSentEmoji>5__10 = <e>5__13;
											MonoSingleton<StyleHUD>.Instance.AddPoints(1, <e>5__13.ToUpper().Replace(":", "") + " COMBO", (GameObject)null, (EnemyIdentifier)null, -1, <e>5__13.ToUpper().Replace(":", "") + " COMBO", "");
										}
										else
										{
											<lastSentEmoji>5__10 = <e>5__13;
											MonoSingleton<StyleHUD>.Instance.AddPoints(1, <e>5__13.ToUpper().Replace(":", "") ?? "", (GameObject)null, (EnemyIdentifier)null, -1, <e>5__13.ToUpper().Replace(":", "") ?? "", "");
										}
										<e>5__13 = null;
									}
									<>s__11 = null;
								}
								<>4__this.times.Add(<messageSent>5__9);
								<>4__this.lastYTMessageSent = <messageSent>5__9;
								if (!chatMessagesY.Contains(<author>5__7 + ": " + <message>5__8))
								{
									<chatMessage>5__14 = <author>5__7 + ": " + <message>5__8;
									if ((Object)(object)VotingPanel.Instance != (Object)null && Plug.crowdControlOn.value && VotingPanel.Instance.CanMessageVote(<message>5__8))
									{
										<voter>5__15 = ((<>4__this.GetVoter(<author>5__7) != null) ? <>4__this.GetVoter(<author>5__7) : new Voter
										{
											Name = <author>5__7,
											VotedEvent = null
										});
										voters.Add(<voter>5__15);
										VotingPanel.Instance.VoteWithMessage(<message>5__8, <voter>5__15);
										<voter>5__15 = null;
									}
									if (Plug.read.value && ((<message>5__8.Contains(Plug.keyword.value) && Plug.keyword.value != string.Empty) || Plug.logAll.value))
									{
										MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(<chatMessage>5__14, (AudioSource)null, true);
									}
									if (!namesY.Contains(<author>5__7))
									{
										namesY.Add(<author>5__7);
									}
									rawMessagesY.Add(<message>5__8);
									chatMessagesY.Add(<message>5__8);
									<chatMessage>5__14 = null;
								}
								goto IL_0661;
							}
							<>2__current = null;
							<>1__state = 4;
							result = true;
							break;
						}
						<>m__Finally2();
						<>s__5 = null;
						<data>5__3 = null;
						<items>5__4 = null;
						goto IL_06e0;
						IL_06e0:
						<>2__current = (object)new WaitForSeconds((<>4__this.messageCount > 2000) ? Random.Range(0.95f, 1.25f) : Random.Range(0.5f, 0.75f));
						<>1__state = 5;
						result = true;
						break;
						IL_0119:
						<>2__current = <w>5__2.SendWebRequest();
						<>1__state = 2;
						result = true;
						break;
						IL_074b:
						if (<>4__this.connectedY)
						{
							<w>5__2 = UnityWebRequest.Get(<url>5__1);
							<>1__state = -3;
							if (<>4__this.messageCount > 7000)
							{
								onHold = true;
								<>2__current = (object)new WaitForSeconds(10f);
								<>1__state = 1;
								result = true;
								break;
							}
							goto IL_0119;
						}
						result = false;
						break;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
				return result;
			}

			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 (<w>5__2 != null)
				{
					((IDisposable)<w>5__2).Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				if (<>s__5 != null)
				{
					<>s__5.Dispose();
				}
			}

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

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

			private object <>2__current;

			public StreamMessageGetter <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.StopFetchingYoutube();
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>4__this.connectedY));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.InitializeYouTubeChat());
					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();
			}
		}

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

			private object <>2__current;

			public StreamMessageGetter <>4__this;

			private string <url>5__1;

			private UnityWebRequest <w>5__2;

			private JObject <data>5__3;

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

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

			[DebuggerHidden]
			public <InitializeYouTubeChat>d__29(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();
					}
				}
				<url>5__1 = null;
				<w>5__2 = null;
				<data>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Expected O, but got Unknown
				bool result;
				try
				{
					switch (<>1__state)
					{
					default:
						result = false;
						break;
					case 0:
						<>1__state = -1;
						if (string.IsNullOrEmpty(<>4__this.apiKey))
						{
							Plug.LogError("Key is empty");
						}
						<url>5__1 = "https://www.googleapis.com/youtube/v3/videos?part=liveStreamingDetails&id=" + <>4__this.liveStreamId + "&key=" + <>4__this.apiKey;
						<w>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<w>5__2.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
						<w>5__2.method = "GET";
						<>2__current = <w>5__2.SendWebRequest();
						<>1__state = 1;
						result = true;
						break;
					case 1:
					{
						<>1__state = -3;
						<data>5__3 = JObject.Parse(<w>5__2.downloadHandler.text);
						StreamMessageGetter streamMessageGetter = <>4__this;
						JToken obj = <data>5__3["items"];
						object liveChatId;
						if (obj == null)
						{
							liveChatId = null;
						}
						else
						{
							JToken obj2 = obj[(object)0];
							if (obj2 == null)
							{
								liveChatId = null;
							}
							else
							{
								JToken obj3 = obj2[(object)"liveStreamingDetails"];
								liveChatId = ((obj3 == null) ? null : ((object)obj3[(object)"activeLiveChatId"])?.ToString());
							}
						}
						streamMessageGetter.liveChatId = (string)liveChatId;
						if (!string.IsNullOrEmpty(<>4__this.liveChatId))
						{
							Plug.Log("Connected to <color=#CD201F>youtube</color> live stream");
							<>4__this.connectedY = true;
							Plug.youtubeConnected = true;
							chatMessagesY.Clear();
							((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FetchYoutubeChatMessages());
							if ((Object)(object)VotingPanel.Instance != (Object)null)
							{
								VotingPanel.Instance.UpdateButtonColors();
							}
							Plug.tell.value = false;
							<data>5__3 = null;
							<>m__Finally1();
							<w>5__2 = null;
							result = false;
						}
						else
						{
							if (<w>5__2.downloadHandler.text.Contains("quotaExceeded"))
							{
								Plug.LogError("API key quota exceeded, Please make a new project and redo the steps from the guide.");
								result = false;
							}
							else
							{
								Plug.LogError("URL links to video that isn't live.");
								result = false;
							}
							<>m__Finally1();
						}
						break;
					}
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
				return result;
			}

			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 (<w>5__2 != null)
				{
					((IDisposable)<w>5__2).Dispose();
				}
			}

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

		public string apiKey;

		public string liveStreamId;

		public string liveChatId;

		public string lastYTMessageSent = "";

		public HashSet<string> times = new HashSet<string>();

		public static List<string> chatMessagesY = new List<string>();

		public static List<string> namesY = new List<string>();

		public static List<string> rawMessagesY = new List<string>();

		public static List<Voter> voters = new List<Voter>();

		public static List<string> chatMessagesT = new List<string>();

		public static List<string> namesT = new List<string>();

		public static List<string> rawMessagesT = new List<string>();

		private int messageCount;

		public static bool onHold;

		public bool connectedY;

		public bool connectedT;

		private TcpClient twitchClient;

		private StreamReader reader;

		private StreamWriter writer;

		public string joinedChannel;

		public TwitchAuth auth;

		public void OnDisable()
		{
			StopFetchingYoutube();
			DisconnectFromTwitch(silent: true);
		}

		public void OnApplicationQuit()
		{
			StopFetchingYoutube();
			DisconnectFromTwitch(silent: true);
		}

		public void Update()
		{
			auth = GameObjectExtensions.GetOrAddComponent<TwitchAuth>(((Component)this).gameObject);
			apiKey = Plug.key.value;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

		public Voter GetVoter(string name)
		{
			foreach (Voter voter in voters)
			{
				if (voter.Name == name)
				{
					return voter;
				}
			}
			return null;
		}

		public string GetYoutubeURL(string url)
		{
			try
			{
				if (url.Contains("live"))
				{
					url = url.Replace("live", "watch?v=");
				}
				string text = "?v=";
				int num = url.IndexOf(text);
				if (num >= 0)
				{
					int num2 = num + text.Length;
					int num3 = url.IndexOf("&", num2);
					if (num3 == -1)
					{
						num3 = url.Length;
					}
					return url.Substring(num2, num3 - num2);
				}
			}
			catch (Exception ex)
			{
				Plug.LogError(ex.Message);
			}
			return null;
		}

		public void ForceConnectYoutube()
		{
			StopFetchingYoutube();
			((MonoBehaviour)this).StartCoroutine(InitializeYouTubeChat());
		}

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

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

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

		public static string[] GetEmojiNames(string message)
		{
			List<string> list = new List<string>();
			MatchCollection matchCollection = Regex.Matches(message, ":([^:]+):");
			foreach (Match item in matchCollection)
			{
				list.Add(item.Value);
			}
			return list.ToArray();
		}

		public async Task ConnectToTwitchAsync(string token)
		{
			chatMessagesT.Clear();
			if (twitchClient != null && twitchClient.Connected)
			{
				DisconnectFromTwitch(silent: true);
			}
			if (twitchClient != null && twitchClient.Connected && joinedChannel != Plug.channel.value)
			{
				((MonoBehaviour)this).StartCoroutine(ConnectToNewChannel());
				return;
			}
			twitchClient = new TcpClient("irc.chat.twitch.tv", 6667);
			reader = new StreamReader(twitchClient.GetStream());
			writer = new StreamWriter(twitchClient.GetStream())
			{
				AutoFlush = true
			};
			string channel = (Plug.channel.value.Contains("https://") ? GetTwitchChannel(Plug.channel.value) : Plug.channel.value);
			await writer.WriteLineAsync("PASS oauth:" + token);
			await writer.WriteLineAsync("NICK UKInt");
			await writer.WriteLineAsync("JOIN #" + channel);
			joinedChannel = channel;
			Plug.Log("Connected to <color=#6441a5>twitch</color> channel #" + channel);
			((MonoBehaviour)this).StartCoroutine(FetchTwitchChatMessages());
			if ((Object)(object)VotingPanel.Instance != (Object)null)
			{
				VotingPanel.Instance.UpdateButtonColors();
			}
			Plug.tell.value = false;
		}

		public string GetTwitchChannel(string url)
		{
			string text = "https://www.twitch.tv/";
			return url.Substring(text.Length);
		}

		public void DisconnectFromTwitch(bool silent)
		{
			twitchClient.Close();
			reader.Close();
			writer.Close();
			chatMessagesT.Clear();
			rawMessagesT.Clear();
			namesT.Clear();
			((MonoBehaviour)this).StopCoroutine(FetchTwitchChatMessages());
			string text = (Plug.channel.value.Contains("https://") ? GetTwitchChannel(Plug.channel.value) : Plug.channel.value);
			if (!silent)
			{
				Plug.Log("Disconnected from <color=#6441a5>twitch</color> channel #" + text);
			}
			if ((Object)(object)VotingPanel.Instance != (Object)null)
			{
				VotingPanel.Instance.UpdateButtonColors();
			}
		}

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

		public void StopFetchingYoutube()
		{
			connectedY = false;
			Plug.youtubeConnected = false;
			chatMessagesY.Clear();
			rawMessagesY.Clear();
			namesY.Clear();
			((MonoBehaviour)this).StopCoroutine(FetchYoutubeChatMessages());
			if ((Object)(object)VotingPanel.Instance != (Object)null)
			{
				VotingPanel.Instance.UpdateButtonColors();
			}
		}

		[IteratorStateMachine(typeof(<FetchYoutubeChatMessages>d__36))]
		public IEnumerator FetchYoutubeChatMessages()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FetchYoutubeChatMessages>d__36(0)
			{
				<>4__this = this
			};
		}
	}
}
namespace StreamIntegration.Patches
{
	[HarmonyPatch(typeof(EnemyIdentifier))]
	internal class EnemySpawn
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ChangeToRandomUser(ref string ___overrideFullName, EnemyIdentifier __instance)
		{
			List<string> list = new List<string>();
			list.AddRange(StreamMessageGetter.namesY);
			list.AddRange(StreamMessageGetter.namesT);
			if (list.Count <= 0 || !Plug.chatBosses.value)
			{
				return;
			}
			string text = list[Random.Range(0, list.Count)];
			if (!string.IsNullOrEmpty(text))
			{
				___overrideFullName = text;
				if ((Object)(object)((Component)__instance).GetComponent<BossHealthBar>() != (Object)null)
				{
					((Component)__instance).GetComponent<BossHealthBar>().ChangeName(text);
				}
			}
		}
	}
	[HarmonyPatch(typeof(GameStateManager))]
	internal class MakeItSoYouCantCheatScores
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		private static void NoScore(ref bool __result)
		{
			if (SceneHelper.CurrentScene != "Main Menu")
			{
				__result = !Plug.HasVotingBeenOn;
			}
			else
			{
				__result = !Plug.CrowdControlEnabled;
			}
		}
	}
	[HarmonyPatch(typeof(FinalRank))]
	internal class RankStuff
	{
		[HarmonyPatch("SetInfo")]
		[HarmonyPostfix]
		private static void AddExtras(FinalRank __instance)
		{
			if (Plug.HasVotingBeenOn)
			{
				TMP_Text extraInfo = __instance.extraInfo;
				extraInfo.text += "- <color=#6357FF>CROWD CONTROL USED</color>\n";
			}
		}

		[HarmonyPatch("Appear")]
		[HarmonyPostfix]
		private static void HideVotePanel()
		{
			if (Plug.HasVotingBeenOn)
			{
				VotingPanel.Instance.ClearUI();
			}
		}

		[HarmonyPatch("SetRank")]
		[HarmonyPostfix]
		private static void ShowRankUseless(FinalRank __instance, ref bool ___majorAssists)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			if (Plug.HasVotingBeenOn && ColorUtility.TryParseHtmlString("#6357FF", ref color))
			{
				((Graphic)((Component)__instance.totalRank.transform.parent).GetComponent<Image>()).color = color;
				__instance.totalRank.text = Regex.Replace(__instance.totalRank.text, "<.*?>", "");
			}
		}
	}
	[HarmonyPatch(typeof(OnLevelStart))]
	internal class StartPanelWhenLevelEnter
	{
		[HarmonyPatch("StartLevel")]
		[HarmonyPostfix]
		private static void CreateVotingPanel()
		{
			if (!Plug.HasVotingBeenOn)
			{
				Plug.CreatePanel();
			}
		}
	}
}
namespace StreamIntegration.Events
{
	public class EffectEvents : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <HandleAA>d__22 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			private List<EnemyIdentifier>.Enumerator <>s__1;

			private EnemyIdentifier <eid>5__2;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					eidsActive = MonoSingleton<EnemyTracker>.Instance.enemies;
					<>s__1 = eidsActive.GetEnumerator();
					try
					{
						while (<>s__1.MoveNext())
						{
							<eid>5__2 = <>s__1.Current;
							try
							{
								if (!<eid>5__2.dead)
								{
									((Component)MonoSingleton<CameraController>.Instance).transform.LookAt(((Component)<eid>5__2).transform);
									goto IL_009a;
								}
							}
							catch (Exception)
							{
								goto IL_009a;
							}
							continue;
							IL_009a:
							<eid>5__2 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__1).Dispose();
					}
					<>s__1 = default(List<EnemyIdentifier>.Enumerator);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					MonoSingleton<CameraController>.Instance.Zoom(MonoSingleton<CameraController>.Instance.defaultFov / 2.75f);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					MonoSingleton<CameraController>.Instance.StopZoom();
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			private List<EnemyIdentifier> <blessed>5__1;

			private List<EnemyIdentifier>.Enumerator <>s__2;

			private EnemyIdentifier <eid>5__3;

			private List<EnemyIdentifier>.Enumerator <>s__4;

			private EnemyIdentifier <eid>5__5;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<blessed>5__1 = null;
				<>s__2 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__3 = null;
				<>s__4 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<blessed>5__1 = new List<EnemyIdentifier>();
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					eidsActive = MonoSingleton<EnemyTracker>.Instance.enemies;
					<>s__2 = eidsActive.GetEnumerator();
					try
					{
						while (<>s__2.MoveNext())
						{
							<eid>5__3 = <>s__2.Current;
							if (!<eid>5__3.dead && !<eid>5__3.blessed && !<blessed>5__1.Contains(<eid>5__3))
							{
								<eid>5__3.Bless(false);
								<blessed>5__1.Add(<eid>5__3);
							}
							<eid>5__3 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__2).Dispose();
					}
					<>s__2 = default(List<EnemyIdentifier>.Enumerator);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					<>s__4 = <blessed>5__1.GetEnumerator();
					try
					{
						while (<>s__4.MoveNext())
						{
							<eid>5__5 = <>s__4.Current;
							<eid>5__5.Unbless(false);
							<eid>5__5 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__4).Dispose();
					}
					<>s__4 = default(List<EnemyIdentifier>.Enumerator);
					<blessed>5__1.Clear();
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			private List<EnemyIdentifier>.Enumerator <>s__1;

			private EnemyIdentifier <eid>5__2;

			private List<EnemyIdentifier>.Enumerator <>s__3;

			private EnemyIdentifier <eid>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__2 = null;
				<>s__3 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					try
					{
						eidsActive = MonoSingleton<EnemyTracker>.Instance.enemies;
						<>s__1 = eidsActive.GetEnumerator();
						try
						{
							while (<>s__1.MoveNext())
							{
								<eid>5__2 = <>s__1.Current;
								if (!<eid>5__2.dead)
								{
									<eid>5__2.BossBar(true);
								}
								<eid>5__2 = null;
							}
						}
						finally
						{
							((IDisposable)<>s__1).Dispose();
						}
						<>s__1 = default(List<EnemyIdentifier>.Enumerator);
					}
					catch (Exception)
					{
						Plug.ModLog.LogError((object)"Something went wrong with Boss Bar All event");
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					eidsActive = MonoSingleton<EnemyTracker>.Instance.enemies;
					<>s__3 = eidsActive.GetEnumerator();
					try
					{
						while (<>s__3.MoveNext())
						{
							<eid>5__4 = <>s__3.Current;
							<eid>5__4.BossBar(false);
							<eid>5__4 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__3).Dispose();
					}
					<>s__3 = default(List<EnemyIdentifier>.Enumerator);
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					MonoSingleton<NewMovement>.Instance.DeactivatePlayer();
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					MonoSingleton<NewMovement>.Instance.ActivatePlayer();
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			private List<EnemyIdentifier> <cantBeAffected>5__1;

			private List<EnemyIdentifier>.Enumerator <>s__2;

			private EnemyIdentifier <eid>5__3;

			private List<EnemyIdentifier>.Enumerator <>s__4;

			private EnemyIdentifier <eid>5__5;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<cantBeAffected>5__1 = null;
				<>s__2 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__3 = null;
				<>s__4 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0160: 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_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<cantBeAffected>5__1 = new List<EnemyIdentifier>();
					eventToggled = true;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					try
					{
						eidsActive = MonoSingleton<EnemyTracker>.Instance.enemies;
						<>s__2 = eidsActive.GetEnumerator();
						try
						{
							while (<>s__2.MoveNext())
							{
								<eid>5__3 = <>s__2.Current;
								if (!<cantBeAffected>5__1.Contains(<eid>5__3))
								{
									Transform transform = ((Component)<eid>5__3).transform;
									transform.localScale *= 1.5f;
									<cantBeAffected>5__1.Add(<eid>5__3);
								}
								<eid>5__3 = null;
							}
						}
						finally
						{
							((IDisposable)<>s__2).Dispose();
						}
						<>s__2 = default(List<EnemyIdentifier>.Enumerator);
					}
					catch (Exception)
					{
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					<>s__4 = <cantBeAffected>5__1.GetEnumerator();
					try
					{
						while (<>s__4.MoveNext())
						{
							<eid>5__5 = <>s__4.Current;
							Transform transform2 = ((Component)<eid>5__5).transform;
							transform2.localScale /= 1.5f;
							<eid>5__5 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__4).Dispose();
					}
					<>s__4 = default(List<EnemyIdentifier>.Enumerator);
					<cantBeAffected>5__1.Clear();
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			private List<EnemyIdentifier> <cantBeDuped>5__1;

			private List<EnemyIdentifier> <duped>5__2;

			private List<EnemyIdentifier>.Enumerator <>s__3;

			private EnemyIdentifier <eid>5__4;

			private EnemyIdentifier <eid2>5__5;

			private List<EnemyIdentifier>.Enumerator <>s__6;

			private EnemyIdentifier <eid>5__7;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<cantBeDuped>5__1 = null;
				<duped>5__2 = null;
				<>s__3 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__4 = null;
				<eid2>5__5 = null;
				<>s__6 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<cantBeDuped>5__1 = new List<EnemyIdentifier>();
					<duped>5__2 = new List<EnemyIdentifier>();
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					try
					{
						eidsActive = MonoSingleton<EnemyTracker>.Instance.enemies;
						<>s__3 = eidsActive.GetEnumerator();
						try
						{
							while (<>s__3.MoveNext())
							{
								<eid>5__4 = <>s__3.Current;
								if (!<cantBeDuped>5__1.Contains(<eid>5__4))
								{
									<eid2>5__5 = Object.Instantiate<EnemyIdentifier>(<eid>5__4, ((Component)<eid>5__4).transform.position, ((Component)<eid>5__4).transform.rotation);
									((Component)<eid2>5__5).gameObject.AddComponent<RemoveOnTime>().time = (Plug.youtubeConnected ? (Plug.restartTime.value * 1.55f) : Plug.restartTime.value);
									((Component)<eid2>5__5).gameObject.AddComponent<DestroyOnCheckpointRestart>();
									<cantBeDuped>5__1.Add(<eid2>5__5);
									<cantBeDuped>5__1.Add(<eid>5__4);
									<duped>5__2.Add(<eid2>5__5);
									<eid2>5__5 = null;
								}
								<eid>5__4 = null;
							}
						}
						finally
						{
							((IDisposable)<>s__3).Dispose();
						}
						<>s__3 = default(List<EnemyIdentifier>.Enumerator);
					}
					catch (Exception)
					{
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					<>s__6 = <duped>5__2.GetEnumerator();
					try
					{
						while (<>s__6.MoveNext())
						{
							<eid>5__7 = <>s__6.Current;
							Object.Destroy((Object)(object)((Component)<eid>5__7).gameObject);
							<eid>5__7 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__6).Dispose();
					}
					<>s__6 = default(List<EnemyIdentifier>.Enumerator);
					<duped>5__2.Clear();
					<cantBeDuped>5__1.Clear();
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			private List<EnemyIdentifier>.Enumerator <>s__1;

			private EnemyIdentifier <eid>5__2;

			private Drone <d>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__2 = null;
				<d>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Invalid comparison between Unknown and I4
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					try
					{
						eidsActive = MonoSingleton<EnemyTracker>.Instance.enemies;
						if (eidsActive.Count > 0)
						{
							<>s__1 = eidsActive.GetEnumerator();
							try
							{
								while (<>s__1.MoveNext())
								{
									<eid>5__2 = <>s__1.Current;
									if ((int)<eid>5__2.enemyType != 1 && (Object)(object)((Component)((Component)<eid>5__2).transform).GetComponentInChildren<Drone>() == (Object)null && !<eid>5__2.dead)
									{
										<d>5__3 = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Enemies/Drone.prefab").WaitForCompletion(), ((Component)<eid>5__2).transform).GetComponent<Drone>();
										<eid>5__2.onDeath.AddListener(new UnityAction(<d>5__3.Explode));
										<d>5__3 = null;
									}
									<eid>5__2 = null;
								}
							}
							finally
							{
								((IDisposable)<>s__1).Dispose();
							}
							<>s__1 = default(List<EnemyIdentifier>.Enumerator);
						}
					}
					catch (NullReferenceException)
					{
						Plug.ModLog.LogError((object)"Something went wrong with DB event");
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					try
					{
						MonoSingleton<TimeController>.Instance.timeScaleModifier = 0.35f;
						MonoSingleton<TimeController>.Instance.SetAllPitch(0.45f);
					}
					catch (NullReferenceException)
					{
						Plug.ModLog.LogError((object)"Something went wrong with DGS event");
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					MonoSingleton<TimeController>.Instance.SlowDown(0.25f);
					MonoSingleton<TimeController>.Instance.timeScaleModifier = 1f;
					MonoSingleton<TimeController>.Instance.SetAllPitch(1f);
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			private List<Coin>.Enumerator <>s__1;

			private Coin <coin>5__2;

			private float <time>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = default(List<Coin>.Enumerator);
				<coin>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					if (MonoSingleton<CoinList>.Instance.revolverCoinsList.Count > 0)
					{
						<>s__1 = MonoSingleton<CoinList>.Instance.revolverCoinsList.GetEnumerator();
						try
						{
							while (<>s__1.MoveNext())
							{
								<coin>5__2 = <>s__1.Current;
								<time>5__3 = Random.Range(0.25f, 0.75f);
								((MonoBehaviour)<coin>5__2).Invoke("DelayedEnemyReflect", <time>5__3);
								((MonoBehaviour)<coin>5__2).Invoke("Bounce", <time>5__3);
								<coin>5__2 = null;
							}
						}
						finally
						{
							((IDisposable)<>s__1).Dispose();
						}
						<>s__1 = default(List<Coin>.Enumerator);
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					MonoSingleton<CameraController>.Instance.cameraShaking = 20f;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					MonoSingleton<CameraController>.Instance.cameraShaking = 0f;
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			public float walkSpeed;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					MonoSingleton<NewMovement>.Instance.walkSpeed = walkSpeed * 1.5f;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					MonoSingleton<NewMovement>.Instance.walkSpeed = walkSpeed;
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

			private List<EnemyIdentifier> <cantBeX2>5__1;

			private List<EnemyIdentifier>.Enumerator <>s__2;

			private EnemyIdentifier <eid>5__3;

			private Machine <mach>5__4;

			private Zombie <zom>5__5;

			private SpiderBody <spi>5__6;

			private Statue <stat>5__7;

			private Drone <drone>5__8;

			private List<EnemyIdentifier>.Enumerator <>s__9;

			private EnemyIdentifier <eid>5__10;

			private Machine <mach>5__11;

			private Zombie <zom>5__12;

			private SpiderBody <spi>5__13;

			private Statue <stat>5__14;

			private Drone <drone>5__15;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<cantBeX2>5__1 = null;
				<>s__2 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__3 = null;
				<mach>5__4 = null;
				<zom>5__5 = null;
				<spi>5__6 = null;
				<stat>5__7 = null;
				<drone>5__8 = null;
				<>s__9 = default(List<EnemyIdentifier>.Enumerator);
				<eid>5__10 = null;
				<mach>5__11 = null;
				<zom>5__12 = null;
				<spi>5__13 = null;
				<stat>5__14 = null;
				<drone>5__15 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<cantBeX2>5__1 = new List<EnemyIdentifier>();
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					<>s__2 = eidsActive.GetEnumerator();
					try
					{
						while (<>s__2.MoveNext())
						{
							<eid>5__3 = <>s__2.Current;
							if (!<cantBeX2>5__1.Contains(<eid>5__3))
							{
								<mach>5__4 = <eid>5__3.machine;
								<zom>5__5 = <eid>5__3.zombie;
								<spi>5__6 = <eid>5__3.spider;
								<stat>5__7 = <eid>5__3.statue;
								<drone>5__8 = <eid>5__3.drone;
								if ((Object)(object)<mach>5__4 != (Object)null)
								{
									Machine obj = <mach>5__4;
									obj.health *= 2f;
								}
								if ((Object)(object)<zom>5__5 != (Object)null)
								{
									Zombie obj2 = <zom>5__5;
									obj2.health *= 2f;
								}
								if ((Object)(object)<spi>5__6 != (Object)null)
								{
									SpiderBody obj3 = <spi>5__6;
									obj3.health *= 2f;
								}
								if ((Object)(object)<stat>5__7 != (Object)null)
								{
									Statue obj4 = <stat>5__7;
									obj4.health *= 2f;
								}
								if ((Object)(object)<drone>5__8 != (Object)null)
								{
									Drone obj5 = <drone>5__8;
									obj5.health *= 2f;
								}
								<cantBeX2>5__1.Add(<eid>5__3);
								<mach>5__4 = null;
								<zom>5__5 = null;
								<spi>5__6 = null;
								<stat>5__7 = null;
								<drone>5__8 = null;
							}
							<eid>5__3 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__2).Dispose();
					}
					<>s__2 = default(List<EnemyIdentifier>.Enumerator);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{
					<>s__9 = <cantBeX2>5__1.GetEnumerator();
					try
					{
						while (<>s__9.MoveNext())
						{
							<eid>5__10 = <>s__9.Current;
							<mach>5__11 = <eid>5__10.machine;
							<zom>5__12 = <eid>5__10.zombie;
							<spi>5__13 = <eid>5__10.spider;
							<stat>5__14 = <eid>5__10.statue;
							<drone>5__15 = <eid>5__10.drone;
							if ((Object)(object)<mach>5__11 != (Object)null)
							{
								Machine obj6 = <mach>5__11;
								obj6.health /= 2f;
							}
							if ((Object)(object)<zom>5__12 != (Object)null)
							{
								Zombie obj7 = <zom>5__12;
								obj7.health /= 2f;
							}
							if ((Object)(object)<spi>5__13 != (Object)null)
							{
								SpiderBody obj8 = <spi>5__13;
								obj8.health /= 2f;
							}
							if ((Object)(object)<stat>5__14 != (Object)null)
							{
								Statue obj9 = <stat>5__14;
								obj9.health /= 2f;
							}
							if ((Object)(object)<drone>5__15 != (Object)null)
							{
								Drone obj10 = <drone>5__15;
								obj10.health /= 2f;
							}
							<mach>5__11 = null;
							<zom>5__12 = null;
							<spi>5__13 = null;
							<stat>5__14 = null;
							<drone>5__15 = null;
							<eid>5__10 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__9).Dispose();
					}
					<>s__9 = default(List<EnemyIdentifier>.Enumerator);
					MonoSingleton<NewMovement>.Instance.antiHp = 20.25f;
					return false;
				}
				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();
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (eventToggled)
				{
					MonoSingleton<NewMovement>.Instance.ForceAntiHP(99f, false, false, true, false);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				if (!eventToggled)
				{