Decompiled source of UltrakillMLG v4.2.69

MLGUltrakill.dll

Decompiled 8 months ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Configgy;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MLGUltrakill")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MLGUltrakill")]
[assembly: AssemblyTitle("MLGUltrakill")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MLGUltrakill;

[HarmonyPatch]
internal class ComicSans : MonoBehaviour
{
	private string[] Texts = new string[16]
	{
		"3mlg5u", "smoke weed everyday", "mom get the camera", "did you see that?", "illuminati confirmed?", "420 blaze it", "1 like = 1 ipod", "8/8 m8 -IGN", "but my hope will never die", "o shit lel",
		"8========D", "come on 9gag army!", "thug life", "haxxor!?", "shrek 5 confirmed?", "2dank4u"
	};

	private void Start()
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).GetComponent<TMP_Text>().text = Texts[Random.Range(0, Texts.Length)];
		((Component)this).transform.parent = ((Component)MonoSingleton<CanvasController>.Instance).transform;
		? val = ((Component)this).transform;
		float num = Random.Range(0f, (float)Screen.width - ((RectTransform)/*isinst with value type is only supported in some contexts*/).sizeDelta.x);
		float num2 = Screen.height;
		Transform transform = ((Component)this).transform;
		((Transform)val).position = new Vector3(num, Random.Range(0f, num2 - ((RectTransform)((transform is RectTransform) ? transform : null)).sizeDelta.y), 0f);
		((MonoBehaviour)this).StartCoroutine(Delete(6f + Random.value * 4f));
	}

	private IEnumerator Delete(float time = 0.2f)
	{
		yield return (object)new WaitForSeconds(time);
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class Delete : MonoBehaviour
{
	public float time;

	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(DeleteIE(time));
	}

	private IEnumerator DeleteIE(float time)
	{
		yield return (object)new WaitForSeconds(time);
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
[HarmonyPatch]
internal class DeleteHitmarker : MonoBehaviour
{
	private void Start()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		Transform transform = ((Component)this).transform;
		transform.position += new Vector3((float)Random.Range(-15, 16), (float)Random.Range(-15, 16), (float)Random.Range(-15, 16));
		float num = Random.Range(0.75f, 1.5f);
		((Component)this).transform.localScale = new Vector3(num, num, num);
		((MonoBehaviour)this).StartCoroutine(Delete());
	}

	private IEnumerator Delete()
	{
		yield return (object)new WaitForSeconds(0.15f);
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
[HarmonyPatch]
internal class DeleteQuickscope : MonoBehaviour
{
	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(Delete(1.2f));
	}

	private IEnumerator Delete(float time = 0.2f)
	{
		yield return (object)new WaitForSeconds(time);
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
[HarmonyPatch]
internal class DeleteSnoop : MonoBehaviour
{
	private void Start()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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)
		((Component)this).transform.parent = ((Component)MonoSingleton<CanvasController>.Instance).transform;
		? val = ((Component)this).transform;
		float num = Random.Range(0f, (float)Screen.width - ((RectTransform)/*isinst with value type is only supported in some contexts*/).sizeDelta.x);
		float num2 = Screen.height;
		Transform transform = ((Component)this).transform;
		((Transform)val).position = new Vector3(num, Random.Range(0f, num2 - ((RectTransform)((transform is RectTransform) ? transform : null)).sizeDelta.y), 0f);
		((MonoBehaviour)this).StartCoroutine(Delete(9.4f));
	}

	private IEnumerator Delete(float time = 0.2f)
	{
		yield return (object)new WaitForSeconds(time);
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
internal class HueShifter : MonoBehaviour
{
	private Color colorTarget = Color.red;

	private Image image;

	private Color currentColor;

	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(ChangeValue());
		image = ((Component)this).GetComponent<Image>();
	}

	private void Update()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		currentColor = Color.Lerp(currentColor, colorTarget, Time.deltaTime * 100f);
		((Graphic)image).color = new Color(currentColor.r, currentColor.b, currentColor.g, 0.25f);
		if (currentColor == Color.red)
		{
			colorTarget = Color.magenta;
		}
		if (currentColor == Color.magenta)
		{
			colorTarget = Color.blue;
		}
		if (currentColor == Color.blue)
		{
			colorTarget = Color.cyan;
		}
		if (currentColor == Color.cyan)
		{
			colorTarget = Color.green;
		}
		if (currentColor == Color.green)
		{
			colorTarget = Color.yellow;
		}
		if (currentColor == Color.yellow)
		{
			colorTarget = Color.red;
		}
	}

	private IEnumerator ChangeValue()
	{
		LevelManager.ValueUp = true;
		yield return (object)new WaitForSeconds(0.05f);
		LevelManager.ValueUp = false;
	}
}
[HarmonyPatch]
internal class Impact
{
	private static List<Object> s_checkedTexts = new List<Object>();

	private static TMP_FontAsset s_tmpImpact;

	private static Font s_impact;

	public static void Init()
	{
		s_tmpImpact = Plugin.Bundle.LoadAsset<TMP_FontAsset>("COMIC SDF");
		s_impact = Plugin.Bundle.LoadAsset<Font>("COMIC");
	}

	[HarmonyPatch(typeof(TextMeshProUGUI), "OnEnable")]
	[HarmonyPostfix]
	private static void SwapTmp(TextMeshProUGUI __instance)
	{
		((TMP_Text)__instance).font = s_tmpImpact;
		((TMP_Text)__instance).enableWordWrapping = true;
	}

	[HarmonyPatch(typeof(Text), "OnEnable")]
	[HarmonyPostfix]
	private static void SwapText(Text __instance)
	{
		__instance.font = s_impact;
		__instance.resizeTextMaxSize = __instance.fontSize;
		__instance.resizeTextForBestFit = true;
	}
}
[HarmonyPatch]
internal class LevelManager
{
	public static int Level;

	public static bool ValueUp;

	private static GameObject currentThemePlayer;

	private static GameObject currentRainbowOverlay;

	private static float volume;

	private static bool active;

	private static float time;

	private static float time2;

	private static float timeTarget = 30f;

	private static float timeTarget2 = 30f;

	private void Start()
	{
		timeTarget = Random.Range(30, 150);
		timeTarget2 = Random.Range(60, 180);
		if (Random.value > 0.5f)
		{
			timeTarget *= 2f;
		}
		else
		{
			timeTarget2 *= 2f;
		}
		active = false;
	}

	[HarmonyPatch(typeof(StyleHUD), "AscendRank")]
	[HarmonyPostfix]
	private static void PlayTheSongAndCheck(StyleHUD __instance)
	{
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		active = true;
		Level = MonoSingleton<StyleHUD>.Instance._rankIndex;
		if (Level < 6 || (Object)(object)currentThemePlayer != (Object)null)
		{
			return;
		}
		volume = MonoSingleton<AudioMixerController>.Instance.musicVolume;
		MonoSingleton<AudioMixerController>.Instance.SetMusicVolume(0f);
		currentRainbowOverlay = Object.Instantiate<GameObject>(Plugin.RainbowOverlay, ((Component)MonoSingleton<CanvasController>.Instance).transform);
		currentRainbowOverlay.AddComponent<HueShifter>();
		if (!((ConfigValueElement<bool>)(object)Plugin.DoMusic).Value)
		{
			if (((ConfigValueElement<bool>)(object)Plugin.CopyrightedMusic).Value)
			{
				currentThemePlayer = Object.Instantiate<GameObject>(Plugin.MyHopeCR);
			}
			else
			{
				currentThemePlayer = Object.Instantiate<GameObject>(Plugin.MyHope);
			}
		}
		else
		{
			currentThemePlayer = Object.Instantiate<GameObject>(Plugin.Doge, new Vector3(9999f, 9999f, 0f), Quaternion.identity);
		}
	}

	[HarmonyPatch(typeof(StyleHUD), "DescendRank")]
	[HarmonyPostfix]
	private static void DontPlayTheSong(StyleHUD __instance)
	{
		Level = MonoSingleton<StyleHUD>.Instance._rankIndex;
		if (!((Object)(object)currentThemePlayer == (Object)null) && Level != 7 && Level != 6)
		{
			Object.Destroy((Object)(object)currentThemePlayer);
			currentThemePlayer = null;
			Object.Destroy((Object)(object)currentRainbowOverlay);
			currentRainbowOverlay = null;
			MonoSingleton<AudioMixerController>.Instance.SetMusicVolume(volume);
		}
	}

	private static void SpawnIlluminati()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if (!(Random.value > 0.6f))
		{
			timeTarget = Random.Range(20, 180);
			time = 0f;
			Loomynarty loomynarty = Object.Instantiate<GameObject>(Plugin.Illuminati3D, ((Component)MonoSingleton<CameraController>.Instance).transform.position + Random.insideUnitSphere * 150f, Quaternion.identity).AddComponent<Loomynarty>();
			if (((ConfigValueElement<bool>)(object)Plugin.CopyrightedMusic).Value)
			{
				((Behaviour)((Component)loomynarty).gameObject.GetComponent<AudioSource>()).enabled = false;
			}
			if (((ConfigValueElement<bool>)(object)Plugin.DoMusic).Value)
			{
				((Behaviour)((Component)loomynarty).gameObject.GetComponent<AudioSource>()).enabled = false;
			}
			if (Random.value > 0.2f)
			{
				SpawnIlluminati();
			}
		}
	}

	private static void SpawnSnoop(bool delete)
	{
		if (!(Random.value > 0.66f))
		{
			timeTarget2 = Random.Range(60, 180);
			time2 = 0f;
			DeleteSnoop deleteSnoop = Object.Instantiate<GameObject>(Plugin.Snoop, ((Component)MonoSingleton<CanvasController>.Instance).transform).AddComponent<DeleteSnoop>();
			if (((ConfigValueElement<bool>)(object)Plugin.DoMusic).Value || delete)
			{
				((Behaviour)((Component)deleteSnoop).gameObject.GetComponent<AudioSource>()).enabled = false;
			}
			if (Random.value > 0.33f)
			{
				SpawnSnoop(delete: true);
			}
		}
	}

	[HarmonyPatch(typeof(NewMovement), "FixedUpdate")]
	[HarmonyPostfix]
	private static void AddStuff()
	{
		time += Time.deltaTime;
		time2 += Time.deltaTime;
		if (time > timeTarget)
		{
			SpawnIlluminati();
		}
		if (time2 > timeTarget2)
		{
			SpawnSnoop(delete: false);
		}
		if (!active)
		{
			return;
		}
		float num = 0.999f;
		if (Level > 5)
		{
			num = 0.996f;
		}
		if (ValueUp)
		{
			num = 0.5f;
		}
		if (!(Random.value < num))
		{
			int num2 = Random.Range(0, 5);
			if (num2 == 0)
			{
				Object.Instantiate<GameObject>(Plugin.Doritos, ((Component)MonoSingleton<CanvasController>.Instance).transform).AddComponent<Spin>();
			}
			if (num2 == 1)
			{
				Object.Instantiate<GameObject>(Plugin.Mtndew, ((Component)MonoSingleton<CanvasController>.Instance).transform).AddComponent<Spin>();
			}
			if (num2 == 2)
			{
				Object.Instantiate<GameObject>(Plugin.Illuminati, ((Component)MonoSingleton<CanvasController>.Instance).transform).AddComponent<Spin>();
			}
			if (num2 == 3)
			{
				Object.Instantiate<GameObject>(Plugin.Doge, ((Component)MonoSingleton<CanvasController>.Instance).transform).AddComponent<Spin>();
			}
			if (num2 == 4)
			{
				Object.Instantiate<GameObject>(Plugin.Blunt, ((Component)MonoSingleton<CanvasController>.Instance).transform).AddComponent<Spin>();
			}
		}
	}
}
[HarmonyPatch]
internal class Loomynarty : MonoBehaviour
{
	private float drag = 0.75f;

	private Vector3 velocity;

	private float speed = 50f;

	private Transform playerTransform;

	private void Start()
	{
		drag = Random.value * 2f;
		speed = Random.Range(40, 61);
		playerTransform = ((Component)MonoSingleton<CameraController>.Instance).transform;
		((MonoBehaviour)this).StartCoroutine(Delete());
	}

	private IEnumerator Delete()
	{
		yield return (object)new WaitForSeconds((float)Random.Range(12, 30));
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}

	private void FixedUpdate()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: 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_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		velocity -= velocity * Time.fixedDeltaTime * drag;
		Vector3 val = velocity;
		Vector3 val2 = playerTransform.position - ((Component)this).transform.position;
		velocity = val + ((Vector3)(ref val2)).normalized * speed * Time.fixedDeltaTime;
		Transform transform = ((Component)this).transform;
		transform.position += velocity * Time.fixedDeltaTime;
		Transform transform2 = ((Component)this).transform;
		Quaternion rotation = ((Component)this).transform.rotation;
		val2 = playerTransform.position - ((Component)this).transform.position;
		transform2.rotation = Quaternion.Slerp(rotation, Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up), 15.01f * Time.fixedDeltaTime);
	}
}
[HarmonyPatch]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("fri.ultrakill.MLGUltrakill", "ultrakill mlg", "4.2.0.69")]
public class Plugin : BaseUnityPlugin
{
	public float timer;

	public float target = 15f;

	public List<GameObject> events = new List<GameObject>();

	public static AssetBundle Bundle;

	private static Sprite s_logosprite;

	private static AudioClip s_fireisgone;

	private static AudioClip s_gab_Intro1;

	private static AudioClip s_gab_Intro2;

	private static AudioClip s_gab2nd_Intro;

	private static AudioClip s_gab_61a;

	private static AudioClip s_gab_61b;

	private static GameObject s_wow;

	private static GameObject s_hitmarker;

	private static GameObject s_sadViolin;

	private static GameObject s_currentSadViolin;

	private static GameObject s_ohBaby;

	public static GameObject RainbowOverlay;

	public static GameObject MyHope;

	public static GameObject Doritos;

	public static GameObject Mtndew;

	public static GameObject Illuminati;

	public static GameObject Doge;

	public static GameObject Blunt;

	public static GameObject MyHopeCR;

	private static GameObject s_getTheCamera;

	private static GameObject s_explosion;

	public static GameObject Quickscope;

	private static GameObject s_obey;

	private static GameObject s_weed;

	private static GameObject s_airhorn;

	private static GameObject s_bluntmodel;

	private static VideoClip s_optic;

	private static GameObject s_comicsans;

	private static GameObject s_screaming;

	private static GameObject s_hitmarkers;

	private static GameObject s_guns;

	public static GameObject Illuminati3D;

	public static GameObject Snoop;

	private ConfigBuilder _config;

	[Configgable("", "Disable Copyrighted Music", 0, null)]
	public static ConfigToggle CopyrightedMusic = new ConfigToggle(false);

	[Configgable("", "Disable Music", 0, null)]
	public static ConfigToggle DoMusic = new ConfigToggle(false);

	private void Awake()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		_config = new ConfigBuilder("Plugin", "ultrakill mlg");
		_config.Build();
		new Harmony("MLGUltrakill").PatchAll();
		string path = Assembly.GetExecutingAssembly().Location.Replace("MLGUltrakill.dll", "");
		string text = Path.Combine(path, "mlgultrakillassets");
		Bundle = AssetBundle.LoadFromFile(text);
		s_explosion = Bundle.LoadAsset<GameObject>("explosion");
		s_logosprite = Bundle.LoadAsset<Sprite>("mlg ultrakill");
		s_fireisgone = Bundle.LoadAsset<AudioClip>("mlg fire is gone");
		s_gab_Intro1 = Bundle.LoadAsset<AudioClip>("gab_Intro1d");
		s_gab_Intro2 = Bundle.LoadAsset<AudioClip>("gab_Intro2b");
		s_gab_61a = Bundle.LoadAsset<AudioClip>("gab2nd_6-1tease1");
		s_gab_61b = Bundle.LoadAsset<AudioClip>("gab2nd_6-1tease2");
		s_gab2nd_Intro = Bundle.LoadAsset<AudioClip>("gab2nd_intro1");
		s_wow = Bundle.LoadAsset<GameObject>("wow video");
		s_hitmarker = Bundle.LoadAsset<GameObject>("hitmarker");
		s_ohBaby = Bundle.LoadAsset<GameObject>("triple sound");
		MyHope = Bundle.LoadAsset<GameObject>("theme player");
		RainbowOverlay = Bundle.LoadAsset<GameObject>("rainbow overlay");
		Doritos = Bundle.LoadAsset<GameObject>("doritos");
		Mtndew = Bundle.LoadAsset<GameObject>("mtndew");
		Illuminati = Bundle.LoadAsset<GameObject>("illuminati");
		Doge = Bundle.LoadAsset<GameObject>("doge");
		s_getTheCamera = Bundle.LoadAsset<GameObject>("getthecamera");
		Quickscope = Bundle.LoadAsset<GameObject>("quickscope1");
		s_obey = Bundle.LoadAsset<GameObject>("obey cap");
		s_bluntmodel = Bundle.LoadAsset<GameObject>("bluntmodel");
		Illuminati3D = Bundle.LoadAsset<GameObject>("Illuminati3D");
		s_weed = Bundle.LoadAsset<GameObject>("weed");
		Blunt = Bundle.LoadAsset<GameObject>("blunt");
		s_airhorn = Bundle.LoadAsset<GameObject>("airhorn");
		MyHope = Bundle.LoadAsset<GameObject>("theme player");
		s_sadViolin = Bundle.LoadAsset<GameObject>("death music");
		MyHopeCR = Bundle.LoadAsset<GameObject>("theme player copyright");
		s_optic = Bundle.LoadAsset<VideoClip>("optic");
		s_comicsans = Bundle.LoadAsset<GameObject>("comic sans");
		s_screaming = Bundle.LoadAsset<GameObject>("screaming");
		s_hitmarkers = Bundle.LoadAsset<GameObject>("hitmarkers");
		s_guns = Bundle.LoadAsset<GameObject>("guns");
		Snoop = Bundle.LoadAsset<GameObject>("snoop1");
		events.Add(s_comicsans);
		events.Add(s_screaming);
		events.Add(s_hitmarkers);
		events.Add(s_guns);
		events.Add(s_airhorn);
		events.Add(s_weed);
		events.Add(Quickscope);
		SceneManager.sceneLoaded += OnSceneLoaded;
		Impact.Init();
	}

	private void Update()
	{
		if (!SceneHelper.CurrentScene.Contains("Main Menu"))
		{
			timer += Time.deltaTime;
			if (LevelManager.Level > 5)
			{
				timer += Time.deltaTime * 1.5f;
			}
			if (timer > target)
			{
				int index = Random.Range(0, events.Count);
				GameObject val = events[index];
				Object.Instantiate<GameObject>(val, ((Component)MonoSingleton<CanvasController>.Instance).transform);
				timer = 0f;
				target = Random.Range(10, 20);
			}
		}
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		if (SceneHelper.CurrentScene.Contains("Main Menu"))
		{
			AudioSource component = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject gameObject) => ((Object)gameObject).name == "Music").GetComponent<AudioSource>();
			component.clip = s_fireisgone;
			component.Stop();
			component.Play();
		}
		if (SceneHelper.CurrentScene.Contains("Level 3-2"))
		{
			AudioSource component2 = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject gameObject) => ((Object)gameObject).name == "gab_Intro1").GetComponent<AudioSource>();
			AudioSource component3 = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject gameObject) => ((Object)gameObject).name == "gab_Intro2").GetComponent<AudioSource>();
			component2.clip = s_gab_Intro1;
			component3.clip = s_gab_Intro2;
		}
		if (SceneHelper.CurrentScene.Contains("Level 6-1"))
		{
			AudioSource component4 = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject gameObject) => ((Object)gameObject).name == "GabrielVoice1").GetComponent<AudioSource>();
			AudioSource component5 = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject gameObject) => ((Object)gameObject).name == "GabrielVoice2").GetComponent<AudioSource>();
			component4.clip = s_gab_61a;
			component5.clip = s_gab_61b;
		}
		if (SceneHelper.CurrentScene.Contains("Level 6-2"))
		{
			AudioSource component6 = ((Component)((Scene)(ref scene)).GetRootGameObjects().First((GameObject gameObject) => ((Object)gameObject).name == "IntroSounds").transform.Find("Filler/Speech and Music/Speech")).GetComponent<AudioSource>();
			component6.clip = s_gab2nd_Intro;
		}
		((Component)((Component)MonoSingleton<CanvasController>.Instance).transform.Find("Main Menu (1)/Title/Text")).GetComponent<TMP_Text>().text = "-- MAJOR LEAGUE GAMING --";
	}

	[HarmonyPatch(typeof(Image), "OnEnable")]
	[HarmonyPostfix]
	private static void ReplaceLogo(Image __instance)
	{
		if (!(((Object)__instance.sprite).name != "logowideborderlesssmaller"))
		{
			__instance.sprite = s_logosprite;
		}
	}

	[HarmonyPatch(typeof(StyleHUD), "Awake")]
	[HarmonyPostfix]
	private static void ReplaceStyleNames(StyleHUD __instance)
	{
		__instance.idNameDict["ultrakill.kill"] = "REKT";
		__instance.idNameDict["ultrakill.doublekill"] = "DOUBLE REKT";
		__instance.idNameDict["ultrakill.triplekill"] = "OH BABY A TRIPLE";
		__instance.idNameDict["ultrakill.bigkill"] = "BIG REKT";
		__instance.idNameDict["ultrakill.headshot"] = "NOSCOPE";
		__instance.idNameDict["ultrakill.bigheadshot"] = "BIG NOSCOPE";
		__instance.idNameDict["ultrakill.headshotcombo"] = "<color=#00ffffff>NOSCOPE STREAK</color>";
		__instance.idNameDict["ultrakill.chargeback"] = "MOM GET THE CAMERA";
		__instance.idNameDict["ultrakill.enraged"] = "<color=red>u mad bro?</color>";
		__instance.idNameDict["ultrakill.quickdraw"] = "QUICKSCOPE";
		__instance.idNameDict["ultrakill.airshot"] = "JUMPSHOT";
		__instance.idNameDict["ultrakill.multikill"] = "<color=orange>MULTIREKT</color>";
		__instance.idNameDict["ultrakill.fried"] = "<color=green>BLAZE IT</color>";
		__instance.idNameDict["ultrakill.firehit"] = "<color=green>BLAZE IT</color>";
	}

	[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
	[HarmonyPrefix]
	private static void SetState(ref float __state, EnemyIdentifier __instance)
	{
		__state = __instance.health;
	}

	[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
	[HarmonyPostfix]
	private static void Wow(EnemyIdentifier __instance, float __state)
	{
		if (!(Random.value < 0.999f) && __state != 0f && __instance.health == 0f)
		{
			((MonoBehaviour)MonoSingleton<SceneHelper>.Instance).StartCoroutine(DoWow());
		}
	}

	[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
	[HarmonyPostfix]
	private static void Hitmarker(EnemyIdentifier __instance, ref float __state)
	{
		if (!__instance.dead)
		{
			GameObject val = Object.Instantiate<GameObject>(s_hitmarker, ((Component)MonoSingleton<CanvasController>.Instance).transform);
			val.AddComponent<DeleteHitmarker>();
		}
	}

	private static IEnumerator DoWow()
	{
		GameObject currentWow = Object.Instantiate<GameObject>(s_wow, ((Component)MonoSingleton<CanvasController>.Instance).transform);
		yield return (object)new WaitForSeconds(3.4f);
		Object.Destroy((Object)(object)currentWow);
	}

	[HarmonyPatch(typeof(NewMovement), "GetHurt")]
	[HarmonyPostfix]
	private static void DeathMusic(NewMovement __instance)
	{
		if (__instance.hp == 0 && !((ConfigValueElement<bool>)(object)CopyrightedMusic).Value)
		{
			s_currentSadViolin = Object.Instantiate<GameObject>(s_sadViolin);
		}
	}

	[HarmonyPatch(typeof(NewMovement), "Respawn")]
	[HarmonyPostfix]
	private static void EndMusic(NewMovement __instance)
	{
		Object.Destroy((Object)(object)s_currentSadViolin);
	}

	[HarmonyPatch(typeof(StyleHUD), "AddPoints")]
	[HarmonyPostfix]
	private static void PlaySound(StyleHUD __instance, string pointID, int points)
	{
		if (pointID == "ultrakill.triplekill")
		{
			Object.Instantiate<GameObject>(s_ohBaby);
		}
		if (points <= 150 || !(pointID != "ultrakill.enraged"))
		{
			return;
		}
		if (Random.value < 0.85f)
		{
			if (Random.value < 0.08f)
			{
				Object.Instantiate<GameObject>(s_getTheCamera);
			}
		}
		else if (!(Random.value < 0.6f))
		{
			((MonoBehaviour)MonoSingleton<SceneHelper>.Instance).StartCoroutine(DoWow());
		}
	}

	[HarmonyPatch(typeof(Explosion), "Start")]
	[HarmonyPostfix]
	private static void CreateExplosion(Explosion __instance)
	{
		if (!(Random.value > 0.066f))
		{
			((MonoBehaviour)MonoSingleton<NewMovement>.Instance).StartCoroutine(DeleteExplosion(Object.Instantiate<GameObject>(s_explosion, ((Component)MonoSingleton<CanvasController>.Instance).transform)));
		}
	}

	[HarmonyPatch(typeof(SeasonalHats), "Start")]
	[HarmonyPostfix]
	private static void AddObey(SeasonalHats __instance)
	{
		if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<Gabriel>()) || Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInParent<GabrielSecond>()))
		{
			Object.Instantiate<GameObject>(s_bluntmodel, __instance.christmas.transform.parent);
		}
		if (!(Random.value > 0.666f) && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponentInParent<Drone>()) && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponentInParent<Zombie>()))
		{
			Object.Instantiate<GameObject>(s_obey, __instance.christmas.transform.parent);
		}
	}

	[HarmonyPatch(typeof(IntroViolenceScreen), "Start")]
	[HarmonyPostfix]
	private static void OpTicIntro(IntroViolenceScreen __instance)
	{
		((Component)__instance).GetComponent<VideoPlayer>().clip = s_optic;
		((Component)__instance).GetComponent<VideoPlayer>().Stop();
		((Component)__instance).GetComponent<VideoPlayer>().Play();
	}

	public static IEnumerator DeleteExplosion(GameObject ex)
	{
		yield return (object)new WaitForSeconds(1.25f);
		Object.Destroy((Object)(object)ex);
	}
}
internal class Spin : MonoBehaviour
{
	private float time;

	private float spinSpeed = 4.5f;

	private Vector3 pos;

	private void Start()
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		spinSpeed += Random.value * 2.5f;
		if (Random.value < 0.5f)
		{
			spinSpeed *= -1f;
		}
		((Component)this).transform.parent = ((Component)MonoSingleton<CanvasController>.Instance).transform;
		? val = ((Component)this).transform;
		float num = Random.Range(0f, (float)Screen.width - ((RectTransform)/*isinst with value type is only supported in some contexts*/).sizeDelta.x);
		float num2 = Screen.height;
		Transform transform = ((Component)this).transform;
		((Transform)val).position = new Vector3(num, Random.Range(0f, num2 - ((RectTransform)((transform is RectTransform) ? transform : null)).sizeDelta.y), 0f);
		pos = ((Component)this).transform.position;
	}

	private void Update()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		time += Time.deltaTime;
		Transform transform = ((Component)this).transform;
		transform.eulerAngles += new Vector3(0f, 0f, 480f * Time.deltaTime);
	}

	private void FixedUpdate()
	{
		//IL_0008: 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_002d: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.position = pos + new Vector3(Random.value * 25f, Random.value * 25f, 1f);
		if (!(time < 2.4f) && (double)Random.value > 0.99)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}