Decompiled source of UK Paraglider v1.0.1

paraglider.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Configgy;
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("paraglider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("paraglider")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b557035d-7668-42cb-b7e2-a46c1fd7a253")]
[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 paraglider;

[BepInPlugin("capybaramods.Ultrakill.paraglider", "paraglider", "1.0.0")]
public class Paraglidermod : BaseUnityPlugin
{
	private ConfigBuilder config;

	public int gliderState = 0;

	public bool gliderStateBegin = false;

	public bool gliderout = false;

	public GameObject[] thingy;

	public GameObject paraglider;

	public MeshRenderer paraglidermodel;

	public GameObject playercam;

	public TrailRenderer trail1;

	public TrailRenderer trail2;

	public GameObject penis;

	public bool paragliderloaded = false;

	public GameObject closesfx;

	public float scale = 0.1f;

	public float minScale = 0.5f;

	public float maxScale = 1f;

	public float scaleSpeed = 10.5f;

	public Quaternion pararot;

	public GameObject playerthing;

	public AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "donotdeleteormodbreaks"));

	public Quaternion targetrot;

	public GameObject flapobject;

	public AudioSource flapsfx;

	[Configgable("", "Paraglider Keybind", 1, "The keybind to open the paraglider, default is T.")]
	public static ConfigKeybind paragliderBind = new ConfigKeybind((KeyCode)116);

	[Configgable("", "Paraglider Enabled", 0, null)]
	public static bool GliderEnabled = true;

	private void Awake()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		SceneManager.sceneLoaded += OnSceneLoaded;
		config = new ConfigBuilder("Lakeull.UK_BOTW", "UK_BOTW");
		config.BuildAll();
	}

	private void Start()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		Debug.Log((object)"paraglider mod began");
		Debug.Log((object)"-#  paraglider: Hey! if you see this, everything is working fine. this isnt an error, hakita fucked up debug logging.");
		Harmony val = new Harmony("capybaramods.Ultrakill.paraglider GUID");
		val.PatchAll();
	}

	[HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")]
	[HarmonyPrefix]
	public static bool noLeaderboard(LeaderboardController __instance)
	{
		Debug.Log((object)"hihihi i removed leaderboards ok bye");
		return false;
	}

	private void Getbundle()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"buh");
		Debug.LogWarning((object)"-# buh");
		thingy = bundle.LoadAllAssets<GameObject>();
		GameObject[] array = thingy;
		foreach (GameObject val in array)
		{
			Object.Instantiate<GameObject>(val, ((Component)MonoSingleton<NewMovement>.Instance).transform.position, Quaternion.identity);
		}
		paraglider = GameObject.Find("paraglider com(Clone)");
		if ((Object)(object)paraglider == (Object)null)
		{
			Debug.LogWarning((object)"paraglider is null");
			return;
		}
		GameObject val2 = GameObject.Find("Player/Main Camera");
		CopyPositionAndRotation val3 = paraglider.AddComponent<CopyPositionAndRotation>();
		val3.target = val2.transform;
		val3.copyRotation = false;
		penis = GameObject.Find("paraglider com(Clone)/paraglider model");
		penis.SetActive(true);
		closesfx = GameObject.Find("paraglider com(Clone)/close sfx");
		closesfx.SetActive(false);
		flapobject = GameObject.Find("paraglider com(Clone)/paraglider model/flap sfx");
		flapsfx = flapobject.GetComponent<AudioSource>();
		paragliderloaded = true;
		if ((Object)(object)flapsfx == (Object)null)
		{
			Debug.LogError((object)"fuck yu unity why  my sfx null");
		}
		if ((Object)(object)flapobject == (Object)null)
		{
			Debug.LogError((object)"i hae unity cause flapping object sfx IS BROKEN!!!!!!!!");
		}
	}

	public void OnSceneLoaded(Scene scene, LoadSceneMode lsm)
	{
		paragliderloaded = false;
		gliderout = false;
		Debug.LogWarning((object)paragliderloaded);
	}

	private void ParagliderOpen()
	{
		if ((gliderState == 2 || gliderState == 0) && !gliderout)
		{
			gliderout = true;
			gliderState = 1;
			gliderStateBegin = true;
		}
		penis.SetActive(true);
	}

	private void ParagliderClose()
	{
		if ((gliderState == 1 || gliderState == 0) && gliderout)
		{
			gliderout = false;
			gliderState = 2;
			gliderStateBegin = true;
		}
	}

	public void Update()
	{
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: 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_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: 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_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a8: 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_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_045c: Unknown result type (might be due to invalid IL or missing references)
		if (!(SceneHelper.CurrentScene != "Bootstrap") || !(SceneHelper.CurrentScene != "Main Menu") || !(SceneHelper.CurrentScene != "Intro") || !((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null))
		{
			return;
		}
		if (!paragliderloaded)
		{
			Debug.LogWarning((object)paragliderloaded);
			Getbundle();
			penis.SetActive(false);
			return;
		}
		bool keyDown = Input.GetKeyDown(((ConfigValueElement<KeyCode>)(object)paragliderBind).Value);
		bool flag = !Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance.ridingRocket) && MonoSingleton<NewMovement>.Instance.falling && !MonoSingleton<NewMovement>.Instance.rb.isKinematic && !MonoSingleton<NewMovement>.Instance.gc.heavyFall && GliderEnabled;
		if (keyDown)
		{
			if (flag)
			{
				if (!gliderout)
				{
					ParagliderOpen();
				}
				else
				{
					ParagliderClose();
				}
			}
			else
			{
				ParagliderClose();
			}
		}
		if ((!flag && gliderout) || !GliderEnabled)
		{
			ParagliderClose();
		}
		if (gliderout)
		{
			MonoSingleton<NewMovement>.Instance.rb.velocity = new Vector3(MonoSingleton<NewMovement>.Instance.rb.velocity.x, Mathf.Clamp(MonoSingleton<NewMovement>.Instance.rb.velocity.y, -5f, 130f), MonoSingleton<NewMovement>.Instance.rb.velocity.z);
			if (MonoSingleton<NewMovement>.Instance.walkSpeed <= 1150f)
			{
				NewMovement instance = MonoSingleton<NewMovement>.Instance;
				instance.walkSpeed += 2f;
			}
			Quaternion rotation = ((Component)MonoSingleton<NewMovement>.Instance).transform.rotation;
			targetrot = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles);
			rotation = paraglider.transform.rotation;
			pararot = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles);
			paraglider.transform.rotation = Quaternion.Lerp(paraglider.transform.rotation, ((Component)MonoSingleton<NewMovement>.Instance).transform.rotation, 0.0025f * Quaternion.Angle(pararot, targetrot));
			flapobject = GameObject.Find("paraglider com(Clone)/paraglider model/flap sfx");
			AudioSource obj = flapsfx;
			Vector3 velocity = MonoSingleton<NewMovement>.Instance.rb.velocity;
			obj.volume = 0.02f * ((Vector3)(ref velocity)).magnitude;
		}
		else
		{
			MonoSingleton<NewMovement>.Instance.walkSpeed = 750f;
		}
		switch (gliderState)
		{
		case 1:
			closesfx.SetActive(false);
			if (gliderStateBegin)
			{
				scale = 0.1f;
				gliderStateBegin = false;
			}
			scale += (scale * 0.2f + scaleSpeed) * Time.deltaTime;
			if (scale > maxScale)
			{
				scale = maxScale;
				gliderState = 0;
			}
			penis.transform.localScale = new Vector3(150f * scale, 141f * scale, 141f * scale);
			break;
		case 2:
			closesfx.SetActive(true);
			if (gliderStateBegin)
			{
				scale = maxScale;
				gliderStateBegin = false;
			}
			scale -= (scale * 0.2f + scaleSpeed) * Time.deltaTime;
			if (scale < 0.1f)
			{
				scale = 0.1f;
				penis.SetActive(false);
			}
			penis.transform.localScale = new Vector3(150f * scale, 141f * scale, 141f * scale);
			break;
		}
	}
}