Decompiled source of UltraSizeChanger v1.0.4

SizeChanger.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SmolV1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SmolV1")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6ef7e345-9f0f-4de2-9ff5-fffd3c2a8a67")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SmolV1;

[BepInPlugin("DolfeLive.Ultrakill.UltraSmol", "UltraSmol", "1.0.0")]
public class Class1 : BaseUnityPlugin
{
	public const string pluginGuid = "DolfeLive.Ultrakill.UltraSmol";

	public const string pluginName = "UltraSmol";

	public const string pluginVersion = "1.0.0.0";

	private GameObject Player;

	private GameObject PlayerCam;

	private GameObject SingularityPrefab;

	private GameObject Singularity;

	private GameObject[] allObjects;

	private Vector3 SizeControl = new Vector3(1f, 1f, 1f);

	private int ToggleMode = 0;

	private int SingleAxisControl = 0;

	private void Start()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		Harmony val = new Harmony("DolfeLive.Ultrakill.UltraSmol");
		val.PatchAll();
		SingularityPrefab = new GameObject();
	}

	private void Update()
	{
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Expected O, but got Unknown
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_040f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0414: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0430: Unknown result type (might be due to invalid IL or missing references)
		//IL_0872: Unknown result type (might be due to invalid IL or missing references)
		//IL_0877: Unknown result type (might be due to invalid IL or missing references)
		//IL_088e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0893: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fa4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fa9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e87: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e91: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e96: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f2e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f33: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ba1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ba6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bbd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bc2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0704: Unknown result type (might be due to invalid IL or missing references)
		//IL_0709: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d5f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d64: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d80: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player == (Object)null || (Object)(object)PlayerCam == (Object)null)
		{
			PlayerCam = GameObject.Find("Main Camera");
			Player = GameObject.Find("Player");
		}
		if ((Object)(object)Player.transform.parent != (Object)null || (Object)(object)PlayerCam.transform.parent != (Object)(object)Player)
		{
			PlayerCam.transform.SetParent(Player.transform);
			Player.transform.SetParent((Transform)null);
		}
		if (Player.transform.localScale != new Vector3(1f, 1f, 1f) || PlayerCam.transform.localScale != new Vector3(1f, 1f, 1f))
		{
			Player.transform.localScale = new Vector3(1f, 1f, 1f);
			PlayerCam.transform.localScale = new Vector3(1f, 1f, 1f);
		}
		if (Input.GetKeyDown((KeyCode)92))
		{
			ToggleMode++;
			ClearNotif();
			if (ToggleMode == 0)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Mode set to: " + ToggleMode + " This Mode is Multaplicative.</color>", "", "", 0, false);
			}
			else if (ToggleMode == 1)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Mode set to: " + ToggleMode + " This Mode is Addative.</color>", "", "", 0, false);
			}
			else if (ToggleMode == 2)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Mode set to: " + ToggleMode + " This Mode is Control individual axis. \n Press ] to swap between axices and = and - to increase or decrease</color>", "", "", 0, false);
			}
			else if (ToggleMode == 3)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Mode set to: " + ToggleMode + " This Mode is Disabled. \n Any inputs that would normally affect sale have been disabled because mode changing!</color>", "", "", 0, false);
			}
			else if (ToggleMode == 4)
			{
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Mode set to: " + ToggleMode + " This mode is flip current x y or/and z</color>", "", "", 0, false);
			}
			else if (ToggleMode == 5)
			{
				ToggleMode = 0;
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Mode set to: " + ToggleMode + " This Mode is Multaplicative.</color>", "", "", 0, false);
			}
		}
		if ((Object)(object)SingularityPrefab == (Object)null)
		{
			SingularityPrefab = new GameObject();
		}
		else if ((Object)(object)Singularity == (Object)null)
		{
			Singularity = Object.Instantiate<GameObject>(SingularityPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
		}
		if (ToggleMode == 3)
		{
			return;
		}
		Vector3 sizeControl;
		if (ToggleMode == 0)
		{
			if (Input.GetKeyDown((KeyCode)61) && SingleAxisControl == 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Add multiple size from x y and z");
				SizeControl = new Vector3(SizeControl.x * 10f, SizeControl.y * 10f, SizeControl.z * 10f);
				ClearNotif();
				HudMessageReceiver instance = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
			else if (Input.GetKeyDown((KeyCode)45) && SingleAxisControl == 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Remove multiple size from x y and z");
				SizeControl = new Vector3(SizeControl.x * 0.1f, SizeControl.y * 0.1f, SizeControl.z * 0.1f);
				ClearNotif();
				HudMessageReceiver instance2 = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance2.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
			if (Input.GetKeyDown((KeyCode)61) && (SingleAxisControl == 1 || SingleAxisControl == 2 || SingleAxisControl == 3))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Add multiple size from x y or z");
				if (SingleAxisControl == 1)
				{
					SizeControl.x *= 10f;
				}
				if (SingleAxisControl == 2)
				{
					SizeControl.y *= 10f;
				}
				if (SingleAxisControl == 3)
				{
					SizeControl.z *= 10f;
				}
				ClearNotif();
				HudMessageReceiver instance3 = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance3.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
			else if (Input.GetKeyDown((KeyCode)45) && (SingleAxisControl == 1 || SingleAxisControl == 2 || SingleAxisControl == 3))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Remove multiple size from x y or z");
				if (SingleAxisControl == 1)
				{
					SizeControl.x *= 0.1f;
				}
				if (SingleAxisControl == 2)
				{
					SizeControl.y *= 0.1f;
				}
				if (SingleAxisControl == 3)
				{
					SizeControl.z *= 0.1f;
				}
				ClearNotif();
				HudMessageReceiver instance4 = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance4.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
		}
		else if (ToggleMode == 1)
		{
			if (Input.GetKeyDown((KeyCode)61) && SingleAxisControl == 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Add 1 to all decimal level");
				decimal num = (decimal)SizeControl.x;
				decimal num2 = (decimal)SizeControl.y;
				decimal num3 = (decimal)SizeControl.z;
				decimal d = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num)[3] >> 16));
				decimal d2 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num2)[3] >> 16));
				decimal d3 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num3)[3] >> 16));
				num = decimal.Add(num, d);
				num2 = decimal.Add(num2, d2);
				num3 = decimal.Add(num3, d3);
				SizeControl = new Vector3((float)num, (float)num2, (float)num3);
				ClearNotif();
				HudMessageReceiver instance5 = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance5.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
			if (Input.GetKeyDown((KeyCode)45) && SingleAxisControl == 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Remove 1 from all decimal level");
				decimal num4 = (decimal)SizeControl.x;
				decimal num5 = (decimal)SizeControl.y;
				decimal num6 = (decimal)SizeControl.z;
				decimal d4 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num4)[3] >> 16));
				decimal d5 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num5)[3] >> 16));
				decimal d6 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num6)[3] >> 16));
				num4 = decimal.Subtract(num4, d4);
				num5 = decimal.Subtract(num5, d5);
				num6 = decimal.Subtract(num6, d6);
				SizeControl = new Vector3((float)num4, (float)num5, (float)num6);
				ClearNotif();
				HudMessageReceiver instance6 = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance6.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
			else if (Input.GetKeyDown((KeyCode)61) && (SingleAxisControl == 1 || SingleAxisControl == 2 || SingleAxisControl == 3))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Add 1 to x y or z");
				decimal num7 = (decimal)SizeControl.x;
				decimal num8 = (decimal)SizeControl.y;
				decimal num9 = (decimal)SizeControl.z;
				decimal d7 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num7)[3] >> 16));
				decimal d8 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num8)[3] >> 16));
				decimal d9 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num9)[3] >> 16));
				if (SingleAxisControl == 1)
				{
					num7 = decimal.Add(num7, d7);
				}
				if (SingleAxisControl == 2)
				{
					num8 = decimal.Add(num8, d8);
				}
				if (SingleAxisControl == 3)
				{
					num9 = decimal.Add(num9, d9);
				}
				SizeControl = new Vector3((float)num7, (float)num8, (float)num9);
				ClearNotif();
				HudMessageReceiver instance7 = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance7.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
			else if (Input.GetKeyDown((KeyCode)45) && (SingleAxisControl == 1 || SingleAxisControl == 2 || SingleAxisControl == 3))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Remove 1 from x y or z");
				decimal num10 = (decimal)SizeControl.x;
				decimal num11 = (decimal)SizeControl.y;
				decimal num12 = (decimal)SizeControl.z;
				decimal d10 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num10)[3] >> 16));
				decimal d11 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num11)[3] >> 16));
				decimal d12 = decimal.Divide(1m, (decimal)Math.Pow(10.0, decimal.GetBits(num12)[3] >> 16));
				if (SingleAxisControl == 1)
				{
					num10 = decimal.Subtract(num10, d10);
				}
				if (SingleAxisControl == 2)
				{
					num11 = decimal.Subtract(num11, d11);
				}
				if (SingleAxisControl == 3)
				{
					num12 = decimal.Subtract(num12, d12);
				}
				SizeControl = new Vector3((float)num10, (float)num11, (float)num12);
				ClearNotif();
				HudMessageReceiver instance8 = MonoSingleton<HudMessageReceiver>.Instance;
				sizeControl = SizeControl;
				instance8.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "\n Press 0 To update everying size</color>", "", "", 0, false);
			}
		}
		else if (ToggleMode == 2)
		{
			if (Input.GetKeyDown((KeyCode)93))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Size control add 1");
				SingleAxisControl++;
				ClearNotif();
				AxisMsg();
			}
			else if (Input.GetKeyDown((KeyCode)91))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Size control remove 1");
				SingleAxisControl--;
				ClearNotif();
				AxisMsg();
			}
		}
		else if (ToggleMode == 4 && (Input.GetKeyDown((KeyCode)61) || Input.GetKeyDown((KeyCode)45)))
		{
			if (SingleAxisControl == 0)
			{
				SizeControl *= -1f;
			}
			if (SingleAxisControl == 1)
			{
				SizeControl.x *= -1f;
			}
			if (SingleAxisControl == 2)
			{
				SizeControl.y *= -1f;
			}
			if (SingleAxisControl == 3)
			{
				SizeControl.z *= -1f;
			}
			HudMessageReceiver instance9 = MonoSingleton<HudMessageReceiver>.Instance;
			sizeControl = SizeControl;
			instance9.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "</color>", "", "", 0, false);
		}
		if (Input.GetKeyDown((KeyCode)48))
		{
			ListGameObjectsInScene();
			ClearNotif();
			UpdateSize();
		}
		else if (Input.GetKeyDown((KeyCode)57))
		{
			SizeControl = new Vector3(1f, 1f, 1f);
			ClearNotif();
			HudMessageReceiver instance10 = MonoSingleton<HudMessageReceiver>.Instance;
			sizeControl = SizeControl;
			instance10.SendHudMessage("<color=red>Current scale: " + ((object)(Vector3)(ref sizeControl)).ToString() + "</color>", "", "", 0, false);
			UpdateSize();
		}
	}

	private void UpdateSize()
	{
		//IL_0002: 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)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		if (SizeControl != new Vector3(0f, 0f, 0f))
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=blue>Updated size to: " + SizeControl.x + " " + SizeControl.y + " " + SizeControl.z + "</color>", "", "", 0, false);
			Singularity.transform.localScale = new Vector3(SizeControl.x, SizeControl.y, SizeControl.z);
		}
		else if (SizeControl == new Vector3(0f, 0f, 0f))
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Trying to set the scale to 0 will immediately crash your game \n This failsafe has prevented it!</color>", "", "", 0, false);
		}
	}

	private void ListGameObjectsInScene()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		Scene activeScene = SceneManager.GetActiveScene();
		GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
		GameObject[] array = rootGameObjects;
		foreach (GameObject val in array)
		{
			if ((Object)(object)val != (Object)(object)Singularity || (Object)(object)val != (Object)(object)Player || (Object)(object)val != (Object)(object)PlayerCam)
			{
				val.transform.SetParent(Singularity.transform, false);
			}
		}
	}

	private void ClearNotif()
	{
		MonoSingleton<HudMessageReceiver>.Instance.ClearMessage();
	}

	private void AxisMsg()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)SingleAxisControl);
		if (SingleAxisControl == 0)
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=yellow>Mode set to: " + SingleAxisControl + " This Mode is all axies.</color>", "", "", 0, false);
		}
		else if (SingleAxisControl == 1)
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=blue>Mode set to: " + SingleAxisControl + " This Mode is x.</color>", "", "", 0, false);
		}
		else if (SingleAxisControl == 2)
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=green>Mode set to: " + SingleAxisControl + " This Mode is y</color>", "", "", 0, false);
		}
		else if (SingleAxisControl == 3)
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=orange>Mode set to: " + SingleAxisControl + " This Mode is z</color>", "", "", 0, false);
		}
		else if (SingleAxisControl >= 4 || SingleAxisControl <= -1)
		{
			SingleAxisControl = 0;
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=yellow>Mode set to: " + SingleAxisControl + " This Mode is all axies.</color>", "", "", 0, false);
		}
	}
}