Decompiled source of REPOS BROKEN v1.0.0

e.dll

Decompiled 5 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using TMPro;
using UnityEngine;
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("sonic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("sonic")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("98f6da0c-f28e-4d99-a81d-92f0e99ae946")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OmniverseSingularity;

[BepInPlugin("com.void.singularity", "Omniverse Singularity: Ultimate", "305.0.0")]
public class OmniPlugin : BaseUnityPlugin
{
	public static ConfigEntry<bool> EnableFog;

	public static ConfigEntry<float> PulseIntensity;

	public static ConfigEntry<float> ScalePower;

	public static ConfigEntry<float> GravityPower;

	public static ConfigEntry<float> RealityTimerLimit;

	public static ConfigEntry<float> RainbowSpeed;

	public static ConfigEntry<float> EmissionBrightness;

	public static ConfigEntry<float> FogBaseDensity;

	public static ConfigEntry<string> ColorMode;

	public static ConfigEntry<float> CorruptionChance;

	public static ConfigEntry<float> TextUpdateSpeed;

	public static ConfigEntry<float> TextFloatIntensity;

	public static ConfigEntry<float> PitchWarpRange;

	public static ConfigEntry<float> SynthVolume;

	public static ConfigEntry<float> TimeWarpChaos;

	public static ConfigEntry<bool> EnableUpsideDown;

	public static ConfigEntry<bool> EnableChaosSpawns;

	public static ConfigEntry<bool> SwapSounds;

	public static ConfigEntry<bool> EnablePulse;

	public static ConfigEntry<bool> EnableScaling;

	public static ConfigEntry<bool> EnableGravityChaos;

	public static ConfigEntry<bool> EnableRealityShifts;

	public static ConfigEntry<bool> EnableTimeWarp;

	public static ConfigEntry<bool> EnableVisualEffects;

	public static ConfigEntry<bool> EnableFogManipulation;

	public static ConfigEntry<bool> EnableTextCorruption;

	public static ConfigEntry<bool> EnablePitchWarp;

	public static ConfigEntry<bool> EnableSoundSwapping;

	public static ConfigEntry<bool> EnableMenuSynth;

	public static OmniPlugin Instance { get; private set; }

	private void Awake()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Expected O, but got Unknown
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Expected O, but got Unknown
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Expected O, but got Unknown
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Expected O, but got Unknown
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Expected O, but got Unknown
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Expected O, but got Unknown
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Expected O, but got Unknown
		//IL_037f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Expected O, but got Unknown
		//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Expected O, but got Unknown
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Expected O, but got Unknown
		//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c0: Expected O, but got Unknown
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Expected O, but got Unknown
		Instance = this;
		PulseIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("1. Core Chaos", "PulseIntensity", 2f, new ConfigDescription("Strength of object breathing (0-5)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
		EnablePulse = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Core Chaos", "EnablePulse", true, "Toggle object breathing effect");
		ScalePower = ((BaseUnityPlugin)this).Config.Bind<float>("1. Core Chaos", "ScalePower", 1.2f, new ConfigDescription("Base world scale multiplier (0-5)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
		EnableScaling = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Core Chaos", "EnableScaling", true, "Toggle world scaling and resizing");
		GravityPower = ((BaseUnityPlugin)this).Config.Bind<float>("1. Core Chaos", "GravityPower", 1f, new ConfigDescription("Global gravity multiplier (-2 to 10)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-2f, 10f), Array.Empty<object>()));
		EnableGravityChaos = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Core Chaos", "EnableGravityChaos", true, "Toggle gravity shifts during reality cycles");
		RealityTimerLimit = ((BaseUnityPlugin)this).Config.Bind<float>("1. Core Chaos", "RealityTimer", 25f, new ConfigDescription("Seconds between reality shifts (5-500)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 500f), Array.Empty<object>()));
		EnableRealityShifts = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Core Chaos", "EnableRealityShifts", true, "Toggle the periodic shifting of world state");
		TimeWarpChaos = ((BaseUnityPlugin)this).Config.Bind<float>("1. Core Chaos", "TimeWarpChaos", 0.8f, new ConfigDescription("Intensity of time dilation waves", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
		EnableTimeWarp = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Core Chaos", "EnableTimeWarp", true, "Toggle the slowing/speeding of time");
		RainbowSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("2. Visuals", "RainbowSpeed", 1.5f, new ConfigDescription("Cycles per second (0-10)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
		EmissionBrightness = ((BaseUnityPlugin)this).Config.Bind<float>("2. Visuals", "EmissionBrightness", 2.5f, new ConfigDescription("Glow multiplier (0-10)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
		ColorMode = ((BaseUnityPlugin)this).Config.Bind<string>("2. Visuals", "ColorMode", "Rainbow", "Rainbow, Swirl, Negative, Reality, Static");
		EnableVisualEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Visuals", "EnableVisualEffects", true, "Master toggle for color/glow changes");
		FogBaseDensity = ((BaseUnityPlugin)this).Config.Bind<float>("2. Visuals", "FogDensity", 0.08f, new ConfigDescription("Thickness of the fog (0-0.5)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), Array.Empty<object>()));
		EnableFogManipulation = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Visuals", "EnableFog", true, "Toggle custom environment fog");
		EnableFog = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Visuals", "EnableFog", true, "Toggle fog manipulation");
		CorruptionChance = ((BaseUnityPlugin)this).Config.Bind<float>("3. Text Corruption", "Chance", 0.85f, new ConfigDescription("Likelihood of text glitching", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		TextUpdateSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("3. Text Corruption", "UpdateSpeed", 0.08f, new ConfigDescription("Delay in text jitter", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>()));
		TextFloatIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("3. Text Corruption", "AntiGravText", 2f, new ConfigDescription("Text drift strength", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
		EnableTextCorruption = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Text Corruption", "EnableTextChaos", true, "Toggle all text-based glitching");
		PitchWarpRange = ((BaseUnityPlugin)this).Config.Bind<float>("4. Audio", "PitchWarp", 1.5f, new ConfigDescription("Warp intensity (0-5)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>()));
		EnablePitchWarp = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Audio", "EnablePitchWarp", true, "Toggle random sound pitch changes");
		SwapSounds = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Audio", "SwapSounds", false, "Randomly swap sound effects when they play?");
		EnableSoundSwapping = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Audio", "EnableSwap", true, "Toggle the sound-swapping logic");
		SynthVolume = ((BaseUnityPlugin)this).Config.Bind<float>("4. Audio", "SynthVolume", 0.25f, new ConfigDescription("Menu synthesizer loudness", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		EnableMenuSynth = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Audio", "EnableMenuSynth", true, "Toggle the synth-wave background audio in menus");
		EnableUpsideDown = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Toggles", "UpsideDownObjects", true, "Should objects flip over randomly?");
		EnableChaosSpawns = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Toggles", "ChaosSpawns", true, "Should items teleport during shifts?");
		Harmony val = new Harmony("com.void.singularity.ultimate");
		val.PatchAll();
		((Component)this).gameObject.AddComponent<OmniCore>();
		((Component)this).gameObject.AddComponent<MenuSynthesizer>();
		((Component)this).gameObject.AddComponent<EnvironmentMutator>();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Omniverse Singularity: ULTIMATE EDITION INITIALIZED. STABILIZED TIME & ENHANCED SCALING.");
	}
}
public class OmniCore : MonoBehaviour
{
	private float _masterClock;

	private float _realityTimer;

	public static int CurrentReality;

	private static List<AudioClip> _soundPool = new List<AudioClip>();

	private Dictionary<int, Vector3> _baseScales = new Dictionary<int, Vector3>();

	private HashSet<int> _flippedObjects = new HashSet<int>();

	private Vector3 _originalGravity;

	private float _internalTimeScale = 1f;

	public static OmniCore Instance { get; private set; }

	private void Start()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		_originalGravity = Physics.gravity;
		_masterClock = Random.Range(0f, 1000f);
	}

	private void Update()
	{
		//IL_0013: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_039e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0346: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0425: Unknown result type (might be due to invalid IL or missing references)
		_masterClock += Time.unscaledDeltaTime;
		Scene activeScene = SceneManager.GetActiveScene();
		string text = ((Scene)(ref activeScene)).name.ToLower();
		if (text.Contains("menu"))
		{
			if (OmniPlugin.EnableScaling.Value)
			{
				float num = (2f + Mathf.Sin(Time.unscaledTime * 1.5f)) * OmniPlugin.ScalePower.Value;
				Time.timeScale = Mathf.Clamp(num, 1f, 4f);
				Time.fixedDeltaTime = 0.02f / Time.timeScale;
			}
			return;
		}
		if (OmniPlugin.EnableTextCorruption.Value && Random.value < 0.5f)
		{
			SingularityPatches.SpawnGhostText();
		}
		if (OmniPlugin.EnableTimeWarp.Value)
		{
			float num2 = Mathf.Sin(_masterClock * 0.12f);
			float num3 = Mathf.Pow(Mathf.Abs(num2), 5f);
			float num4 = 1f + num3 * OmniPlugin.TimeWarpChaos.Value;
			_internalTimeScale = Mathf.Lerp(_internalTimeScale, num4, Time.unscaledDeltaTime * 0.3f);
			Time.timeScale = _internalTimeScale;
			Time.fixedDeltaTime = 0.005f;
		}
		else
		{
			Time.timeScale = 1f;
			Time.fixedDeltaTime = 0.02f;
		}
		if (OmniPlugin.EnableRealityShifts.Value)
		{
			_realityTimer += Time.deltaTime;
			if (_realityTimer > OmniPlugin.RealityTimerLimit.Value)
			{
				CurrentReality = Random.Range(0, 10);
				_realityTimer = 0f;
				_flippedObjects.Clear();
				ApplyMassiveShift(CurrentReality);
			}
		}
		Vector3 val = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : Vector3.zero);
		if (val == Vector3.zero)
		{
			return;
		}
		Collider[] array = Physics.OverlapSphere(val, 45f);
		foreach (Collider val2 in array)
		{
			if ((Object)(object)val2 == (Object)null || ((Component)val2).gameObject.isStatic || IsExcluded(((Object)val2).name))
			{
				continue;
			}
			GameObject gameObject = ((Component)val2).gameObject;
			int instanceID = ((Object)gameObject).GetInstanceID();
			Rigidbody component = gameObject.GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null && ((Object)gameObject).name.ToLower().Contains("valuable") && OmniPlugin.EnableGravityChaos.Value)
			{
				Vector3 val3 = new Vector3(0f, -9.81f, 0f) - Physics.gravity;
				component.AddForce(val3, (ForceMode)5);
			}
			if (OmniPlugin.EnableUpsideDown.Value && !_flippedObjects.Contains(instanceID) && Random.value < 0.01f * Time.deltaTime)
			{
				Transform transform = gameObject.transform;
				transform.localRotation *= Quaternion.Euler((float)((Random.value < 0.5f) ? 180 : 0), (float)Random.Range(0, 360), 180f);
				_flippedObjects.Add(instanceID);
			}
			if (OmniPlugin.EnableScaling.Value)
			{
				if (!_baseScales.ContainsKey(instanceID))
				{
					_baseScales[instanceID] = gameObject.transform.localScale;
				}
				float num5 = 1f;
				if (OmniPlugin.EnablePulse.Value)
				{
					float num6 = Mathf.Sin(_masterClock * 2.5f + (float)instanceID * 0.15f);
					num5 = 1f + num6 * (0.12f * OmniPlugin.PulseIntensity.Value);
				}
				gameObject.transform.localScale = _baseScales[instanceID] * (OmniPlugin.ScalePower.Value * 1.8f) * num5;
			}
			if (OmniPlugin.EnableVisualEffects.Value)
			{
				Renderer component2 = gameObject.GetComponent<Renderer>();
				if ((Object)(object)component2 != (Object)null)
				{
					ApplyAdvancedVisuals(component2, instanceID);
				}
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	private static void CorruptUIPrices(Text __instance, ref string value)
	{
		if ((value.Contains("$") || Regex.IsMatch(value, "\\d")) && Random.value < 0.5f)
		{
			value = "0x" + Random.Range(1000, 9999).ToString("X") + " !!";
		}
	}

	private void ApplyAdvancedVisuals(Renderer ren, int id)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		ren.material.EnableKeyword("_EMISSION");
		string text = OmniPlugin.ColorMode.Value.ToLower();
		Color val = Color.white;
		float num = Time.time * OmniPlugin.RainbowSpeed.Value;
		switch (text)
		{
		case "rainbow":
			val = Color.HSVToRGB((num * 0.15f + (float)id * 0.03f) % 1f, 0.8f, 1f);
			break;
		case "galaxy":
		{
			float num2 = ((Component)ren).transform.position.x * 0.2f;
			float num3 = ((Component)ren).transform.position.y * 0.2f;
			float num4 = Mathf.Sin(num * 0.5f + num2) * 0.5f + 0.5f;
			float num5 = Mathf.Sin(num * 0.3f + num3 + 2f) * 0.5f + 0.5f;
			float num6 = Mathf.Sin(num * 0.7f + num2 + num3 + 4f) * 0.5f + 0.5f;
			((Color)(ref val))..ctor(num4, num5, num6);
			break;
		}
		case "negative":
			if (ren.material.HasProperty("_Color"))
			{
				Color color = ren.material.color;
				((Color)(ref val))..ctor(1f - color.r, 1f - color.g, 1f - color.b);
			}
			break;
		case "reality":
			val = GetMoodColor();
			break;
		}
		if (ren.material.HasProperty("_Color"))
		{
			ren.material.color = Color.Lerp(ren.material.color, val, Time.deltaTime * 2f);
		}
		ren.material.SetColor("_EmissionColor", val * OmniPlugin.EmissionBrightness.Value);
	}

	public bool IsExcluded(string n)
	{
		n = n.ToLower();
		return n.Contains("player") || n.Contains("shake") || n.Contains("main") || n.Contains("collider") || n.Contains("tilt") || n.Contains("noise") || n.Contains("avatar") || n.Contains("crawl") || n.Contains("valuable") || n.Contains("bob") || n.Contains("position") || n.Contains("jump") || n.Contains("controller") || n.Contains("camera") || n.Contains("stand") || n.Contains("tumble") || n.Contains("extraction") || n.Contains("area") || n.Contains("trigger") || n.Contains("surplus") || n.Contains("extraction point") || n.Contains("extractionarea") || n.Contains("safety") || n.Contains("safe") || n.Contains("noise") || n.Contains("avatar") || n.Contains("crawl") || n.Contains("crouch") || n.Contains("collision") || n.Contains("floor");
	}

	public static Color GetMoodColor()
	{
		//IL_0029: 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_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: 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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		return (Color)(CurrentReality switch
		{
			0 => Color.red, 
			1 => Color.blue, 
			2 => Color.yellow, 
			3 => Color.green, 
			4 => Color.magenta, 
			5 => new Color(1f, 0.5f, 0f), 
			_ => Color.white, 
		});
	}

	[HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[]
	{
		typeof(AudioClip),
		typeof(float)
	})]
	[HarmonyPrefix]
	private static void RandomSoundSwap(AudioSource __instance, ref AudioClip clip)
	{
		if (!OmniPlugin.SwapSounds.Value || (Object)(object)clip == (Object)null)
		{
			return;
		}
		if (!_soundPool.Contains(clip))
		{
			_soundPool.Add(clip);
			if (_soundPool.Count > 30)
			{
				_soundPool.RemoveAt(0);
			}
		}
		if (_soundPool.Count > 5 && Random.value < 0.25f)
		{
			clip = _soundPool[Random.Range(0, _soundPool.Count)];
		}
	}

	private void ApplyMassiveShift(int mode)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		Physics.gravity = _originalGravity * OmniPlugin.GravityPower.Value;
		if (OmniPlugin.EnableChaosSpawns.Value)
		{
		}
		switch (mode)
		{
		case 0:
			Physics.gravity *= -1.8f;
			break;
		case 1:
			Physics.gravity = Vector3.zero;
			break;
		case 5:
			Physics.gravity *= 12f;
			break;
		}
	}
}
public class EnvironmentMutator : MonoBehaviour
{
	private void Update()
	{
		//IL_0080: 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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: 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_0088: 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)
		if (OmniPlugin.EnableFog.Value)
		{
			RenderSettings.fog = true;
			RenderSettings.fogMode = (FogMode)3;
			RenderSettings.fogDensity = OmniPlugin.FogBaseDensity.Value;
			Color val = default(Color);
			((Color)(ref val))..ctor(0.15f, 0.15f, 0.15f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.3f, 0f, 0f);
			Color val3 = ((OmniCore.CurrentReality != 0 && OmniCore.CurrentReality != 5) ? val : val2);
			RenderSettings.fogColor = Color.Lerp(RenderSettings.fogColor, val3, Time.deltaTime * 0.5f);
		}
	}
}
[HarmonyPatch]
public static class SingularityPatches
{
	private static string[] syms = new string[15]
	{
		"§", "æ", "ERROR", "⚠", "☣", "Ø", "µ", "¶", "7", "0x",
		"!", "?", "█", "░", "╬"
	};

	private static string[] errs = new string[15]
	{
		"MUM_HELP!", "⚠", "GET_OUT", "EXIT WHILE YOU CAN", "HELP_ME", "BYE_BYE", "SYSTEM_BREACH", "HEADACHE", "CORRUPT", "FATAL",
		"QUIT", "DELETE SAVE", "ERROR", "INSTALL MALWARE", "CRITICAL_FAIL"
	};

	private static float _lastT;

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

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	private static void CorruptText(TMP_Text __instance, ref string value)
	{
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		if (OmniPlugin.CorruptionChance.Value <= 0f || string.IsNullOrEmpty(value) || value.Contains("Omni") || value.Contains("Config") || value.Contains("Speed") || value.Contains("Power") || value.Contains("Intensity") || value.Contains("Core") || value.Contains("Chaos") || value.Contains("Toggles") || value.Contains("Timer") || value.Contains("Visuals") || value.Contains("Text") || value.Contains("Mods") || value.Contains("Audio") || value.Contains("General") || value.Contains("Density") || value.Contains("Chance") || value.Contains("Brightness") || value.Contains("Warp") || value.Contains("Volume") || value.Contains("On") || value.Contains("Enable") || value.Contains("<") || value.Contains(">") || value.Contains("Off") || value.Contains("ON") || value.Contains("OFF"))
		{
			return;
		}
		if (Time.unscaledTime >= _lastT + OmniPlugin.TextUpdateSpeed.Value)
		{
			_lastT = Time.unscaledTime;
			_cache.Clear();
		}
		int instanceID = ((Object)__instance).GetInstanceID();
		if (_cache.ContainsKey(instanceID))
		{
			value = _cache[instanceID];
			return;
		}
		if (Random.value < 0.2f)
		{
			__instance.fontSize = Random.Range(10, 50);
			((Graphic)__instance).color = Color.red;
			value = errs[Random.Range(0, errs.Length)];
		}
		if (OmniPlugin.TextFloatIntensity.Value > 0f)
		{
			Transform transform = __instance.transform;
			transform.localPosition += Vector2.op_Implicit(Random.insideUnitCircle) * (OmniPlugin.TextFloatIntensity.Value * 0.05f);
		}
		if (Random.value < OmniPlugin.CorruptionChance.Value)
		{
			if (Random.value < 0.25f)
			{
				char[] array = value.ToCharArray();
				for (int i = 0; i < array.Length; i++)
				{
					if (Random.value < 0.5f)
					{
						array[i] = syms[Random.Range(0, syms.Length)][0];
					}
				}
				value = new string(array);
			}
			else
			{
				value = errs[Random.Range(0, errs.Length)];
			}
		}
		_cache[instanceID] = value;
	}

	public static void SpawnGhostText()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("GhostText");
		GameObject obj = GameObject.Find("Canvas");
		Canvas val2 = ((obj != null) ? obj.GetComponent<Canvas>() : null);
		if (!((Object)(object)val2 == (Object)null))
		{
			val.transform.SetParent(((Component)val2).transform, false);
			TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = errs[Random.Range(0, errs.Length)];
			((Graphic)val3).color = new Color(Random.value, 0f, 0f, 0.8f);
			((TMP_Text)val3).fontSize = Random.Range(20, 80);
			RectTransform component = val.GetComponent<RectTransform>();
			((Transform)component).localPosition = new Vector3((float)Random.Range(-500, 500), (float)Random.Range(-400, 400), 0f);
			((Transform)component).localRotation = Quaternion.Euler(0f, 0f, (float)Random.Range(0, 360));
			Object.Destroy((Object)(object)val, 0.5f);
		}
	}

	[HarmonyPatch(typeof(AudioSource), "Play", new Type[] { })]
	[HarmonyPrefix]
	private static void PitchChaos(AudioSource __instance)
	{
		if (OmniPlugin.PitchWarpRange.Value > 0f)
		{
			float num = OmniPlugin.PitchWarpRange.Value * 0.5f;
			__instance.pitch *= Random.Range(1f - num, 1f + num);
			__instance.volume *= Random.Range(0.8f, 1.2f);
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	private static void ForceLightColor(Light __instance, ref Color value)
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: 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)
		string text = OmniPlugin.ColorMode.Value.ToLower();
		if (text == "rainbow")
		{
			float num = (Time.time * OmniPlugin.RainbowSpeed.Value * 0.2f + ((Component)__instance).transform.position.x * 0.01f) % 1f;
			value = Color.HSVToRGB(num, 0.6f, 1f);
		}
		else
		{
			value = OmniCore.GetMoodColor();
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPrefix]
	private static bool DisableFlicker()
	{
		return false;
	}
}
public class MenuSynthesizer : MonoBehaviour
{
	private AudioSource _s;

	private void Update()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (OmniPlugin.SynthVolume.Value <= 0f)
		{
			return;
		}
		Scene activeScene = SceneManager.GetActiveScene();
		if (!((Scene)(ref activeScene)).name.ToLower().Contains("menu"))
		{
			return;
		}
		if ((Object)(object)_s == (Object)null)
		{
			_s = ((Component)this).gameObject.AddComponent<AudioSource>();
		}
		if (!_s.isPlaying)
		{
			AudioClip val = AudioClip.Create("n", 8000, 1, 44100, false);
			float[] array = new float[8000];
			float num = Random.Range(30, 400);
			for (int i = 0; i < 8000; i++)
			{
				array[i] = ((Mathf.Repeat((float)i * num / 44100f, 1f) > 0.5f) ? 0.05f : (-0.05f));
			}
			val.SetData(array, 0);
			_s.PlayOneShot(val, OmniPlugin.SynthVolume.Value);
		}
	}
}