Decompiled source of Trampoline v1.0.0

Trampoline.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
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("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Trampoline")]
[assembly: AssemblyTitle("Trampoline")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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;
		}
	}
}
public class TrampolineItem : MonoBehaviour
{
	private AudioSource audioSource;

	[Header("Bounce Settings")]
	public float bounceForce = 20f;

	public bool useWorldUp = true;

	public bool triggerRagdoll = true;

	[Header("Audio Settings")]
	public AudioClip[] bounceSounds;

	private void Awake()
	{
		audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
		audioSource.spatialBlend = 1f;
		audioSource.minDistance = 2f;
		audioSource.maxDistance = 20f;
	}

	private void OnCollisionEnter(Collision collision)
	{
		TryBounce(collision.gameObject);
	}

	private void OnTriggerEnter(Collider other)
	{
		TryBounce(((Component)other).gameObject);
	}

	private void TryBounce(GameObject target)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: 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_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_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: 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_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		bool flag = false;
		Vector3 val = (useWorldUp ? Vector3.up : ((Component)this).transform.up);
		Vector3 val2 = val * bounceForce;
		PlayerController componentInParent = target.GetComponentInParent<PlayerController>();
		if ((Object)(object)componentInParent != (Object)null)
		{
			Rigidbody component = ((Component)componentInParent).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				if (triggerRagdoll)
				{
					PlayerTumble component2 = ((Component)componentInParent).GetComponent<PlayerTumble>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.isTumbling = true;
					}
				}
				component.velocity = new Vector3(component.velocity.x, 0f, component.velocity.z);
				component.AddForce(val2, (ForceMode)2);
			}
			flag = true;
		}
		EnemyRigidbody componentInParent2 = target.GetComponentInParent<EnemyRigidbody>();
		if ((Object)(object)componentInParent2 != (Object)null)
		{
			if (PhotonNetwork.IsMasterClient || !PhotonNetwork.IsConnected)
			{
				Rigidbody component3 = ((Component)componentInParent2).GetComponent<Rigidbody>();
				if ((Object)(object)component3 != (Object)null)
				{
					component3.velocity = new Vector3(component3.velocity.x, 0f, component3.velocity.z);
					component3.AddForce(val2, (ForceMode)2);
				}
			}
			flag = true;
		}
		if (flag)
		{
			PlayBounceSound();
		}
	}

	private void PlayBounceSound()
	{
		if ((Object)(object)audioSource != (Object)null && bounceSounds != null && bounceSounds.Length != 0)
		{
			audioSource.pitch = Random.Range(0.8f, 1.2f);
			audioSource.PlayOneShot(bounceSounds[Random.Range(0, bounceSounds.Length)]);
		}
	}
}
namespace TrampolineMod
{
	[BepInPlugin("user.trampoline.mod", "Trampoline Mod", "1.0.0")]
	public class TrampolineModPlugin : BaseUnityPlugin
	{
		public static TrampolineModPlugin Instance;

		private void Awake()
		{
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Trampoline Mod Loaded!");
		}
	}
}