Decompiled source of Flying V1 v1.3.5

Flying_V1.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 UnityEngine;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Flying_V1")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.5.0")]
[assembly: AssemblyInformationalVersion("1.3.5")]
[assembly: AssemblyProduct("Flying_V1")]
[assembly: AssemblyTitle("Flying_V1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.5.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;
		}
	}
}
[BepInPlugin("com.potpot.flyingv1", "Flying V1", "1.3.5")]
public class GabrielPlugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.potpot.flyingv1");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Flying V1: 230 MPH (345 hu/s) & Sisyphus Slam v1.2.5 Loaded!");
	}
}
[HarmonyPatch(typeof(NewMovement), "Start")]
public class PlayerPatch
{
	private static void Postfix(NewMovement __instance)
	{
		if ((Object)(object)((Component)__instance).gameObject.GetComponent<GabrielController>() == (Object)null)
		{
			((Component)__instance).gameObject.AddComponent<GabrielController>();
		}
	}
}
public class GabrielController : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <SisyphusSlamSequence>d__13 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public GabrielController <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SisyphusSlamSequence>d__13(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.isMeteorDiving = true;
				<>4__this.rb.velocity = Vector3.up * 80f;
				<>4__this.SpawnSFX("Prefabs/Attacks/Insurrectionist/InsurrectionistJump");
				<>2__current = (object)new WaitForSeconds(0.18f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.rb.velocity = Vector3.down * <>4__this.slamSpeed;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private NewMovement nm;

	private Rigidbody rb;

	private float flightSpeed = 50f;

	private float sprintSpeed = 345f;

	private float slamSpeed = 450f;

	private bool isFlying = false;

	private bool isSprinting = false;

	private bool isMeteorDiving = false;

	private float lastSpaceTime = 0f;

	private float lastWTime = 0f;

	private void Start()
	{
		nm = ((Component)this).GetComponent<NewMovement>();
		rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)rb != (Object)null)
		{
			rb.collisionDetectionMode = (CollisionDetectionMode)2;
		}
	}

	private void Update()
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)nm != (Object)null)
		{
			nm.boostCharge = 500f;
		}
		if (Input.GetKeyDown((KeyCode)32))
		{
			if (Time.time - lastSpaceTime < 0.3f && !isFlying)
			{
				isFlying = true;
				rb.useGravity = false;
				rb.velocity = Vector3.zero;
				SpawnSFX("Prefabs/Attacks/Explosions/Explosion");
			}
			lastSpaceTime = Time.time;
		}
		if (Input.GetKeyDown((KeyCode)308) && isFlying && !isMeteorDiving)
		{
			((MonoBehaviour)this).StartCoroutine(SisyphusSlamSequence());
		}
		if (Input.GetKeyDown((KeyCode)306) && isFlying)
		{
			ExitFlight();
			SpawnSFX("Prefabs/Attacks/Explosions/ExplosionSuper");
		}
		if (isFlying && !isMeteorDiving)
		{
			HandleFlightMovement();
		}
	}

	private void FixedUpdate()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		if (isMeteorDiving)
		{
			float num = slamSpeed * Time.fixedDeltaTime + 3f;
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, num, LayerMask.GetMask(new string[2] { "Environment", "Outdoors" })))
			{
				TriggerSisyphusImpact(((RaycastHit)(ref val)).point);
			}
		}
	}

	[IteratorStateMachine(typeof(<SisyphusSlamSequence>d__13))]
	private IEnumerator SisyphusSlamSequence()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SisyphusSlamSequence>d__13(0)
		{
			<>4__this = this
		};
	}

	private void HandleFlightMovement()
	{
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: 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_011f: 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_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: 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)
		if (Input.GetKeyDown((KeyCode)119))
		{
			if (Time.time - lastWTime < 0.3f)
			{
				isSprinting = true;
			}
			lastWTime = Time.time;
		}
		if (Input.GetKeyUp((KeyCode)119))
		{
			isSprinting = false;
		}
		float axisRaw = Input.GetAxisRaw("Horizontal");
		float axisRaw2 = Input.GetAxisRaw("Vertical");
		float num = (Input.GetKey((KeyCode)32) ? 1f : (Input.GetKey((KeyCode)122) ? (-1f) : 0f));
		if (Input.GetKeyDown((KeyCode)304))
		{
			rb.velocity = ((Component)this).transform.forward * (sprintSpeed + 30f);
			SpawnSFX("Prefabs/Attacks/Insurrectionist/InsurrectionistJump");
			return;
		}
		float num2 = (isSprinting ? sprintSpeed : flightSpeed);
		Vector3 val = ((Component)this).transform.right * axisRaw + ((Component)this).transform.forward * axisRaw2 + Vector3.up * num;
		if (((Vector3)(ref val)).sqrMagnitude > 0.01f)
		{
			rb.velocity = ((Vector3)(ref val)).normalized * num2;
		}
		else
		{
			rb.velocity = Vector3.zero;
		}
	}

	private void TriggerSisyphusImpact(Vector3 impactPoint)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: 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)
		ExitFlight();
		((Component)this).transform.position = impactPoint + Vector3.up * 1.2f;
		rb.velocity = Vector3.zero;
		GameObject val = Resources.Load<GameObject>("Prefabs/Attacks/Sisyphus/SisyphusShockwave");
		if ((Object)(object)val != (Object)null)
		{
			GameObject val2 = Object.Instantiate<GameObject>(val, impactPoint + Vector3.up * 0.2f, Quaternion.identity);
			PhysicalShockwave component = val2.GetComponent<PhysicalShockwave>();
			if ((Object)(object)component != (Object)null)
			{
				component.damage = 100;
				component.maxSize = 100f;
				component.speed = 75f;
				component.enemy = false;
			}
		}
		GameObject val3 = Resources.Load<GameObject>("Prefabs/Attacks/Sisyphus/SisyphusStompExplosion");
		if ((Object)(object)val3 != (Object)null)
		{
			GameObject val4 = Object.Instantiate<GameObject>(val3, impactPoint, Quaternion.identity);
			Explosion componentInChildren = val4.GetComponentInChildren<Explosion>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.damage = 250;
				componentInChildren.maxSize = 45f;
			}
		}
		if ((Object)(object)MonoSingleton<CameraController>.Instance != (Object)null)
		{
			MonoSingleton<CameraController>.Instance.CameraShake(4f);
		}
	}

	private void OnCollisionEnter(Collision col)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		ContactPoint contact;
		if (isMeteorDiving)
		{
			contact = col.GetContact(0);
			TriggerSisyphusImpact(((ContactPoint)(ref contact)).point);
		}
		if (isFlying && isSprinting && col.gameObject.layer != 20)
		{
			EnemyIdentifier componentInParent = col.gameObject.GetComponentInParent<EnemyIdentifier>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				GameObject gameObject = col.gameObject;
				Vector3 val = ((Component)this).transform.forward * 50f;
				contact = col.GetContact(0);
				componentInParent.DeliverDamage(gameObject, val, ((ContactPoint)(ref contact)).point, 230f, false, 0f, (GameObject)null, false, false);
				SpawnSFX("Prefabs/Attacks/Explosions/Explosion");
			}
		}
	}

	private void ExitFlight()
	{
		isFlying = false;
		isMeteorDiving = false;
		rb.useGravity = true;
	}

	private void SpawnSFX(string path)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Resources.Load<GameObject>(path);
		if ((Object)(object)val != (Object)null)
		{
			Object.Instantiate<GameObject>(val, ((Component)this).transform.position, Quaternion.identity);
		}
	}
}