Decompiled source of UltraTweaker v1.1.2

plugins/UltraTweaker/UltraTweaker.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UltraTweaker.Handlers;
using UltraTweaker.SettingUI;
using UltraTweaker.SettingUI.UIElements;
using UltraTweaker.SettingUI.UIElements.Impl;
using UltraTweaker.Subsettings;
using UltraTweaker.Subsettings.Impl;
using UltraTweaker.Tweaks;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
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: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("UltraTweaker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Tweaks your Ultra.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0bf1468427ab9448bed0f0fef4007e7629d7a1cf")]
[assembly: AssemblyProduct("UltraTweaker")]
[assembly: AssemblyTitle("UltraTweaker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UltraTweaker
{
	[BepInPlugin("waffle.ultrakill.ultratweaker", "UltraTweaker", "1.1.2")]
	public class UltraTweaker : BaseUnityPlugin
	{
		public const string GUID = "waffle.ultrakill.ultratweaker";

		public const string Name = "UltraTweaker";

		public const string Version = "1.1.2";

		public static Dictionary<Type, Tweak> AllTweaks = new Dictionary<Type, Tweak>();

		internal static List<Assembly> AssembliesToCheck = new List<Assembly> { Assembly.GetExecutingAssembly() };

		public static void AddAssembly(Assembly asm)
		{
			AssembliesToCheck.Add(asm);
			Tweak.RefreshTweakHolder();
			SaveHandler.LoadData();
		}

		public void Start()
		{
			Debug.Log((object)"UltraTweaker v1.1.2 has started.");
			AssetHandler.LoadBundle();
			Tweak.CreateTweakHolder();
			SaveHandler.LoadData();
			SettingUIHandler.Patch();
			MutatorHandler.Patch();
		}

		public void OnDestroy()
		{
			SaveHandler.SaveData();
		}
	}
	public static class PathUtils
	{
		public static string GameDirectory()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			string text = Application.dataPath;
			if ((int)Application.platform == 1)
			{
				text = Utility.ParentDirectory(text, 2);
			}
			else if ((int)Application.platform == 2)
			{
				text = Utility.ParentDirectory(text, 1);
			}
			return text;
		}

		public static string ModPath(Assembly asm = null)
		{
			if (asm == null)
			{
				asm = Assembly.GetExecutingAssembly();
			}
			return asm.Location.Substring(0, asm.Location.LastIndexOf(Path.DirectorySeparatorChar));
		}
	}
	public static class GameObjectUtils
	{
		public static GameObject ChildByName(this GameObject from, string name)
		{
			List<GameObject> list = new List<GameObject>();
			int i;
			for (i = 0; i < from.transform.childCount; i++)
			{
				list.Add(((Component)from.transform.GetChild(i)).gameObject);
			}
			if (i == 0)
			{
				return null;
			}
			for (int j = 0; j < list.Count; j++)
			{
				if (((Object)list[j]).name == name)
				{
					return list[j];
				}
			}
			return null;
		}

		public static List<GameObject> FindSceneObjects(string sceneName)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			List<GameObject> list = new List<GameObject>();
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			foreach (GameObject val in array)
			{
				Scene scene = val.scene;
				if (((Scene)(ref scene)).name == sceneName)
				{
					list.Add(val);
				}
			}
			return list;
		}

		public static List<GameObject> ChildrenList(this GameObject from)
		{
			List<GameObject> list = new List<GameObject>();
			for (int i = 0; i < from.transform.childCount; i++)
			{
				list.Add(((Component)from.transform.GetChild(i)).gameObject);
			}
			return list;
		}
	}
	public class UltrakillUtils
	{
		public static GameObject NearestEnemy(Vector3 point, float maxDistance)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			float num = maxDistance;
			GameObject result = null;
			GameObject[] array = GameObject.FindGameObjectsWithTag("Enemy");
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if ((Object)(object)val.GetComponent<EnemyIdentifier>() != (Object)null && !val.GetComponent<EnemyIdentifier>().dead && Vector3.Distance(point, val.transform.position) < num)
				{
					num = Vector3.Distance(point, val.transform.position);
					result = val;
				}
			}
			return result;
		}
	}
	public class DisableDoubleRender : MonoBehaviour
	{
		private EnemyIdentifier eid;

		private DoubleRender[] dr;

		public void Start()
		{
			eid = null;
			dr = null;
		}

		public void Update()
		{
			if (dr == null && dr == null)
			{
				dr = ((Component)this).GetComponentsInChildren<DoubleRender>(true);
			}
			if (dr != null && dr.Length != 0)
			{
				DoubleRender[] array = dr;
				foreach (DoubleRender val in array)
				{
					val.currentCam.RemoveCommandBuffer((CameraEvent)16, val.cb);
				}
			}
		}
	}
}
namespace UltraTweaker.Tweaks
{
	public class Metadata : Attribute
	{
		public string Name { get; private set; }

		public string ID { get; private set; }

		public string Description { get; private set; }

		public Metadata(string Name, string ID, string Description = "")
		{
			this.Name = Name;
			this.ID = ID;
			this.Description = Description;
		}
	}
	public class TweakMetadata : Metadata
	{
		public string PageId { get; private set; }

		public int InsertAt { get; private set; }

		public Sprite Icon { get; private set; }

		public bool AllowCG { get; private set; }

		public bool IsMutator { get; private set; }

		public TweakMetadata(string Name, string ID, string Description = "", string PageId = "waffle.ultrakill.ultratweaker.misc", int InsertAt = 0, string IconName = null, bool AllowCG = true, bool IsMutator = false)
			: base(Name, ID, Description)
		{
			if (IconName != null)
			{
				Icon = AssetHandler.GetCachedAsset<Sprite>(IconName);
			}
			this.PageId = PageId;
			this.InsertAt = InsertAt;
			this.AllowCG = AllowCG;
			this.IsMutator = IsMutator;
		}
	}
	public class Tweak : MonoBehaviour
	{
		private static GameObject _tweakHolder;

		public Dictionary<string, Subsetting> Subsettings = new Dictionary<string, Subsetting>();

		public static Dictionary<Type, Tweak> TypeToTweak = new Dictionary<Type, Tweak>();

		private bool _isEnabled = false;

		private TweakUIElement _element;

		public bool IsEnabled
		{
			get
			{
				return _isEnabled;
			}
			set
			{
				if (_isEnabled != value)
				{
					_isEnabled = value;
					if (!value)
					{
						Debug.Log((object)("Disabling tweak " + ((object)this).GetType().Name + "."));
						OnTweakDisabled();
					}
					else
					{
						Debug.Log((object)("Enabling tweak " + ((object)this).GetType().Name + "."));
						OnTweakEnabled();
					}
				}
			}
		}

		public TweakUIElement Element
		{
			get
			{
				if (_element == null)
				{
					_element = new TweakUIElement(this);
				}
				return _element;
			}
		}

		public static void CreateTweakHolder()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_tweakHolder = new GameObject("UT Tweak Holder - don't destroy!");
			Object.DontDestroyOnLoad((Object)(object)_tweakHolder);
			foreach (Assembly item in UltraTweaker.AssembliesToCheck)
			{
				Debug.Log((object)("Searching " + item.GetName().Name + " for tweaks."));
				foreach (TypeInfo item2 in item.DefinedTypes.Where((TypeInfo type) => type.IsDefined(typeof(Metadata), inherit: false)))
				{
					Debug.Log((object)("Found tweak; " + item2.Name + "."));
					Tweak tweak = (Tweak)(object)_tweakHolder.AddComponent((Type)item2);
					((Behaviour)tweak).enabled = false;
					UltraTweaker.AllTweaks.Add(item2, tweak);
				}
			}
		}

		public static void RefreshTweakHolder()
		{
			foreach (Assembly item in UltraTweaker.AssembliesToCheck)
			{
				Debug.Log((object)("Searching " + item.GetName().Name + " for tweaks."));
				foreach (TypeInfo item2 in item.DefinedTypes.Where((TypeInfo type) => type.IsDefined(typeof(Metadata), inherit: false)))
				{
					if (!UltraTweaker.AllTweaks.ContainsKey(item2))
					{
						Debug.Log((object)("Found tweak; " + item2.Name + "."));
						Tweak tweak = (Tweak)(object)_tweakHolder.AddComponent((Type)item2);
						((Behaviour)tweak).enabled = false;
						UltraTweaker.AllTweaks.Add(item2, tweak);
					}
				}
			}
		}

		public static T GetInstance<T>() where T : Tweak
		{
			return TypeToTweak[typeof(T)] as T;
		}

		public virtual void OnTweakEnabled()
		{
			SceneManager.sceneLoaded += OnSceneLoad;
			if (!TypeToTweak.ContainsKey(((object)this).GetType()))
			{
				TypeToTweak.Add(((object)this).GetType(), this);
			}
			((Behaviour)this).enabled = true;
		}

		public virtual void OnTweakDisabled()
		{
			SceneManager.sceneLoaded -= OnSceneLoad;
			((Behaviour)this).enabled = false;
		}

		public virtual void OnSubsettingUpdate()
		{
		}

		public virtual void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
		}

		public static bool IsGameplayScene()
		{
			string[] source = new string[6] { "Intro", "Bootstrap", "Main Menu", "Level 2-S", "Intermission1", "Intermission2" };
			return !source.Contains(SceneHelper.CurrentScene);
		}

		public void SetControls(bool active)
		{
			_element.SetControlsActive(active);
			foreach (Subsetting value in Subsettings.Values)
			{
				value.Element.SetControlsActive(active);
			}
		}
	}
}
namespace UltraTweaker.Tweaks.Impl
{
	public class CGUtils : Tweak
	{
		private GameObject _originalPanel;

		private GameObject _panel;

		private Text _waves;

		private Text _enemies;

		private Text _time;

		private Text _kills;

		private Text _style;

		private StatsManager _sm;

		private LevelStatsEnabler _lse;

		private float _minutes;

		private float _seconds;

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			if (SceneHelper.CurrentScene == "Endless")
			{
				Create();
			}
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			if ((Object)(object)_panel != (Object)null)
			{
				Object.Destroy((Object)(object)_panel);
			}
		}

		public void Create()
		{
			_lse = ((Component)MonoSingleton<CanvasController>.Instance).gameObject.GetComponentInChildren<LevelStatsEnabler>(true);
			_sm = MonoSingleton<StatsManager>.Instance;
			if ((Object)(object)_originalPanel == (Object)null)
			{
				_originalPanel = AssetHandler.Bundle.LoadAsset<GameObject>("Cybergrind Stats.prefab");
			}
			_panel = Object.Instantiate<GameObject>(_originalPanel, ((Component)_lse).transform);
			_waves = _panel.ChildByName("Waves Title").ChildByName("Waves").GetComponent<Text>();
			_enemies = _panel.ChildByName("Enemies Title").ChildByName("Enemies").GetComponent<Text>();
			_time = _panel.ChildByName("Time Title").ChildByName("Time").GetComponent<Text>();
			_kills = _panel.ChildByName("Kills Title").ChildByName("Kills").GetComponent<Text>();
			_style = _panel.ChildByName("Style Title").ChildByName("Style").GetComponent<Text>();
			_waves.text = "0";
			_enemies.text = "0";
			_time.text = "00:00.000";
			_kills.text = "0";
			_style.text = "0";
			_panel.SetActive(false);
		}

		public void Update()
		{
			if (SceneHelper.CurrentScene == "Endless" && (Object)(object)_lse != (Object)null)
			{
				if (!((Component)_lse).gameObject.activeSelf)
				{
					((Component)_lse).gameObject.SetActive(true);
				}
				if ((Object)(object)_lse.levelStats != (Object)(object)_panel)
				{
					_lse.levelStats = _panel;
				}
				EndlessGrid instance = MonoSingleton<EndlessGrid>.Instance;
				_waves.text = instance.currentWave.ToString();
				_enemies.text = (instance.tempEnemyAmount - instance.anw.deadEnemies).ToString();
				_kills.text = _sm.kills.ToString();
				_style.text = _sm.stylePoints.ToString();
				_seconds = _sm.seconds;
				_minutes = 0f;
				while (_seconds >= 60f)
				{
					_seconds -= 60f;
					_minutes += 1f;
				}
				_time.text = _minutes + ":" + _seconds.ToString("00.000");
			}
		}

		public override void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			if (SceneHelper.CurrentScene == "Endless")
			{
				Create();
			}
		}
	}
	[TweakMetadata("Close Quarters", "waffle.ultrakill.ultratweaker.mutator_close_quarters", "Blesses enemies when far.", "waffle.ultrakill.ultratweaker.mutators", 0, "Cross", true, true)]
	public class CloseQuarters : Tweak
	{
		public static class DistancePatches
		{
			[HarmonyPatch(typeof(EnemyIdentifier), "Awake")]
			[HarmonyPostfix]
			public static void AddComp(EnemyIdentifier __instance)
			{
				((Component)__instance).gameObject.AddComponent<BlessWhenFar>();
			}
		}

		public class BlessWhenFar : MonoBehaviour
		{
			private EnemyIdentifier eid;

			public void Start()
			{
				eid = ((Component)this).GetComponent<EnemyIdentifier>();
			}

			public void Update()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				if (Vector3.Distance(((Component)this).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position) > (float)Tweak.GetInstance<CloseQuarters>().Subsettings["enemy_distance"].GetValue<int>())
				{
					if (!eid.blessed)
					{
						eid.Bless(false);
					}
				}
				else if (eid.blessed)
				{
					eid.Unbless(false);
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_close_quarters");

		public CloseQuarters()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting> { 
			{
				"enemy_distance",
				new IntSubsetting(this, new Metadata("Distance", "enemy_distance", "Distance to bless at."), new SliderIntSubsettingElement("{0}m"), 15, 30, 5)
			} };
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(DistancePatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Explode On Death", "waffle.ultrakill.ultratweaker.explode_self", "Explode and destroy everything when you die.", "waffle.ultrakill.ultratweaker.fun", 1, null, true, false)]
	public class ExplodeOnDeath : Tweak
	{
		public static class ExplosionPatches
		{
			[HarmonyPatch(typeof(NewMovement), "GetHurt")]
			[HarmonyPostfix]
			private static void ExplodeOnDeath()
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: 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)
				if (MonoSingleton<NewMovement>.Instance.dead)
				{
					GameObject explosion = MonoSingleton<GunSetter>.Instance.shotgunPump[0].LoadAssetAsync<GameObject>().WaitForCompletion().GetComponent<Shotgun>()
						.explosion;
					GameObject val = Object.Instantiate<GameObject>(explosion, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.rotation);
					Explosion[] componentsInChildren = val.GetComponentsInChildren<Explosion>();
					foreach (Explosion val2 in componentsInChildren)
					{
						val2.enemyDamageMultiplier = 15f;
						val2.maxSize *= 15f;
						val2.damage = 0;
					}
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.explode_self");

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(ExplosionPatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Fall Damage", "waffle.ultrakill.ultratweaker.mutator_fall_damage", "Take damage when you hit the floor too hard.", "waffle.ultrakill.ultratweaker.mutators", 1, "Bone", true, true)]
	public class FallDamage : Tweak
	{
		public class CheckVelocityOnHit : MonoBehaviour
		{
			private float Stored;

			private static GameObject LastCrunch;

			public void Start()
			{
				Immunity = true;
				((MonoBehaviour)this).Invoke("RemoveImmunity", 2f);
			}

			public void OnCollisionEnter(Collision col)
			{
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				if (!Immunity && (col.gameObject.layer == 8 || col.gameObject.layer == 24) && (col.gameObject.CompareTag("Floor") || col.gameObject.CompareTag("Moving")) && Stored <= -40f && (!MonoSingleton<NewMovement>.Instance.stillHolding || MonoSingleton<NewMovement>.Instance.boostCharge <= 100f))
				{
					float num = -(int)Stored;
					LastCrunch = Object.Instantiate<GameObject>(CrunchSound, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity, ((Component)this).transform);
					LastCrunch.GetComponent<AudioSource>().volume = 0.2f - Stored / 100f;
					if (MonoSingleton<NewMovement>.Instance.hp != 1 && num >= 100f)
					{
						num = 99f;
					}
					MonoSingleton<NewMovement>.Instance.GetHurt((int)num, false, 0f, false, true, 0.35f, false);
					((MonoBehaviour)this).Invoke("DestroyCrunch", 2f);
					MonoSingleton<CameraController>.Instance.CameraShake(num / 30f);
				}
			}

			public void LateUpdate()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				Stored = ((Component)this).GetComponent<Rigidbody>().velocity.y;
			}

			private void DestroyCrunch()
			{
				Object.Destroy((Object)(object)LastCrunch);
			}

			public void RemoveImmunity()
			{
				Immunity = false;
			}
		}

		public static GameObject CrunchSound;

		public static bool Immunity;

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			if ((Object)(object)CrunchSound == (Object)null)
			{
				CrunchSound = AssetHandler.Bundle.LoadAsset<GameObject>("CrunchSound.prefab");
			}
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
		}

		private void Update()
		{
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null && (Object)(object)((Component)MonoSingleton<NewMovement>.Instance).gameObject.GetComponent<CheckVelocityOnHit>() == (Object)null)
			{
				((Component)MonoSingleton<NewMovement>.Instance).gameObject.AddComponent<CheckVelocityOnHit>();
			}
		}
	}
	[TweakMetadata("Floor Is Lava", "waffle.ultrakill.ultratweaker.mutator_floor_is_lava", "Take damage when on the floor.", "waffle.ultrakill.ultratweaker.mutators", 2, "Lava", true, true)]
	public class FloorIsLava : Tweak
	{
		private float _toRemove = 0f;

		private float _onFloorFor;

		public FloorIsLava()
		{
			Subsettings = new Dictionary<string, Subsetting>
			{
				{
					"damage_after",
					new FloatSubsetting(this, new Metadata("Damage After", "damage_after", "Time before damage starts."), new SliderFloatSubsettingElement("{0}s"), 0.1f, 5f, 0f)
				},
				{
					"damage_per_second",
					new IntSubsetting(this, new Metadata("Damage Per Second", "damage_per_second", "Damage per second."), new SliderIntSubsettingElement(), 25, 100, 0)
				}
			};
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
		}

		private void Update()
		{
			if (!((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null))
			{
				return;
			}
			if (MonoSingleton<NewMovement>.Instance.gc.touchingGround)
			{
				_onFloorFor += Time.deltaTime;
			}
			else
			{
				_onFloorFor = 0f;
			}
			if (MonoSingleton<StatsManager>.Instance.timer && _onFloorFor > Subsettings["damage_after"].GetValue<float>())
			{
				_toRemove += Time.deltaTime * (float)Subsettings["damage_per_second"].GetValue<int>();
				if ((int)_toRemove >= 1)
				{
					NewMovement instance = MonoSingleton<NewMovement>.Instance;
					instance.hp -= (int)_toRemove;
					_toRemove -= (int)_toRemove;
				}
				if (MonoSingleton<NewMovement>.Instance.hp <= 0 && !MonoSingleton<NewMovement>.Instance.dead)
				{
					MonoSingleton<NewMovement>.Instance.GetHurt(int.MaxValue, false, 1f, true, true, 0.35f, false);
				}
			}
		}
	}
	[TweakMetadata("Skull Florpification", "waffle.ultrakill.ultratweaker.florpify_:3", "Replace skulls with Florp.", "waffle.ultrakill.ultratweaker.fun", 0, null, true, false)]
	public class Florpify : Tweak
	{
		public static class FlorpyPatches
		{
			[HarmonyPatch(typeof(Skull), "Start")]
			[HarmonyPostfix]
			private static void CreateFlorpy(Skull __instance)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				Renderer component = ((Component)__instance).gameObject.GetComponent<Renderer>();
				if ((Object)(object)component != (Object)null)
				{
					component.enabled = false;
					GameObject val = Object.Instantiate<GameObject>(_florps[((Component)__instance).GetComponent<ItemIdentifier>().itemType], ((Component)component).transform);
					val.GetComponentInChildren<Renderer>().material.shader = component.material.shader;
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.florpify_:3");

		private static Dictionary<ItemType, GameObject> _florps;

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			if (_florps == null)
			{
				_florps = new Dictionary<ItemType, GameObject>
				{
					{
						(ItemType)1,
						AssetHandler.Bundle.LoadAsset<GameObject>("Blue Florp")
					},
					{
						(ItemType)2,
						AssetHandler.Bundle.LoadAsset<GameObject>("Red Florp")
					}
				};
			}
			_harmony.PatchAll(typeof(FlorpyPatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Force Gun Panel", "waffle.ultrakill.ultratweaker.force_gun", "Makes the gun panel always appear. So that you can use the other Rail charge indicator.", "waffle.ultrakill.ultratweaker.hud", 3, null, true, false)]
	public class ForceGunPanel : Tweak
	{
		public static class ForceGunPatches
		{
			[HarmonyPatch(typeof(GunControl), "Start")]
			[HarmonyPostfix]
			private static void PatchGunPanel(GunControl __instance)
			{
				if (Tweak.IsGameplayScene())
				{
					__instance.gunPanel[0].SetActive(true);
				}
			}

			[HarmonyPatch(typeof(GunSetter), "ResetWeapons")]
			[HarmonyPostfix]
			private static void PatchGunPanelSetter(GunSetter __instance)
			{
				if (Tweak.IsGameplayScene())
				{
					MonoSingleton<GunControl>.Instance.gunPanel[0].SetActive(true);
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.force_gun");

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(ForceGunPatches));
			if (Tweak.IsGameplayScene())
			{
				MonoSingleton<GunControl>.Instance.gunPanel[0].SetActive(true);
			}
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
			MonoSingleton<GunControl>.Instance.gunPanel[0].SetActive(false);
		}
	}
	[TweakMetadata("FPS Counter", "waffle.ultrakill.ultratweaker.fps_meter", "Shows a counter with your frames per second.", "waffle.ultrakill.ultratweaker.hud", 2, null, true, false)]
	public class FPSCount : Tweak
	{
		private GameObject _originalCounter;

		private GameObject _counter;

		private Text _text;

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			if ((Object)(object)_originalCounter == (Object)null)
			{
				_originalCounter = AssetHandler.Bundle.LoadAsset<GameObject>("FPS");
			}
			CreateCounter();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			Object.Destroy((Object)(object)_counter);
		}

		public void CreateCounter()
		{
			if ((Object)(object)MonoSingleton<CanvasController>.Instance != (Object)null)
			{
				_counter = Object.Instantiate<GameObject>(_originalCounter, ((Component)MonoSingleton<CanvasController>.Instance).transform);
				_text = _counter.ChildByName("Count").GetComponent<Text>();
			}
		}

		public override void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			CreateCounter();
		}

		public void Update()
		{
			if ((Object)(object)_text != (Object)null)
			{
				float num = 1f / Time.unscaledDeltaTime;
				_text.text = $"FPS: {(int)num}";
			}
		}
	}
	[TweakMetadata("Fragility", "waffle.ultrakill.ultratweaker.mutator_fragility", "Change your max health.", "waffle.ultrakill.ultratweaker.mutators", 3, "Fragility", true, true)]
	public class Fragility : Tweak
	{
		public static class FragilityPatches
		{
			[HarmonyPatch(typeof(NewMovement), "Update")]
			[HarmonyPostfix]
			private static void LimitHp(NewMovement __instance)
			{
				int value = Tweak.GetInstance<Fragility>().Subsettings["max_health"].GetValue<int>();
				if (__instance.antiHp < (float)(100 - value))
				{
					__instance.antiHp = 100 - value;
				}
				if (__instance.hp > value)
				{
					__instance.hp = value;
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_fragility");

		public Fragility()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting> { 
			{
				"max_health",
				new IntSubsetting(this, new Metadata("Max Health", "max_health", "Maximum player health."), new SliderIntSubsettingElement(), 25, 100, 1)
			} };
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(FragilityPatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Fresh", "waffle.ultrakill.ultratweaker.mutator_fresh", "Hurts you if you're not stylish.", "waffle.ultrakill.ultratweaker.mutators", 4, "Fresh", true, true)]
	public class Fresh : Tweak
	{
		private float _toRemove = 0f;

		public Fresh()
		{
			Subsettings = new Dictionary<string, Subsetting>
			{
				{
					"fresh",
					new IntSubsetting(this, new Metadata("FRESH", "fresh", "HP drained per second on Fresh."), new SliderIntSubsettingElement(), 0, 100, 0)
				},
				{
					"used",
					new IntSubsetting(this, new Metadata("USED", "used", "HP drained per second on Used."), new SliderIntSubsettingElement(), 0, 100, 4)
				},
				{
					"stale",
					new IntSubsetting(this, new Metadata("STALE", "stale", "HP drained per second on Stale."), new SliderIntSubsettingElement(), 0, 100, 8)
				},
				{
					"dull",
					new IntSubsetting(this, new Metadata("DULL", "dull", "HP drained per second on Dull."), new SliderIntSubsettingElement(), 0, 100, 12)
				}
			};
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
		}

		public void Update()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<StyleFreshnessState, float> dictionary = new Dictionary<StyleFreshnessState, float>
			{
				{
					(StyleFreshnessState)0,
					Subsettings["fresh"].GetValue<int>()
				},
				{
					(StyleFreshnessState)1,
					Subsettings["used"].GetValue<int>()
				},
				{
					(StyleFreshnessState)2,
					Subsettings["stale"].GetValue<int>()
				},
				{
					(StyleFreshnessState)3,
					Subsettings["dull"].GetValue<int>()
				}
			};
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null && MonoSingleton<StatsManager>.Instance.timer && MonoSingleton<GunControl>.Instance.activated)
			{
				_toRemove += dictionary[MonoSingleton<StyleHUD>.Instance.GetFreshnessState(MonoSingleton<GunControl>.Instance.currentWeapon)] * Time.deltaTime;
				if ((int)_toRemove >= 1)
				{
					NewMovement instance = MonoSingleton<NewMovement>.Instance;
					instance.hp -= (int)_toRemove;
					_toRemove -= (int)_toRemove;
				}
				if (MonoSingleton<NewMovement>.Instance.hp <= 0 && !MonoSingleton<NewMovement>.Instance.dead)
				{
					MonoSingleton<NewMovement>.Instance.GetHurt(int.MaxValue, false, 1f, true, true, 0.35f, false);
				}
			}
		}
	}
	[TweakMetadata("Fuel Leak", "waffle.ultrakill.ultratweaker.mutator_fuel_leak", "Lose health over time.", "waffle.ultrakill.ultratweaker.mutators", 5, "Leak", true, true)]
	public class FuelLeak : Tweak
	{
		private float _toRemove = 0f;

		public FuelLeak()
		{
			Subsettings = new Dictionary<string, Subsetting> { 
			{
				"drain",
				new IntSubsetting(this, new Metadata("Damage Per Second", "drain", "HP drained per second."), new SliderIntSubsettingElement(), 0, 25, 1)
			} };
		}

		public void Update()
		{
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null && MonoSingleton<StatsManager>.Instance.timer && MonoSingleton<GunControl>.Instance.activated)
			{
				_toRemove += Time.deltaTime * (float)Subsettings["drain"].GetValue<int>();
				if ((int)_toRemove >= 1)
				{
					NewMovement instance = MonoSingleton<NewMovement>.Instance;
					instance.hp -= (int)_toRemove;
					_toRemove -= (int)_toRemove;
				}
				if (MonoSingleton<NewMovement>.Instance.hp <= 0 && !MonoSingleton<NewMovement>.Instance.dead)
				{
					MonoSingleton<NewMovement>.Instance.GetHurt(int.MaxValue, false, 1f, true, true, 0.35f, false);
				}
			}
		}
	}
	[TweakMetadata("Hitstop", "waffle.ultrakill.ultratweaker.hitstop", "Change hitstop duration, change the parry flash.", "waffle.ultrakill.ultratweaker.misc", 0, null, true, false)]
	public class Hitstop : Tweak
	{
		public static class HitstopPatches
		{
			[HarmonyPatch(typeof(TimeController), "HitStop")]
			[HarmonyPrefix]
			private static void PatchHitstop(ref float length)
			{
				length *= (float)Tweak.GetInstance<Hitstop>().Subsettings["hitstop_length"].GetValue<int>() / 100f;
			}

			[HarmonyPatch(typeof(TimeController), "TrueStop")]
			[HarmonyPrefix]
			private static void PatchTruestop(ref float length)
			{
				length *= (float)Tweak.GetInstance<Hitstop>().Subsettings["truestop_length"].GetValue<int>() / 100f;
			}

			[HarmonyPatch(typeof(TimeController), "SlowDown")]
			[HarmonyPrefix]
			private static void PatchSlowdown(ref float amount)
			{
				amount *= (float)Tweak.GetInstance<Hitstop>().Subsettings["slowdown_length"].GetValue<int>() / 100f;
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.hitstop");

		public Hitstop()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting>
			{
				{
					"hitstop_length",
					new IntSubsetting(this, new Metadata("Hitstop Length", "hitstop_length", "How long hitstop lasts."), new SliderIntSubsettingElement("{0}%"), 100, 200, 0)
				},
				{
					"truestop_length",
					new IntSubsetting(this, new Metadata("Truestop Length", "truestop_length", "How long truestop lasts."), new SliderIntSubsettingElement("{0}%"), 100, 200, 0)
				},
				{
					"slowdown_length",
					new IntSubsetting(this, new Metadata("Slowdown Length", "slowdown_length", "How long slowdown lasts."), new SliderIntSubsettingElement("{0}%"), 100, 200, 0)
				}
			};
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(HitstopPatches));
			OnSubsettingUpdate();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Ice", "waffle.ultrakill.ultratweaker.mutator_ice", "Become slippery.", "waffle.ultrakill.ultratweaker.mutators", 6, "Ice", false, true)]
	public class Ice : Tweak
	{
		public static class IcePatches
		{
			[HarmonyPatch(typeof(NewMovement), "Start")]
			[HarmonyPostfix]
			public static void IcePlayer(NewMovement __instance)
			{
				__instance.modForcedFrictionMultip = Tweak.GetInstance<Ice>().Subsettings["slippyness"].GetValue<float>();
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_ice");

		public Ice()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting> { 
			{
				"slippyness",
				new FloatSubsetting(this, new Metadata("Friction", "slippyness", "How grippy you are."), new SliderFloatSubsettingElement("{0}", 2), 0.1f, 0.5f, 0f)
			} };
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(IcePatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
			MonoSingleton<NewMovement>.Instance.modForcedFrictionMultip = 1f;
		}

		public override void OnSubsettingUpdate()
		{
			MonoSingleton<NewMovement>.Instance.modForcedFrictionMultip = Tweak.GetInstance<Ice>().Subsettings["slippyness"].GetValue<float>();
		}
	}
	[TweakMetadata("Mitosis", "waffle.ultrakill.ultratweaker.mutator_mitosis", "Duplicates enemies.", "waffle.ultrakill.ultratweaker.mutators", 7, "Mitosis", false, true)]
	public class Mitosis : Tweak
	{
		public static class MitosisPatches
		{
			[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
			[HarmonyPrefix]
			public static void HmmTodayIWillUndergoMitosis(EnemyIdentifier __instance)
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)((Component)__instance).gameObject).name.Contains("(MITOSISED)"))
				{
					for (int i = 0; i < Tweak.GetInstance<Mitosis>().Subsettings["enemy_amount"].GetValue<int>() - 1; i++)
					{
						GameObject val = Object.Instantiate<GameObject>(((Component)__instance).gameObject, ((Component)__instance).transform.parent);
						((Object)val).name = ((Object)((Component)__instance).gameObject).name + "(MITOSISED)";
						val.transform.position = ((Component)__instance).transform.position;
						val.GetComponent<EnemyIdentifier>().blessed = false;
					}
				}
			}

			[HarmonyPatch(typeof(ActivateNextWave), "Awake")]
			[HarmonyPostfix]
			public static void IncreaseAnw(ActivateNextWave __instance)
			{
				GoreZone componentInParent = ((Component)__instance).gameObject.GetComponentInParent<GoreZone>();
				if ((Object)(object)componentInParent == (Object)null)
				{
					Debug.Log((object)("No GoreZone found in hierarchy of " + ((Object)((Component)__instance).gameObject).name));
					return;
				}
				Debug.Log((object)string.Format("{0} | {1} / {2} / {3}", __instance.enemyCount, ((Object)(object)((Component)componentInParent).transform.parent == (Object)null) ? "orphan" : ((Object)((Component)componentInParent).transform.parent).name, ((Object)((Component)componentInParent).transform).name, ((Object)((Component)__instance).gameObject).name));
				if (((Object)((Component)componentInParent).gameObject).name.Contains("(Clone)"))
				{
					__instance.enemyCount *= Tweak.GetInstance<Mitosis>().Subsettings["enemy_amount"].GetValue<int>();
					DeathMarker[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<DeathMarker>(true);
					foreach (DeathMarker val in componentsInChildren)
					{
						__instance.enemyCount--;
					}
					Debug.Log((object)$"{__instance.enemyCount} | Whar?");
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_mitosis");

		public static List<ActivateNextWave> AlreadyMultiplied = new List<ActivateNextWave>();

		public Mitosis()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting> { 
			{
				"enemy_amount",
				new IntSubsetting(this, new Metadata("Amount", "enemy_amount", "The amount of enemies to clone"), new SliderIntSubsettingElement(), 2, 10, 2)
			} };
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			AlreadyMultiplied.Clear();
			_harmony.PatchAll(typeof(MitosisPatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}

		public override void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			AlreadyMultiplied.Clear();
		}
	}
	[TweakMetadata("Sandify", "waffle.ultrakill.ultratweaker.mutator_sandify", "Cover enemies in sand.", "waffle.ultrakill.ultratweaker.mutators", 8, "Sandify", true, true)]
	public class Sandify : Tweak
	{
		public static class SandifyPatches
		{
			[HarmonyPatch(typeof(EnemyIdentifier), "Awake")]
			[HarmonyPostfix]
			public static void MakeSandy(EnemyIdentifier __instance)
			{
				__instance.sandified = true;
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_sandify");

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(SandifyPatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Speed", "waffle.ultrakill.ultratweaker.mutator_speed", "Speed up yourself, and enemies", "waffle.ultrakill.ultratweaker.mutators", 9, "Speed", false, true)]
	public class Speed : Tweak
	{
		public static class SpeedPatches
		{
			[HarmonyPatch(typeof(NewMovement), "Start")]
			[HarmonyPostfix]
			public static void SpeedPlayer(NewMovement __instance)
			{
				_startSpeed = __instance.walkSpeed;
				__instance.walkSpeed = _startSpeed * Tweak.GetInstance<Speed>().Subsettings["player_speed_mult"].GetValue<float>();
			}

			[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
			[HarmonyPostfix]
			public static void SpeedEnemy(EnemyIdentifier __instance)
			{
				float value = Tweak.GetInstance<Speed>().Subsettings["enemy_speed_mult"].GetValue<float>();
				if (!__instance.speedBuff)
				{
					((Component)__instance).gameObject.AddComponent<DisableDoubleRender>();
					__instance.SpeedBuff(value);
				}
				else
				{
					__instance.speedBuffModifier *= value;
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_speed");

		private static float _startSpeed;

		public Speed()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting>
			{
				{
					"player_speed_mult",
					new FloatSubsetting(this, new Metadata("Player Speed", "player_speed_mult", "Speed multiplier for the player."), new SliderFloatSubsettingElement("{0}x"), 2f, 10f, 0f)
				},
				{
					"enemy_speed_mult",
					new FloatSubsetting(this, new Metadata("Enemy Speed", "enemy_speed_mult", "Speed multiplier for the enemies."), new SliderFloatSubsettingElement("{0}x"), 2f, 10f, 0f)
				}
			};
		}

		public override void OnSubsettingUpdate()
		{
			MonoSingleton<NewMovement>.Instance.walkSpeed = _startSpeed * Subsettings["player_speed_mult"].GetValue<float>();
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				_startSpeed = MonoSingleton<NewMovement>.Instance.walkSpeed;
				MonoSingleton<NewMovement>.Instance.walkSpeed = _startSpeed * Tweak.GetInstance<Speed>().Subsettings["player_speed_mult"].GetValue<float>();
			}
			_harmony.PatchAll(typeof(SpeedPatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				MonoSingleton<NewMovement>.Instance.walkSpeed = _startSpeed;
			}
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Stat Panels", "waffle.ultrakill.ultratweaker.stat_panels", "Various info panels.", "waffle.ultrakill.ultratweaker.hud", 1, null, true, false)]
	public class StatPanels : Tweak
	{
		public class Hit
		{
			public DateTime time;

			public float dmg;

			public Hit(float dmg)
			{
				this.dmg = dmg;
				time = DateTime.Now;
			}
		}

		public class PanelPatches
		{
			[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
			[HarmonyPrefix]
			private static void SetHealthBefore(EnemyIdentifier __instance, out float __state)
			{
				__state = __instance.health;
			}

			[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
			[HarmonyPostfix]
			private static void DoHealthAfter(EnemyIdentifier __instance, float __state)
			{
				float num = __instance.health;
				if (num < 0f)
				{
					num = 0f;
				}
				float num2 = __state - num;
				if (num2 != 0f)
				{
					HitsSecond.Add(new Hit(num2));
				}
			}
		}

		private Harmony harmony = new Harmony("waffle.ultrakill.ultratweaker.stat_panels");

		private GameObject _originalPanels;

		private GameObject _currentPanels;

		private GameObject _dps;

		private Text _dpsText;

		private GameObject _speed;

		private Text _speedText;

		private GameObject _info;

		private Text _hpText;

		private Text _staminaText;

		private GameObject _weapons;

		private Image _gunImage;

		private Image _punchImage;

		private Slider _railSlider;

		public static List<Hit> HitsSecond = new List<Hit>();

		public StatPanels()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting>
			{
				{
					"info",
					new BoolSubsetting(this, new Metadata("Info Panel", "info", "Shows your health and stamina."), new BoolSubsettingElement(), defaultValue: false)
				},
				{
					"weapons",
					new BoolSubsetting(this, new Metadata("Weapon Panel", "weapons", "Shows your weapon, fist, and rail charge."), new BoolSubsettingElement(), defaultValue: false)
				},
				{
					"dps",
					new BoolSubsetting(this, new Metadata("DPS Panel", "dps", "Shows your damage per second."), new BoolSubsettingElement(), defaultValue: false)
				},
				{
					"speed",
					new BoolSubsetting(this, new Metadata("Speed Panel", "speed", "Shows your speed."), new BoolSubsettingElement(), defaultValue: false)
				},
				{
					"speed_mode",
					new IntSubsetting(this, new Metadata("Speed: Mode", "speed_mode", "Should it show total speed, or speed in each direction?"), new DropdownIntSubsettingElement(new List<string> { "(x) m/s", "(x, y, z) m/s" }), 0, 1, 0)
				},
				{
					"size",
					new IntSubsetting(this, new Metadata("Size", "size", "How big the panels are."), new SliderIntSubsettingElement("{0}%"), 100, 200, 0)
				}
			};
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			harmony.PatchAll(typeof(PanelPatches));
			Create();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			Object.Destroy((Object)(object)_currentPanels);
			harmony.UnpatchSelf();
		}

		public override void OnSubsettingUpdate()
		{
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)MonoSingleton<CanvasController>.Instance != (Object)null) || !Tweak.IsGameplayScene() || !((Object)(object)_currentPanels != (Object)null))
			{
				return;
			}
			_dps.SetActive(Subsettings["dps"].GetValue<bool>());
			_speed.SetActive(Subsettings["speed"].GetValue<bool>());
			_info.SetActive(Subsettings["info"].GetValue<bool>());
			_weapons.SetActive(Subsettings["weapons"].GetValue<bool>());
			foreach (GameObject item in _currentPanels.ChildrenList())
			{
				int num = 0;
				foreach (GameObject item2 in item.ChildrenList())
				{
					if (item2.activeSelf)
					{
						num++;
					}
				}
				if (num == 0)
				{
					item.SetActive(false);
				}
				else
				{
					item.SetActive(true);
				}
			}
			_currentPanels.transform.SetAsFirstSibling();
			_currentPanels.transform.localScale = Vector3.one * (float)Subsettings["size"].GetValue<int>() / 100f;
		}

		public override void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			Create();
		}

		private void Create()
		{
			if ((Object)(object)MonoSingleton<CanvasController>.Instance != (Object)null && Tweak.IsGameplayScene())
			{
				if ((Object)(object)_originalPanels == (Object)null)
				{
					_originalPanels = AssetHandler.Bundle.LoadAsset<GameObject>("All Panels.prefab");
				}
				_currentPanels = Object.Instantiate<GameObject>(_originalPanels, ((Component)MonoSingleton<CanvasController>.Instance).transform);
				_dps = _currentPanels.ChildByName("Top Row").ChildByName("DPS");
				_speed = _currentPanels.ChildByName("Top Row").ChildByName("Speed");
				_info = _currentPanels.ChildByName("Bottom Row").ChildByName("Info");
				_weapons = _currentPanels.ChildByName("Bottom Row").ChildByName("Weapons");
				_dpsText = _dps.ChildByName("DPS").GetComponent<Text>();
				_speedText = _speed.ChildByName("SPEED").GetComponent<Text>();
				_hpText = _info.ChildByName("HP").GetComponent<Text>();
				_staminaText = _info.ChildByName("Stamina").GetComponent<Text>();
				_gunImage = _weapons.ChildByName("Gun").GetComponent<Image>();
				_punchImage = _weapons.ChildByName("Fist").GetComponent<Image>();
				_railSlider = _weapons.ChildByName("Slider").GetComponent<Slider>();
				OnSubsettingUpdate();
			}
		}

		private float CalculateDps()
		{
			float num = 0f;
			for (int i = 0; i < HitsSecond.Count; i++)
			{
				Hit hit = HitsSecond[i];
				if ((DateTime.Now - hit.time).TotalSeconds > 1.0)
				{
					HitsSecond.RemoveAt(i);
					i--;
					continue;
				}
				float dmg = hit.dmg;
				if (dmg < 1000000f && dmg > 0f)
				{
					num += dmg;
				}
			}
			return num;
		}

		public void Update()
		{
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_currentPanels != (Object)null))
			{
				return;
			}
			if (_info.activeSelf && (Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				string text = "";
				string text2 = "";
				if (MonoSingleton<NewMovement>.Instance.antiHp != 0f)
				{
					text += "<color=#7C7A7B>";
					text2 += "</color>";
				}
				_hpText.text = $"{MonoSingleton<NewMovement>.Instance.hp}{text} / {100.0 - Math.Round(MonoSingleton<NewMovement>.Instance.antiHp, 0)}{text2}";
				_staminaText.text = (MonoSingleton<NewMovement>.Instance.boostCharge / 100f).ToString("0.00") + " / 3.00";
			}
			if (_weapons.activeSelf && (Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null && (Object)(object)MonoSingleton<WeaponHUD>.Instance != (Object)null && (Object)(object)MonoSingleton<WeaponCharges>.Instance != (Object)null && (Object)(object)MonoSingleton<FistControl>.Instance != (Object)null)
			{
				_gunImage.sprite = MonoSingleton<WeaponHUD>.Instance.img.sprite;
				((Graphic)_gunImage).color = ((Graphic)MonoSingleton<WeaponHUD>.Instance.img).color;
				_punchImage.sprite = MonoSingleton<FistControl>.Instance.fistIcon.sprite;
				((Graphic)_punchImage).color = ((Graphic)MonoSingleton<FistControl>.Instance.fistIcon).color;
				_railSlider.value = MonoSingleton<WeaponCharges>.Instance.raicharge;
			}
			if (_dps.activeSelf)
			{
				_dpsText.text = Math.Round(CalculateDps(), 2).ToString();
			}
			if (_speed.activeSelf)
			{
				Vector3 val;
				if (Subsettings["speed_mode"].GetValue<int>() == 0)
				{
					_speedText.fontSize = 72;
					Text speedText = _speedText;
					val = MonoSingleton<NewMovement>.Instance.rb.velocity;
					speedText.text = Math.Round(((Vector3)(ref val)).magnitude, 2).ToString();
				}
				else
				{
					_speedText.fontSize = 42;
					Vector3 velocity = MonoSingleton<NewMovement>.Instance.rb.velocity;
					val = new Vector3(velocity.x, velocity.y, velocity.z);
					string text3 = ((object)(Vector3)(ref val)).ToString();
					text3 = text3.Replace("(", "").Replace(")", "").Replace(", ", "\n");
					_speedText.text = text3;
				}
			}
		}
	}
	[TweakMetadata("Submerged", "waffle.ultrakill.ultratweaker.mutator_submerged", "Everything is underwater.", "waffle.ultrakill.ultratweaker.mutators", 10, "Submerged", false, true)]
	public class Submerged : Tweak
	{
		public static class SubmergedPatches
		{
			[HarmonyPatch(typeof(NewMovement), "Start")]
			[HarmonyPostfix]
			public static void SpawnWater()
			{
				MakeWater();
			}

			[HarmonyPatch(typeof(Water), "Start")]
			[HarmonyPrefix]
			public static void DisableOtherWaters(Water __instance)
			{
				if (((Object)((Component)__instance).gameObject).name != "UT WATER!!!")
				{
					((Behaviour)__instance).enabled = false;
				}
			}

			[HarmonyPatch(typeof(BloodsplatterManager), "GetGore", new Type[]
			{
				typeof(GoreType),
				typeof(bool),
				typeof(bool),
				typeof(bool),
				typeof(EnemyIdentifier)
			})]
			[HarmonyPrefix]
			public static void MakeUnderwater(ref bool isUnderwater)
			{
				isUnderwater = true;
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_submerged");

		private static GameObject _water;

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(SubmergedPatches));
			MakeWater();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
			if ((Object)(object)_water != (Object)null)
			{
				Object.Destroy((Object)(object)_water);
			}
		}

		public static void MakeWater()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (Tweak.IsGameplayScene())
			{
				_water = GameObject.CreatePrimitive((PrimitiveType)3);
				((Object)_water).name = "UT WATER!!!";
				_water.AddComponent<Rigidbody>();
				_water.GetComponent<Rigidbody>().isKinematic = true;
				_water.GetComponent<Collider>().isTrigger = true;
				_water.AddComponent<Water>();
				_water.GetComponent<Water>().bubblesParticle = new GameObject();
				_water.GetComponent<Water>().clr = new Color(0f, 0.5f, 1f);
				((Renderer)_water.GetComponent<MeshRenderer>()).enabled = false;
				_water.transform.localScale = Vector3.one * 1E+10f;
			}
		}
	}
	[TweakMetadata("Tankify", "waffle.ultrakill.ultratweaker.mutator_tankify", "Change enemy health.", "waffle.ultrakill.ultratweaker.mutators", 11, "Tankify", false, true)]
	public class Tankify : Tweak
	{
		public static class TankifyPatches
		{
			[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
			[HarmonyPostfix]
			public static void IncreaseHealth(EnemyIdentifier __instance)
			{
				float value = Tweak.GetInstance<Tankify>().Subsettings["multiplier"].GetValue<float>();
				if (!__instance.healthBuff)
				{
					((Component)__instance).gameObject.AddComponent<DisableDoubleRender>();
					__instance.HealthBuff(value);
				}
				else
				{
					__instance.healthBuffModifier *= value;
				}
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.mutator_tankify");

		public Tankify()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting> { 
			{
				"multiplier",
				new FloatSubsetting(this, new Metadata("Health Multplier", "multiplier", "Enemy health multiplier."), new SliderFloatSubsettingElement(), 2f, 10f, 0f)
			} };
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(TankifyPatches));
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("UI Scale", "waffle.ultrakill.ultratweaker.ui_scale", "Change the size of your HUD and UI.", "waffle.ultrakill.ultratweaker.hud", 0, null, true, false)]
	public class UIScale : Tweak
	{
		public static class UIScalePatches
		{
			[HarmonyPatch(typeof(CanvasController), "Awake")]
			[HarmonyPostfix]
			private static void PatchCanvasScale(CanvasController __instance)
			{
				UpdateCanvas();
			}

			[HarmonyPatch(typeof(HudController), "Start")]
			[HarmonyPostfix]
			private static void PatchHUDScale(HudController __instance)
			{
				//IL_0071: 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_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: 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)
				if (((Object)((Component)__instance).gameObject).name == "HUD")
				{
					_info = ((Component)__instance).gameObject.ChildByName("GunCanvas");
					_style = ((Component)__instance).gameObject.ChildByName("StyleCanvas");
					_results = ((Component)__instance).gameObject.ChildByName("FinishCanvas");
					if (DoesntKnowOriginal)
					{
						OriginalInfoScale = _info.transform.localScale;
						OriginalStyleScale = _style.transform.localScale;
						OriginalResultsScale = _results.transform.localScale;
						DoesntKnowOriginal = false;
					}
					UpdateHUD();
				}
			}

			[HarmonyPatch(typeof(BossBarManager), "RecalculateStretch")]
			[HarmonyPostfix]
			private static void SetBossBarSize(BossBarManager __instance)
			{
				//IL_0007: 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)
				((Component)__instance).transform.localScale = Vector3.one * ((float)Tweak.GetInstance<UIScale>().Subsettings["bossbar_hud_scale"].GetValue<int>() / 100f);
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.ui_scale");

		public static bool DoesntKnowOriginal = true;

		public static Vector3 OriginalInfoScale;

		public static Vector3 OriginalStyleScale;

		public static Vector3 OriginalResultsScale;

		private static GameObject _info;

		private static GameObject _style;

		private static GameObject _results;

		public UIScale()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting>
			{
				{
					"info_hud_scale",
					new IntSubsetting(this, new Metadata("Info HUD Scale", "info_hud_scale", "The size of the info, e.g. health and stamina."), new SliderIntSubsettingElement("{0}%"), 100, 110, 0)
				},
				{
					"style_hud_scale",
					new IntSubsetting(this, new Metadata("Style HUD Scale", "style_hud_scale", "The size of the style panel."), new SliderIntSubsettingElement("{0}%"), 100, 110, 0)
				},
				{
					"finalrank_hud_scale",
					new IntSubsetting(this, new Metadata("End HUD Scale", "finalrank_hud_scale", "The size of the panel that shows your final rank."), new SliderIntSubsettingElement("{0}%"), 100, 110, 0)
				},
				{
					"bossbar_hud_scale",
					new IntSubsetting(this, new Metadata("Boss Bar Scale", "bossbar_hud_scale", "The size of the boss bar."), new SliderIntSubsettingElement("{0}%"), 100, 100, 0)
				},
				{
					"canvas_scale",
					new IntSubsetting(this, new Metadata("Canvas Scale", "canvas_scale", "The size of the info, e.g. health and stamina."), new SliderIntSubsettingElement("{0}%"), 100, 100, 25)
				}
			};
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			DoesntKnowOriginal = true;
			_harmony.PatchAll(typeof(UIScalePatches));
			UpdateHUD();
			UpdateCanvas();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			UpdateHUD(toDefault: true);
			UpdateCanvas(toDefault: true);
			_harmony.UnpatchSelf();
		}

		public override void OnSubsettingUpdate()
		{
			UpdateHUD();
			UpdateCanvas();
		}

		public static void UpdateHUD(bool toDefault = false)
		{
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)(object)_info == (Object)null || (Object)(object)_style == (Object)null || (Object)(object)_results == (Object)null) && Object.FindObjectsOfType<HudController>() != null)
			{
				HudController[] array = Object.FindObjectsOfType<HudController>();
				foreach (HudController val in array)
				{
					if (((Object)((Component)val).gameObject).name == "HUD")
					{
						_info = ((Component)val).gameObject.ChildByName("GunCanvas");
						_style = ((Component)val).gameObject.ChildByName("StyleCanvas");
						_results = ((Component)val).gameObject.ChildByName("FinishCanvas");
						if (DoesntKnowOriginal)
						{
							OriginalInfoScale = _info.transform.localScale;
							OriginalStyleScale = _style.transform.localScale;
							OriginalResultsScale = _results.transform.localScale;
							DoesntKnowOriginal = false;
						}
					}
				}
			}
			if (!((Object)(object)_info == (Object)null) && !((Object)(object)_style == (Object)null) && !((Object)(object)_results == (Object)null))
			{
				float num = Tweak.GetInstance<UIScale>().Subsettings["info_hud_scale"].GetValue<int>();
				float num2 = Tweak.GetInstance<UIScale>().Subsettings["style_hud_scale"].GetValue<int>();
				float num3 = Tweak.GetInstance<UIScale>().Subsettings["finalrank_hud_scale"].GetValue<int>();
				if (!toDefault)
				{
					_info.transform.localScale = OriginalInfoScale * (num / 100f);
					_style.transform.localScale = OriginalStyleScale * (num2 / 100f);
					_results.transform.localScale = OriginalResultsScale * (num3 / 100f);
				}
				else
				{
					_info.transform.localScale = OriginalInfoScale;
					_style.transform.localScale = OriginalStyleScale;
					_results.transform.localScale = OriginalResultsScale;
				}
			}
		}

		public static void UpdateCanvas(bool toDefault = false)
		{
			float num = Tweak.GetInstance<UIScale>().Subsettings["canvas_scale"].GetValue<int>();
			if (num != 100f)
			{
				GameObject gameObject = ((Component)MonoSingleton<CanvasController>.Instance).gameObject;
				gameObject.GetComponent<CanvasScaler>().uiScaleMode = (ScaleMode)0;
				gameObject.GetComponent<CanvasScaler>().scaleFactor = (float)(1920 / Screen.width) * 1.5f;
				if (!toDefault)
				{
					CanvasScaler component = gameObject.GetComponent<CanvasScaler>();
					component.scaleFactor *= num / 100f;
				}
			}
		}

		public override void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			DoesntKnowOriginal = true;
		}
	}
	[TweakMetadata("Ultrahot", "waffle.ultrakill.ultratweaker.mutator_ultrahot", "Time moves when you move.", "waffle.ultrakill.ultratweaker.mutators", 12, "Ultrahot", false, true)]
	public class Ultrahot : Tweak
	{
		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
		}

		public void Update()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (Tweak.IsGameplayScene())
			{
				float num = 20f;
				float num2 = 0.01f;
				float num3 = 1.25f;
				float num4 = 15f;
				Vector3 velocity = MonoSingleton<NewMovement>.Instance.rb.velocity;
				float num5 = ((Vector3)(ref velocity)).magnitude / num;
				num5 = Mathf.Clamp(num5, num2, num3);
				Time.timeScale = Mathf.Lerp(Time.timeScale, num5, Time.deltaTime * num4);
			}
		}
	}
	[TweakMetadata("Unobtrusive Blood", "waffle.ultrakill.ultratweaker.unobtrusive_blood", "Make the screen blood more transparent, or gone.", "waffle.ultrakill.ultratweaker.hud", 3, null, true, false)]
	public class UnobtrusiveBlood : Tweak
	{
		public static class UnobtrusiveBloodPatches
		{
			[HarmonyPatch(typeof(ScreenBlood), "Start")]
			[HarmonyPostfix]
			private static void ChangeOpacity(ScreenBlood __instance)
			{
				__instance.clr.a = (float)Tweak.GetInstance<UnobtrusiveBlood>().Subsettings["transparency"].GetValue<int>() / 100f;
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.unobtrusive_blood");

		public UnobtrusiveBlood()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting> { 
			{
				"transparency",
				new IntSubsetting(this, new Metadata("Blood Opacity", "transparency", "How transparent the blood is."), new SliderIntSubsettingElement("{0}%"), 44, 100, 0)
			} };
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(UnobtrusiveBloodPatches));
			OnSubsettingUpdate();
		}

		public override void OnTweakDisabled()
		{
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
		}
	}
	[TweakMetadata("Viewmodel Transform", "waffle.ultrakill.ultratweaker.viewmodel_transform", "Resize, change the FOV of, and otherwise tweak the viewmodel.", "waffle.ultrakill.ultratweaker.misc", 1, null, true, false)]
	public class ViewmodelTransform : Tweak
	{
		public static class ViewmodelPatches
		{
			[HarmonyPatch(typeof(FistControl), "Update")]
			[HarmonyPostfix]
			private static void FistSize(FistControl __instance)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				if (((Component)__instance).transform.localScale == Vector3.one)
				{
					float num = Tweak.GetInstance<ViewmodelTransform>().Subsettings["viewmodel_size_multiplier"].GetValue<int>();
				}
			}

			[HarmonyPatch(typeof(WeaponPos), "CheckPosition")]
			[HarmonyPostfix]
			private static void PatchWeaponScale_Check(WeaponPos __instance)
			{
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0139: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				if (((Component)__instance).GetComponent<WeaponIdentifier>().duplicate)
				{
					return;
				}
				if (((Object)((Component)__instance).gameObject).name.Contains("Revolver"))
				{
					if (!_originalScale.ContainsKey(((Component)__instance).gameObject))
					{
						_originalScale.Add(((Component)__instance).gameObject, ((Component)__instance).gameObject.transform.localScale);
					}
					((Component)__instance).gameObject.transform.localScale = _originalScale[((Component)__instance).gameObject] * (float)Tweak.GetInstance<ViewmodelTransform>().Subsettings["viewmodel_size_multiplier"].GetValue<int>() / 100f;
					return;
				}
				foreach (GameObject item in ((Component)__instance).gameObject.ChildrenList())
				{
					if (!_originalScale.ContainsKey(item))
					{
						_originalScale.Add(item, item.transform.localScale);
					}
					item.transform.localScale = _originalScale[item] * (float)Tweak.GetInstance<ViewmodelTransform>().Subsettings["viewmodel_size_multiplier"].GetValue<int>() / 100f;
				}
			}

			[HarmonyPatch(typeof(GunControl), "Start")]
			[HarmonyPostfix]
			private static void BobAndTilt()
			{
				UpdateBobAndTilt();
			}
		}

		private Harmony _harmony = new Harmony("waffle.ultrakill.ultratweaker.viewmodel_transform");

		private static Dictionary<GameObject, Vector3> _originalScale = new Dictionary<GameObject, Vector3>();

		public ViewmodelTransform()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Subsettings = new Dictionary<string, Subsetting>
			{
				{
					"viewmodel_fov",
					new IntSubsetting(this, new Metadata("FOV", "viewmodel_fov", "What is the FOV of the viewmodel?"), new SliderIntSubsettingElement(), 90, 150, 50)
				},
				{
					"viewmodel_size_multiplier",
					new IntSubsetting(this, new Metadata("Size", "viewmodel_size_multiplier", "How big is the viewmodel?"), new SliderIntSubsettingElement("{0}%"), 100, 125, 0)
				},
				{
					"viewmodel_bob",
					new BoolSubsetting(this, new Metadata("Bobbing", "viewmodel_bob", "Does the viewmodel bob when you walk?"), new BoolSubsettingElement(), defaultValue: true)
				},
				{
					"viewmodel_tilt",
					new BoolSubsetting(this, new Metadata("Aim-assist Tilt", "viewmodel_tilt", "Does the viewmodel tilt with aim-assist?"), new BoolSubsettingElement(), defaultValue: true)
				}
			};
		}

		public override void OnTweakEnabled()
		{
			base.OnTweakEnabled();
			_harmony.PatchAll(typeof(ViewmodelPatches));
			if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null && (Object)(object)MonoSingleton<FistControl>.Instance != (Object)null)
			{
				UpdateBobAndTilt();
			}
		}

		public override void OnTweakDisabled()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			base.OnTweakDisabled();
			_harmony.UnpatchSelf();
			if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null && (Object)(object)MonoSingleton<FistControl>.Instance != (Object)null)
			{
				((Component)MonoSingleton<NewMovement>.Instance).gameObject.ChildByName("Main Camera").ChildByName("HUD Camera").GetComponent<Camera>()
					.fieldOfView = 90f;
				((Component)MonoSingleton<FistControl>.Instance).transform.localScale = Vector3.one;
				((Behaviour)((Component)MonoSingleton<GunControl>.Instance).GetComponent<WalkingBob>()).enabled = true;
				((Behaviour)((Component)MonoSingleton<GunControl>.Instance).GetComponent<RotateToFaceFrustumTarget>()).enabled = true;
			}
			foreach (GameObject key in _originalScale.Keys)
			{
				key.transform.localScale = _originalScale[key];
			}
			_originalScale.Clear();
		}

		public override void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			_originalScale.Clear();
		}

		public void LateUpdate()
		{
			if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
			{
				((Component)MonoSingleton<NewMovement>.Instance).gameObject.ChildByName("Main Camera").ChildByName("HUD Camera").GetComponent<Camera>()
					.fieldOfView = Subsettings["viewmodel_fov"].GetValue<int>();
			}
		}

		public override void OnSubsettingUpdate()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			UpdateBobAndTilt();
			if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null && (Object)(object)MonoSingleton<FistControl>.Instance != (Object)null)
			{
				if ((Object)(object)MonoSingleton<GunControl>.Instance.currentWeapon != (Object)null && (Object)(object)MonoSingleton<GunControl>.Instance.currentWeapon.GetComponent<WeaponPos>() != (Object)null)
				{
					MonoSingleton<GunControl>.Instance.currentWeapon.GetComponent<WeaponPos>().CheckPosition();
				}
				UpdateBobAndTilt();
				((Component)MonoSingleton<FistControl>.Instance).transform.localScale = Vector3.one;
			}
		}

		public static void UpdateBobAndTilt()
		{
			if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null)
			{
				((Behaviour)((Component)MonoSingleton<GunControl>.Instance).GetComponent<WalkingBob>()).enabled = Tweak.GetInstance<ViewmodelTransform>().Subsettings["viewmodel_bob"].GetValue<bool>();
				((Behaviour)((Component)MonoSingleton<GunControl>.Instance).GetComponent<RotateToFaceFrustumTarget>()).enabled = Tweak.GetInstance<ViewmodelTransform>().Subsettings["viewmodel_tilt"].GetValue<bool>();
			}
		}
	}
}
namespace UltraTweaker.Subsettings
{
	public abstract class Subsetting
	{
		public Tweak Parent;

		public Metadata Metadata;

		public SubsettingUIElement Element;

		public Subsetting(Tweak parent, Metadata metadata, SubsettingUIElement element)
		{
			Parent = parent;
			Metadata = metadata;
			Element = element;
			Element.Subsetting = this;
		}

		public T GetValue<T>()
		{
			return ((TypedSubsetting<T>)this).Value;
		}

		public virtual string Serialize()
		{
			return "";
		}

		public abstract void Deserialize(string str);

		public abstract void ResetValue();
	}
	public class TypedSubsetting<T> : Subsetting
	{
		public T Value;

		public T DefaultValue;

		public override void Deserialize(string str)
		{
		}

		public TypedSubsetting(Tweak parent, Metadata metadata, SubsettingUIElement element)
			: base(parent, metadata, element)
		{
		}

		public override void ResetValue()
		{
			Value = DefaultValue;
		}
	}
}
namespace UltraTweaker.Subsettings.Impl
{
	public class BoolSubsetting : TypedSubsetting<bool>
	{
		public BoolSubsetting(Tweak parent, Metadata metadata, SubsettingUIElement element, bool defaultValue)
			: base(parent, metadata, element)
		{
			DefaultValue = defaultValue;
			Value = defaultValue;
		}

		public override void Deserialize(string str)
		{
			Value = Convert.ToBoolean(str);
		}

		public override string Serialize()
		{
			return Value.ToString();
		}
	}
	public class CommentSubsetting : TypedSubsetting<string>
	{
		public Action Action;

		public string ButtonText;

		public CommentSubsetting(Tweak parent, Metadata metadata, SubsettingUIElement element, Action action = null, string buttonText = "")
			: base(parent, metadata, element)
		{
			Action = action;
			ButtonText = buttonText;
		}

		public override string Serialize()
		{
			return "";
		}
	}
	public class FloatSubsetting : TypedSubsetting<float>
	{
		public float MaxValue;

		public float MinValue;

		public FloatSubsetting(Tweak parent, Metadata metadata, SubsettingUIElement element, float defaultValue, float maxValue, float minValue)
			: base(parent, metadata, element)
		{
			DefaultValue = defaultValue;
			MaxValue = maxValue;
			MinValue = minValue;
			Value = defaultValue;
		}

		public override void Deserialize(string str)
		{
			Value = float.Parse(str, CultureInfo.GetCultureInfo("en-GB"));
		}

		public override string Serialize()
		{
			return Value.ToString();
		}
	}
	public class IntSubsetting : TypedSubsetting<int>
	{
		public int MaxValue;

		public int MinValue;

		public IntSubsetting(Tweak parent, Metadata metadata, SubsettingUIElement element, int defaultValue, int maxValue, int minValue)
			: base(parent, metadata, element)
		{
			DefaultValue = defaultValue;
			MaxValue = maxValue;
			MinValue = minValue;
			Value = defaultValue;
		}

		public override void Deserialize(string str)
		{
			Value = int.Parse(str, CultureInfo.GetCultureInfo("en-GB"));
		}

		public override string Serialize()
		{
			return Value.ToString();
		}
	}
	public class StringSubsetting : TypedSubsetting<string>
	{
		public StringSubsetting(Tweak parent, Metadata metadata, SubsettingUIElement element, string defaultValue)
			: base(parent, metadata, element)
		{
			DefaultValue = defaultValue;
			Value = defaultValue;
		}

		public override void Deserialize(string str)
		{
			Value = str;
		}

		public override string Serialize()
		{
			return Value;
		}
	}
}
namespace UltraTweaker.SettingUI
{
	public class Page
	{
		public readonly string PageName;

		public readonly string OriginMod;

		public GameObject PageObject;

		public Page(string pageName, string originMod)
		{
			PageName = pageName;
			OriginMod = originMod;
		}
	}
	public static class SettingUIHandler
	{
		[DefaultExecutionOrder(-10000000)]
		private class SettingUIDoer : MonoBehaviour
		{
			private void Start()
			{
				CreateUI(((Component)this).gameObject);
			}
		}

		public class SettingUIPatches
		{
			[HarmonyPatch(typeof(OptionsMenuToManager), "Start")]
			[HarmonyPostfix]
			public static void AddMenu(OptionsMenuToManager __instance)
			{
				CreateUI(((Component)__instance).gameObject.ChildByName("OptionsMenu"));
			}

			[HarmonyPatch(typeof(ButtonHighlightParent), "Start")]
			[HarmonyPrefix]
			private static bool ReplaceStart(ButtonHighlightParent __instance)
			{
				__instance.buttons = CollectionExtensions.AddRangeToArray<Image>(__instance.buttons, ((Component)__instance).GetComponentsInChildren<Image>());
				__instance.buttonTexts = __instance.buttons.Select((Image button) => ((Component)button).GetComponentInChildren<TMP_Text>()).ToArray();
				return false;
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__7_1;

			public static UnityAction <>9__7_2;

			internal void <CreateUI>b__7_1()
			{
				ResetAllSettings();
			}

			internal void <CreateUI>b__7_2()
			{
				foreach (Page value in Pages.Values)
				{
					value.PageObject.SetActive(false);
				}
			}
		}

		public static Harmony Harmony = new Harmony("waffle.ultrakill.ultratweaker.setting_ui_handler");

		public static GameObject OriginalSettingPage;

		public static GameObject OriginalResetButton;

		public static GameObject CurrentResetButton;

		public static Dictionary<string, Page> Pages = new Dictionary<string, Page>
		{
			{
				"waffle.ultrakill.ultratweaker.misc",
				new Page("GENERAL", "ULTRATWEAKER")
			},
			{
				"waffle.ultrakill.ultratweaker.hud",
				new Page("HUD", "ULTRATWEAKER")
			},
			{
				"waffle.ultrakill.ultratweaker.fun",
				new Page("FUN", "ULTRATWEAKER")
			},
			{
				"waffle.ultrakill.ultratweaker.mutators",
				new Page("MUTATORS", "ULTRATWEAKER")
			}
		};

		public static Dictionary<string, int> PageModNameToChildIndex = new Dictionary<string, int>();

		public static void Patch()
		{
			Harmony.PatchAll(typeof(SettingUIPatches));
		}

		private static void CreateUI(GameObject optionsMenu)
		{
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: 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_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Expected O, but got Unknown
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_051c: Expected O, but got Unknown
			if ((Object)(object)OriginalSettingPage == (Object)null)
			{
				OriginalSettingPage = AssetHandler.Bundle.LoadAsset<GameObject>("Settings Page.prefab");
			}
			if ((Object)(object)OriginalResetButton == (Object)null)
			{
				OriginalResetButton = AssetHandler.Bundle.LoadAsset<GameObject>("Reset Button.prefab");
			}
			CreateSecondSettingColumn(optionsMenu, out var rightSettingMenu, out var titleText);
			rightSettingMenu.transform.SetAsFirstSibling();
			GameObject gameObject = ((Component)optionsMenu.transform.Find("Panel/Text (7)")).gameObject;
			GameObject gameObject2 = ((Component)optionsMenu.transform.Find("Panel/Controls")).gameObject;
			((UnityEventBase)gameObject2.GetComponent<Button>().onClick).RemoveAllListeners();
			Object.Destroy((Object)(object)rightSettingMenu.GetComponent<ButtonHighlightParent>());
			foreach (GameObject item in rightSettingMenu.ChildrenList())
			{
				Object.Destroy((Object)(object)item);
			}
			titleText.text = "--MOD OPTIONS--";
			titleText.fontSize = 26f;
			int num = 0;
			ButtonHighlightParent component = ((Component)optionsMenu.transform.Find("Panel")).GetComponent<ButtonHighlightParent>();
			ButtonHighlightParent val = component;
			if (val.buttons == null)
			{
				val.buttons = (Image[])(object)new Image[0];
			}
			List<string> list = new List<string>();
			foreach (Page page in Pages.Values)
			{
				page.PageObject = Object.Instantiate<GameObject>(OriginalSettingPage, optionsMenu.transform);
				((Object)page.PageObject).name = page.PageName;
				page.PageObject.AddComponent<HudOpenEffect>();
				if (!list.Contains(page.OriginMod))
				{
					list.Add(page.OriginMod);
					GameObject val2 = Object.Instantiate<GameObject>(gameObject, rightSettingMenu.transform);
					TMP_Text component2 = val2.GetComponent<TMP_Text>();
					component2.text = "-- " + page.OriginMod + " --";
					((Graphic)component2).raycastTarget = false;
					component2.rectTransform.sizeDelta = new Vector2(component2.rectTransform.sizeDelta.x * 2f, component2.rectTransform.sizeDelta.y);
				}
				GameObject val3 = Object.Instantiate<GameObject>(gameObject2, rightSettingMenu.transform);
				((Object)val3).name = page.OriginMod + ": " + page.PageName;
				((UnityEvent)val3.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					foreach (GameObject item2 in AllPages(optionsMenu))
					{
						item2.SetActive(false);
					}
					page.PageObject.SetActive(true);
				});
				((TMP_Text)val3.ChildByName("Text").GetComponent<TextMeshProUGUI>()).text = page.PageName;
				component.buttons = CollectionExtensions.AddToArray<Image>(component.buttons, val3.GetComponent<Image>());
				page.PageObject.SetActive(false);
				if (num == 0)
				{
					CurrentResetButton = Object.Instantiate<GameObject>(OriginalResetButton, ((Component)page.PageObject.GetComponentInChildren<LayoutGroup>(true)).transform);
					ButtonClickedEvent onClick = CurrentResetButton.GetComponent<Button>().onClick;
					object obj = <>c.<>9__7_1;
					if (obj == null)
					{
						UnityAction val4 = delegate
						{
							ResetAllSettings();
						};
						<>c.<>9__7_1 = val4;
						obj = (object)val4;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj);
				}
				num++;
			}
			foreach (Tweak value in UltraTweaker.AllTweaks.Values)
			{
				TweakMetadata tweakMetadata = Attribute.GetCustomAttribute(((object)value).GetType(), typeof(TweakMetadata)) as TweakMetadata;
				value.Element.Create(((Component)Pages[tweakMetadata.PageId].PageObject.GetComponentInChildren<VerticalLayoutGroup>()).transform).transform.SetSiblingIndex(tweakMetadata.InsertAt);
				foreach (Subsetting value2 in value.Subsettings.Values)
				{
					value2.Element.Create(((Component)value.Element.CurrentSetting.GetComponentInChildren<LayoutGroup>(true)).transform);
				}
			}
			Button[] componentsInChildren = ((Component)optionsMenu.transform.Find("Panel")).GetComponentsInChildren<Button>();
			foreach (Button val5 in componentsInChildren)
			{
				ButtonClickedEvent onClick2 = val5.onClick;
				object obj2 = <>c.<>9__7_2;
				if (obj2 == null)
				{
					UnityAction val6 = delegate
					{
						foreach (Page value3 in Pages.Values)
						{
							value3.PageObject.SetActive(false);
						}
					};
					<>c.<>9__7_2 = val6;
					obj2 = (object)val6;
				}
				((UnityEvent)onClick2).AddListener((UnityAction)obj2);
			}
			CurrentResetButton.transform.SetAsFirstSibling();
		}

		private static void CreateSecondSettingColumn(GameObject optionMenu, out GameObject rightSettingMenu, out TMP_Text titleText)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)optionMenu.GetComponentInChildren<ButtonHighlightParent>(true)).gameObject;
			rightSettingMenu = CopyToOtherSide(gameObject);
			titleText = CopyToOtherSide(optionMenu.ChildByName("Text")).GetComponent<TMP_Text>();
			foreach (GameObject item in AllPages(optionMenu))
			{
				if (!((Object)(object)item.GetComponent<TextMeshProUGUI>() != (Object)null) && !((Object)(object)item.GetComponent<ButtonHighlightParent>() != (Object)null) && !((Object)(object)item.GetComponent<TooltipManager>() != (Object)null))
				{
					Debug.Log((object)$"Offsetting {((Object)item).name} by {-(int)((float)Screen.width * 0.017578125f)}");
					Transform transform = item.transform;
					transform.position -= new Vector3((float)(int)((float)Screen.width * 0.017578125f), 0f);
				}
			}
		}

		private static IEnumerable<GameObject> AllPages(GameObject optionMenu)
		{
			foreach (GameObject optionPage in optionMenu.ChildrenList())
			{
				if (!((Object)(object)optionPage.GetComponent<TextMeshProUGUI>() != (Object)null) && !((Object)optionPage).name.Contains("Panel") && !((Object)(object)optionPage.GetComponent<TooltipManager>() != (Object)null))
				{
					yield return optionPage;
				}
			}
		}

		private static GameObject CopyToOtherSide(GameObject original)
		{
			//IL_0032: 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_0048: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			Transform transform = original.transform;
			RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			GameObject val2 = Object.Instantiate<GameObject>(original, original.transform.parent);
			Transform transform2 = val2.transform;
			RectTransform val3 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null);
			val3.pivot = new Vector2(1f - val.pivot.x, val.pivot.y);
			((Component)val3).transform.position = new Vector3((float)Screen.width - ((Transform)val).position.x, ((Transform)val).position.y, ((Transform)val).position.z);
			return val2;
		}

		public static void ResetAllSettings()
		{
			foreach (Tweak value in UltraTweaker.AllTweaks.Values)
			{
				value.IsEnabled = false;
				value.Element.ResetValue();
				foreach (Subsetting value2 in value.Subsettings.Values)
				{
					value2.ResetValue();
					value2.Element.ResetValue();
				}
			}
		}
	}
}
namespace UltraTweaker.SettingUI.UIElements
{
	public class ShowBoxOnHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public GameObject Box;

		public void Start()
		{
			if ((Object)(object)Box == (Object)null)
			{
				Box = ((Component)((Component)this).transform.parent).gameObject.ChildByName("Box");
			}
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			Box.SetActive(true);
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			Box.SetActive(false);
		}
	}
	public abstract class SubsettingUIElement
	{
		public Subsetting Subsetting;

		public abstract GameObject Create(Transform t);

		public abstract void SetControlsActive(bool active);

		public abstract void ResetValue();
	}
	public class TweakUIElement
	{
		public static GameObject BaseSetting;

		public GameObject CurrentSetting;

		public Tweak Tweak;

		public Toggle Toggle;

		public virtual string Name => "Tweak Setting.prefab";

		public TweakUIElement(Tweak tweak)
		{
			Tweak = tweak;
		}

		public GameObject Create(Transform t)
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)BaseSetting == (Object)null)
			{
				BaseSetting = AssetHandler.Bundle.LoadAsset<GameObject>(Name);
			}
			Metadata metadata = Attribute.GetCustomAttribute(((object)Tweak).GetType(), typeof(Metadata)) as Metadata;
			CurrentSetting = Object.Instantiate<GameObject>(BaseSetting, t);
			Toggle = CurrentSetting.ChildByName("Toggle").GetComponent<Toggle>();
			((UnityEvent<bool>)(object)Toggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool state)
			{
				Tweak.IsEnabled = state;
			});
			ResetValue();
			float num = Tweak.Subsettings.Count * 30;
			num += (float)(Tweak.Subsettings.Count - 1) * ((HorizontalOrVerticalLayoutGroup)CurrentSetting.ChildByName("Subsetting Holder").GetComponent<VerticalLayoutGroup>()).spacing;
			RectTransform component = CurrentSetting.GetComponent<RectTransform>();
			Rect rect = CurrentSetting.ChildByName("Background").GetComponent<RectTransform>().rect;
			component.SetSizeWithCurrentAnchors((Axis)1, ((Rect)(ref rect)).height + num);
			CurrentSetting.ChildByName("Text").GetComponent<TMP_Text>().text = metadata.Name.ToUpper();
			CurrentSetting.ChildByName("Box").ChildByName("Description").GetComponent<Text>()
				.text = metadata.Description;
			CurrentSetting.ChildByName("Text").AddComponent<ShowBoxOnHover>();
			if ((Object)(object)((TweakMetadata)metadata).Icon != (Object)null)
			{
				CurrentSetting.ChildByName("Icon").GetComponent<Image>().sprite = ((TweakMetadata)metadata).Icon;
			}
			else
			{
				CurrentSetting.ChildByName("Icon").SetActive(false);
			}
			if (!((TweakMetadata)metadata).AllowCG)
			{
				CurrentSetting.ChildByName("Disabled CG").SetActive(true);
				CurrentSetting.ChildByName("Disabled CG").AddComponent<ShowBoxOnHover>().Box = CurrentSetting.ChildByName("Disabled CG").ChildByName("Box");
			}
			return CurrentSetting;
		}

		public void SetControlsActive(bool active)
		{
			((Selectable)Toggle).interactable = active;
		}

		public void ResetValue()
		{
			Toggle.isOn = Tweak.IsEnabled;
		}
	}
}
namespace UltraTweaker.SettingUI.UIElements.Impl
{
	public class BoolSubsettingElement : SubsettingUIElement
	{
		public static GameObject BaseSetting;

		public GameObject CurrentSetting;

		public Toggle Toggle;

		public override GameObject Create(Transform t)
		{
			if ((Object)(object)BaseSetting == (Object)null)
			{
				BaseSetting = AssetHandler.Bundle.LoadAsset<GameObject>("Toggle Subsetting.prefab");
			}
			CurrentSetting = Object.Instantiate<GameObject>(BaseSetting, t);
			CurrentSetting.ChildByName("Text").GetComponent<Text>().text = Subsetting.Metadata.Name.ToUpper();
			Toggle = CurrentSetting.ChildByName("Toggle").GetComponent<Toggle>();
			CurrentSetting.ChildByName("Box").ChildByName("Description").GetComponent<Text>()
				.text = Subsetting.Metadata.Description;
			CurrentSetting.ChildByName("Text").AddComponent<ShowBoxOnHover>();
			ResetValue();
			((UnityEvent<bool>)(object)Toggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool state)
			{
				((BoolSubsetting)Subsetting).Value = state;
				if (Subsetting.Parent.IsEnabled)
				{
					Subsetting.Parent.OnSubsettingUpdate();
				}
			});
			return CurrentSetting;
		}

		public override void SetControlsActive(bool active)
		{
			((Selectable)Toggle).interactable = active;
		}

		public override void ResetValue()
		{
			Toggle.isOn = ((BoolSubsetting)Subsetting).Value;
		}
	}
	public class CommentSubsettingElement : SubsettingUIElement
	{
		public static GameObject BaseSetting;

		public GameObject CurrentSetting;

		public override GameObject Create(Transform t)
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			if ((Object)(object)BaseSetting == (Object)null)
			{
				BaseSetting = AssetHandler.Bundle.LoadAsset<GameObject>("Comment Subsetting.prefab");
			}
			CurrentSetting = Object.Instantiate<GameObject>(BaseSetting, t);
			CurrentSetting.ChildByName("Text").GetComponent<Text>().text = Subsetting.Metadata.Name.ToUpper();
			CurrentSetting.ChildByName("Comment").GetComponent<Text>().text = Subsetting.Metadata.Description;
			GameObject val = CurrentSetting.ChildByName("Button");
			val.SetActive(false);
			CommentSubsetting cs = Subsetting as CommentSubsetting;
			if (cs != null && cs.Action != null)
			{
				val.SetActive(true);
				((UnityEvent)val.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					cs.Action();
				});
				val.ChildByName("Text").GetComponent<Text>().text = cs.ButtonText;
			}
			return CurrentSetting;
		}

		public override void SetControlsActive(bool active)
		{
		}

		public override void ResetValue()
		{
		}
	}
	public class DropdownIntSubsettingElement : SubsettingUIElement
	{
		public static GameObject BaseSetting;

		public GameObject CurrentSetting;

		public List<string> Options;

		public Dropdown Dropdown;

		public DropdownIntSubsettingElement(List<string> options)
		{
			Options = options;
		}

		public override GameObject Create(Transform t)
		{
			if ((Object)(object)BaseSetting == (Object)null)
			{
				BaseSetting = AssetHandler.Bundle.LoadAsset<GameObject>("Dropdown Subsetting.prefab");
			}
			CurrentSetting = Object.Instantiate<GameObject>(BaseSetting, t);
			CurrentSetting.ChildByName("Text").GetComponent<Text>().text = Subsetting.Metadata.Name.ToUpper();
			CurrentSetting.ChildByName("Box").ChildByName("Description").GetComponent<Text>()
				.text = Subsetting.Metadata.Description;
			CurrentSetting.ChildByName("Text").AddComponent<ShowBoxOnHover>();
			Dropdown = CurrentSetting.ChildByName("Dropdown").GetComponent<Dropdown>();
			Dropdown.ClearOptions();
			Dropdown.AddOptions(Options);
			ResetValue();
			((UnityEvent<int>)(object)Dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int num)
			{
				((IntSubsetting)Subsetting).Value = num;
				if (Subsetting.Parent.IsEnabled)
				{
					Subsetting.Parent.OnSubsettingUpdate();
				}
			});
			return CurrentSetting;
		}

		public override void SetControlsActive(bool active)
		{
			((Selectable)Dropdown).interactable = active;
		}

		public override void ResetValue()
		{
			Dropdown.value = ((IntSubsetting)Subsetting).Value;
		}
	}
	public class DropdownStringSubsettingElement : SubsettingUIElement
	{
		public static GameObject BaseSetting;

		public GameObject CurrentSetting;

		public List<string> Options;

		public Dropdown Dropdown;

		public DropdownStringSubsettingElement(List<string> options)
		{
			Options = options;
		}

		public override GameObject Create(Transform t)
		{
			if ((Object)(object)BaseSetting == (Object)null)
			{
				BaseSetting = AssetHandler.Bundle.LoadAsset<GameObject>("Dropdown Subsetting.prefab");
			}
			CurrentSetting = Object.Instantiate<GameObject>(BaseSetting, t);
			CurrentSetting.ChildByName("Text").GetComponent<Text>().text = Subsetting.Metadata.Name.ToUpper();
			CurrentSetting.ChildByName("Box").ChildByName("Description").GetComponent<Text>()
				.text = Subsetting.Metadata.Description;
			CurrentSetting.ChildByName("Text").AddComponent<ShowBoxOnHover>();
			Dropdown = CurrentSetting.ChildByName("Dropdown").GetComponent<Dropdown>();
			Dropdown.ClearOptions();
			Dropdown.AddOptions(Options);
			Dropdown.value = 0;
			ResetValue();
			((UnityEvent<int>)(object)Dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int num)
			{
				((StringSubsetting)Subsetting).Value = Options[num];
				if (Subsetting.Parent.IsEnabled)
				{
					Subsetting.Parent.OnSubsettingUpdate();
				}
			});
			return CurrentSetting;
		}

		public override void SetControlsActive(bool active)
		{
			((Selectable)Dropdown).interactable = active;
		}

		public override void ResetValue()
		{
			if (Options.Contains(((StringSubsetting)Subsetting).Value))
			{
				Dropdown.value = Options.IndexOf(((StringSubsetting)Subsetting).Value);
			}
		}
	}
	public class SliderFloatSubsettingElement : SubsettingUIElement
	{
		public static GameObject BaseSetting;

		public GameObject CurrentSetting;

		public string DisplayAs = "{0}";

		public InputField InputField;

		public Slider Slider;

		public int RoundDigits;

		public SliderFloatSubsettingElement(string displayAs = "{0}", int roundDigits = 1)
		{
			DisplayAs = displayAs;
			RoundDigits = roundDigits;
		}

		public override GameObject Create(Transform t)
		{
			if ((Object)(object)BaseSetting == (Object)null)
			{
				BaseSetting = AssetHandler.Bundle.LoadAsset<GameObject>("Slider Subsetting.prefab");
			}
			CurrentSetting = Object.Instantiate<GameObject>(BaseSetting, t);
			CurrentSetting.ChildByName("Text").GetComponent<Text>().text = Subsetting.Metadata.Name.ToUpper();
			CurrentSetting.ChildByName("Box").ChildByName("Description").GetComponent<Text>()
				.text = Subsetting.Metadata.Description;
			CurrentSetting.ChildByName("Text").AddComponent<ShowBoxOnHover>();
			InputField = CurrentSetting.ChildByName("InputField").GetComponent<InputField>();
			Slider = CurrentSetting.ChildByName("Slider").GetComponent<Slider>();
			Slider.maxValue = ((FloatSubsetting)Subsetting).MaxValue;
			Slider.minValue = ((FloatSubsetting)Subsetting).MinValue;
			Slider.wholeNumbers = false;
			((UnityEvent<string>)(object)InputField.onEndEdit).AddListener((UnityAction<string>)delegate(string str)
			{
				str = RemoveNonNumeric(str);
				((FloatSubsetting)Subsetting).Value = float.Parse(str);
				Slider.value = (float)Math.Round(float.Parse(str), RoundDigits);
				InputField.text = string.Format(DisplayAs, (float)Math.Round(float.Parse(str), RoundDigits));
			});
			ResetValue();
			((UnityEvent<float>)(object)Slider.onValueChanged).AddListener((UnityAction<float>)delegate(float num)
			{
				if (((FloatSubsetting)Subsetting).Value <= Slider.maxValue || ((Selectable)Slider).isPointerDown)
				{
					((FloatSubsetting)Subsetting).Value = (float)Math.Round(num, RoundDigits);
					InputField.text = string.Format(DisplayAs, (float)Math.Round(num, RoundDigits));
					if (Subsetting.Parent.IsEnabled)
					{
						Subsetting.Parent.OnSubsettingUpdate();
					}
				}
			});
			return CurrentSetting;
			static string RemoveNonNumeric(string s)
			{
				string text = "";
				if (s.StartsWith("-"))
				{
					text += "-";
				}
				return string.Concat(text, string.Concat(s?.Where((char c) => char.IsNumber(c) || c == '.') ?? ""));
			}
		}

		public override void SetControlsActive(bool active)
		{
			((Selectable)Slider).interactable = active;
			((Selectable)InputField).interactable = active;
		}

		public override void ResetValue()
		{
			Slider.value = ((FloatSubsetting)Subsetting).Value;
			InputField.text = string.Format(DisplayAs, ((FloatSubsetting)Subsetting).Value);
		}
	}
	public class SliderIntSubsettingElement : SubsettingUIElement
	{
		public static GameObject BaseSetting;

		public GameObject CurrentSetting;

		public string DisplayAs = "{0}";

		public InputField InputField;

		public Slider Slider;

		public SliderIntSubsettingElement(string displayAs = "{0}")
		{
			DisplayAs = displayAs;
		}

		public override GameObject Create(Transform t)
		{
			if ((Object)(object)BaseSetting == (Object)null)
			{
				BaseSetting = AssetHandler.Bundle.LoadAsset<GameObject>("Slider Subsetting.prefab");
			}
			CurrentSetting = Object.Instantiate<GameObject>(BaseSetting, t);
			CurrentSetting.ChildByName("Text").GetComponent<Text>().text = Subsetting.Metadata.Name.ToUpper();
			CurrentSetting.ChildByName("Box").ChildByName("Description").GetComponent<Text>()
				.text = Subsetting.Metadata.Description;
			CurrentSetting.ChildByName("Text").AddComponent<ShowBoxOnHover>();
			InputField = CurrentSetting.ChildByName("InputField").GetComponent<InputField>();
			Slider = CurrentSetting.ChildByName("Slider").GetComponent<Slider>();
			Slider.maxValue = ((IntSubsetting)Subsetting).MaxValue;
			Slider.minValue = ((IntSubsetting)Subsetting).MinValue;
			((UnityEvent<string>)(object)InputField.onEndEdit).AddListener((UnityAction<string>)delegate(string str)
			{
				str = RemoveNonNumeric(str);
				((IntSubsetting)Subsetting).Value = int.Parse(str);
				Slider.value = int.Parse(str);
				InputField.text = string.Format(DisplayAs, int.Parse(str));
				if (Subsetting.Parent.IsEnabled)
				{
					Subsetting.Parent.OnSubsettingUpdate();
				}
			});
			ResetValue();
			((UnityEvent<float>)(object)Slider.onValueChanged).AddListener((UnityAction<float>)delegate(float num)
			{
				if ((float)((IntSubsetting)Subsetting).Value <= Slider.maxValue || ((Selectable)Slider).isPointerDown)
				{
					((IntSubsetting)Subsetting).Value = (int)num;
					InputField.text = string.Format(DisplayAs, (int)num);
					if (Subsetting.Parent.IsEnabled)
					{
						Subsetting.Parent.OnSubsettingUpdate();
					}
				}
			});
			return CurrentSetting;
			static string RemoveNonNumeric(string s)
			{
				string text = "";
				if (s.StartsWith("-"))
				{
					text += "-";
				}
				return string.Concat(text, string.Concat(s?.Where((char c) => char.IsNumber(c)) ?? ""));
			}
		}

		public override void SetControlsActive(bool active)
		{
			((Selectable)Slider).interactable = active;
			((Selectable)InputField).interactable = active;
		}

		public override void ResetValue()
		{
			Slider.value = ((IntSubsetting)Subsetting).Value;
			InputField.text = string.Format(DisplayAs, ((IntSubsetting)Subsetting).Value);
		}
	}
}
namespace UltraTweaker.Handlers
{
	public static class AssetHandler
	{
		public static readonly string AssetsPath = Path.Combine(PathUtils.ModPath(), "Assets");

		public static readonly string BundlePath = Path.Combine(AssetsPath, "ultratweaker_assets.bundle");

		private static Dictionary<string, Object> _cachedAssets = new Dictionary<string, Object>();

		public static AssetBundle Bundle { get; private set; }

		internal static void LoadBundle()
		{
			Bundle = AssetBundle.LoadFromFile(BundlePath);
		}

		public static T GetCachedAsset<T>(string Name) where T : Object
		{
			if (!_cachedAssets.ContainsKey(Name))
			{
				CacheAsset<T>(Name, Bundle);
			}
			Object obj = _cachedAssets[Name];
			return (T)(object)((obj is T) ? obj : null);
		}

		public static void CacheAsset<T>(string Name, AssetBundle bundle = null) where T : Object
		{
			if ((Object)(object)bundle == (Object)null)
			{
				bundle = Bundle;
			}
			_cachedAssets.Add(Name, (Object)(object)bundle.LoadAsset<T>(Name));
		}
	}
	internal static class MutatorHandler
	{
		public class MutatorPatches
		{
			[HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")]
			[HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")]
			[HarmonyPrefix]
			public static bool DisableCG()
			{
				foreach (Tweak value in UltraTweaker.AllTweaks.Values)