Decompiled source of Glitchy Scrap v1.0.0

plugins/GlitchyScrap.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Dawn;
using Dawn.Utils;
using Dusk;
using Dusk.Weights;
using GlitchyScrap.NetcodePatcher;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
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("GlitchyScrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("GlitchyScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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;
		}
	}
}
namespace GlitchyScrap
{
	[BepInPlugin("GlitchyScrap", "My first plugin", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public class ScrapConfig
		{
			public ConfigEntry<string> MoonSpawnWeights;

			public ConfigEntry<string> InteriorSpawnWeights;

			public ConfigEntry<string> WeatherSpawnWeights;

			public ConfigEntry<BoundedRange> Value;
		}

		public const string DawnDep = "com.github.teamxiaolan.dawnlib";

		public static Plugin instance;

		public ScrapConfig scrapConfig;

		public SpawnWeightsPreset SpawnWeights { get; private set; } = new SpawnWeightsPreset();


		private void Awake()
		{
			instance = this;
			AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "gsassets");
			if ((Object)(object)val != (Object)null)
			{
				RegisterItem("CatBattery/CarBatteryID", val);
				RegisterItem("Frog/FrogID", val);
				RegisterItem("HobbyHorse/HobbyHorseID", val);
				RegisterItem("PropaneTank/PropaneTankID", val);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin GlitchyScrap is loaded!");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Bundle for GlitchyScrap not found");
			}
		}

		internal void RegisterItem(string IDpath, AssetBundle bundle)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			DuskItemDefinition val = bundle.LoadAsset<DuskItemDefinition>(Path.Combine("Assets/LethalCompany/Mods/RandomCrap/", IDpath + ".asset"));
			ConfigContext val2 = new ConfigContext(((BaseUnityPlugin)this).Config, val.Item.itemName + " Options");
			try
			{
				scrapConfig = CreateItemConfig(val2, val);
				SpawnWeights = new SpawnWeightsPreset();
				SpawnWeights.SetupSpawnWeightsPreset(scrapConfig.MoonSpawnWeights.Value, scrapConfig.InteriorSpawnWeights.Value, scrapConfig.WeatherSpawnWeights.Value);
				val.Item.minValue = (int)(scrapConfig.Value.Value.Min * 2.5f);
				val.Item.maxValue = (int)(scrapConfig.Value.Value.Max * 2.5f);
				DawnLib.RegisterNetworkPrefab(val.Item.spawnPrefab);
				DawnLib.DefineItem(((DuskContentDefinition<DawnItemInfo>)(object)val).TypedKey, val.Item, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
					{
						scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
						{
							weightBuilder.SetGlobalWeight((IWeighted)(object)SpawnWeights);
						});
					});
				});
			}
			finally
			{
				((IDisposable)val2)?.Dispose();
			}
		}

		public ScrapConfig CreateItemConfig(ConfigContext context, DuskItemDefinition duskItemDefinition)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			return new ScrapConfig
			{
				MoonSpawnWeights = context.Bind<string>("Preset Moon Weights", "Preset moon weights for " + duskItemDefinition.Item.itemName + ".", duskItemDefinition.MoonSpawnWeights),
				InteriorSpawnWeights = context.Bind<string>("Preset Interior Weights", "Preset interior weights for " + duskItemDefinition.Item.itemName + ".", duskItemDefinition.InteriorSpawnWeights),
				WeatherSpawnWeights = context.Bind<string>("Preset Weather Weights", "Preset weather weights for " + duskItemDefinition.Item.itemName + ".", duskItemDefinition.WeatherSpawnWeights),
				Value = context.Bind<BoundedRange>("Value", "How much " + duskItemDefinition.Item.itemName + " is worth when spawning.", new BoundedRange((float)duskItemDefinition.Item.minValue * 0.4f, (float)duskItemDefinition.Item.maxValue * 0.4f))
			};
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GlitchyScrap";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace GlitchyScrap.Behaviours
{
	internal class HoppingScrap : GrabbableObject
	{
		[CompilerGenerated]
		private sealed class <IDoJumpingCoroutine>d__32 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int counter;

			public HoppingScrap <>4__this;

			private Vector3 <jumpTarget>5__1;

			private bool <setInShipRoom>5__2;

			private bool <setInElevator>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: 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)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: 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_0134: 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_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: 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_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0058;
				case 1:
					<>1__state = -1;
					goto IL_0058;
				case 2:
					<>1__state = -1;
					<jumpTarget>5__1 = <>4__this.GetJumpTarget();
					if (<jumpTarget>5__1 != Vector3.zero)
					{
						<setInShipRoom>5__2 = false;
						Bounds bounds = StartOfRound.Instance.shipBounds.bounds;
						if (!((Bounds)(ref bounds)).Contains(<jumpTarget>5__1))
						{
							<setInElevator>5__3 = false;
							<jumpTarget>5__1 = StartOfRound.Instance.propsContainer.InverseTransformPoint(<jumpTarget>5__1);
						}
						else
						{
							<setInElevator>5__3 = true;
							bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
							<setInShipRoom>5__2 = ((Bounds)(ref bounds)).Contains(<jumpTarget>5__1);
							<jumpTarget>5__1 = StartOfRound.Instance.elevatorTransform.InverseTransformPoint(<jumpTarget>5__1);
						}
						counter--;
						<>4__this.failsafeCount = 0;
						<>4__this.FrogJumpRPC(<jumpTarget>5__1, <setInElevator>5__3, <setInShipRoom>5__2);
						goto IL_01c0;
					}
					<>4__this.failsafeCount++;
					goto IL_01f6;
				case 3:
					<>1__state = -1;
					goto IL_01c0;
				case 4:
					{
						<>1__state = -1;
						<>4__this.StopRpc();
						return false;
					}
					IL_0058:
					if (((GrabbableObject)<>4__this).fallTime < 1f)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>4__this.StartRPC();
					goto IL_01f6;
					IL_01c0:
					if (((GrabbableObject)<>4__this).fallTime < 1f)
					{
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					goto IL_01f6;
					IL_01f6:
					if (counter > 0 && <>4__this.failsafeCount < 5 && !((GrabbableObject)<>4__this).isInElevator)
					{
						<>2__current = (object)new WaitForSeconds(<>4__this.jumpDelay);
						<>1__state = 2;
						return true;
					}
					<>2__current = null;
					<>1__state = 4;
					return true;
				}
			}

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

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

		[Header("Falling Animation Curves")]
		public AnimationCurve JumpCurve;

		public float jumpHeight = 0.5f;

		[Header("Frog Specific FX")]
		public AudioClip jumpSound;

		public AudioClip windLoop;

		private Animator animator;

		private AudioSource audioSource;

		public float noiseRange = 16f;

		public float noiseLoudness = 1.6f;

		private int timesPlayedInOneSpot;

		private Vector3 lastPositionAtFart;

		[Header("Jump Parameters")]
		public float jumpDistance = 5f;

		public float jumpDelay = 0.6f;

		public float upwardClearance = 0.12f;

		public int jumpChance = 40;

		public int jumpCountMin = 3;

		public int jumpCountMax = 7;

		[Header("Restrictions")]
		public float wallAvoidance = 0.2f;

		public float maxFallHeight = 12f;

		public int slopeLimit = 45;

		public LayerMask hitMask = LayerMask.op_Implicit(369101569);

		[Header("Jump Update")]
		private Ray soccerRay;

		private RaycastHit soccerHit;

		private bool isJumping;

		private bool wasObjectPlaced;

		private int failsafeCount;

		private const int maxFailCount = 5;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			jumpCountMax = Mathf.Max(jumpCountMin, jumpCountMax);
			animator = ((Component)this).GetComponent<Animator>();
			audioSource = ((Component)this).GetComponent<AudioSource>();
			if ((Object)(object)windLoop != (Object)null)
			{
				audioSource.clip = windLoop;
				audioSource.loop = true;
			}
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			((MonoBehaviour)this).StopCoroutine("IDoJumpingCoroutine");
			StopRpc();
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			if (!((NetworkBehaviour)this).IsHost || isJumping || base.isInElevator)
			{
				return;
			}
			if (wasObjectPlaced)
			{
				wasObjectPlaced = false;
				return;
			}
			int num = SetJumpCount();
			if (num > 0)
			{
				((MonoBehaviour)this).StartCoroutine(IDoJumpingCoroutine(num));
			}
		}

		public override void OnPlaceObject()
		{
			((GrabbableObject)this).OnPlaceObject();
			wasObjectPlaced = true;
		}

		public override void FallWithCurve()
		{
			//IL_0010: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_00ab: 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)
			//IL_00c3: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if (isJumping)
			{
				Vector3 val = base.targetFloorPosition - base.startFallingPosition;
				float magnitude = ((Vector3)(ref val)).magnitude;
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(base.itemProperties.restingRotation.x, Mathf.Atan2(base.targetFloorPosition.x - base.startFallingPosition.x, base.targetFloorPosition.z - base.startFallingPosition.z) * 57.29578f + 90f, base.itemProperties.restingRotation.z), 16f * Time.deltaTime / magnitude);
				((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, base.targetFloorPosition, base.fallTime);
				Transform transform = ((Component)this).transform;
				transform.localPosition += Vector3.up * (JumpCurve.Evaluate(base.fallTime) * jumpHeight);
				base.fallTime += Mathf.Abs(Time.deltaTime * 12f / magnitude);
				if (base.fallTime >= 1f)
				{
					base.reachedFloorTarget = true;
					((GrabbableObject)this).OnHitGround();
				}
			}
			else
			{
				((GrabbableObject)this).FallWithCurve();
			}
		}

		private int SetJumpCount()
		{
			if (Random.Range(0, 100) < jumpChance)
			{
				return Random.RandomRangeInt(jumpCountMin, jumpCountMax + 1);
			}
			return 0;
		}

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

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(146954598u, val2, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 146954598u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				isJumping = true;
				Debug.Log((object)"Client RPC");
				Animator obj = animator;
				if (obj != null)
				{
					obj.SetBool("Winding", true);
				}
				AudioSource obj2 = audioSource;
				if (obj2 != null)
				{
					obj2.Play();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StopRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1152892137u, val2, val, (SendTo)7, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1152892137u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				isJumping = false;
				failsafeCount = 0;
				Animator obj = animator;
				if (obj != null)
				{
					obj.SetBool("Winding", false);
				}
				AudioSource obj2 = audioSource;
				if (obj2 != null)
				{
					obj2.Stop();
				}
			}
		}

		public Vector3 GetJumpTarget()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//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_0018: 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_003d: 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_00b6: 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_0104: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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)
			soccerRay = new Ray(((Component)this).transform.position, GetJumpDirection());
			float num = 0f;
			num = ((!Physics.Raycast(soccerRay, ref soccerHit, jumpDistance + wallAvoidance, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1)) ? jumpDistance : Mathf.Max(((RaycastHit)(ref soccerHit)).distance - ((((Component)((RaycastHit)(ref soccerHit)).collider).gameObject.tag == "Rock") ? (wallAvoidance * 3f) : wallAvoidance), 0f));
			if (Physics.Raycast(((Ray)(ref soccerRay)).GetPoint(num), Vector3.down, ref soccerHit, 65f, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1) && IsLandingPositionValid())
			{
				return ((RaycastHit)(ref soccerHit)).point;
			}
			if (Physics.Raycast(((Ray)(ref soccerRay)).GetPoint(num - 0.15f), Vector3.down, ref soccerHit, 65f, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)1) && IsLandingPositionValid())
			{
				return ((RaycastHit)(ref soccerHit)).point;
			}
			return Vector3.zero;
		}

		public Vector3 GetJumpDirection()
		{
			//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)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//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_002e: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			Vector2 insideUnitCircle = Random.insideUnitCircle;
			Vector3 val = Vector2.op_Implicit(((Vector2)(ref insideUnitCircle)).normalized);
			val.z = val.y;
			val.y = upwardClearance;
			return val;
		}

		public bool IsLandingPositionValid()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (((RaycastHit)(ref soccerHit)).distance > maxFallHeight)
			{
				return false;
			}
			if (Vector3.Angle(((RaycastHit)(ref soccerHit)).normal, Vector3.up) >= (float)slopeLimit)
			{
				return false;
			}
			return true;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void FrogJumpRPC(Vector3 destinationPos, bool setInElevator, bool setInShipRoom)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_018e: 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)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1675992513u, val2, val, (SendTo)7, (RpcDelivery)0);
				((FastBufferWriter)(ref val3)).WriteValueSafe(ref destinationPos);
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref setInElevator, default(ForPrimitives));
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref setInShipRoom, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1675992513u, val2, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Animator obj = animator;
				if (obj != null)
				{
					obj.SetTrigger("Hop");
				}
				base.fallTime = 0f;
				base.hasHitGround = false;
				if (setInElevator)
				{
					((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
				}
				else
				{
					((Component)this).transform.SetParent(StartOfRound.Instance.propsContainer, true);
				}
				GameNetworkManager.Instance.localPlayerController.SetItemInElevator(setInElevator, setInShipRoom, (GrabbableObject)(object)this);
				base.startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(((Component)this).transform.position + Vector3.up * 0.07f);
				base.targetFloorPosition = destinationPos;
			}
		}

		private void JumpEvent()
		{
			//IL_001a: 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_0058: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			AudioSource obj = audioSource;
			if (obj != null)
			{
				obj.PlayOneShot(jumpSound);
			}
			if (Vector3.Distance(lastPositionAtFart, ((Component)this).transform.position) > 2f)
			{
				timesPlayedInOneSpot = 0;
			}
			timesPlayedInOneSpot++;
			lastPositionAtFart = ((Component)this).transform.position;
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange / 2f, noiseLoudness / 2f, timesPlayedInOneSpot, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(146954598u, new RpcReceiveHandler(__rpc_handler_146954598), "StartRPC");
			((NetworkBehaviour)this).__registerRpc(1152892137u, new RpcReceiveHandler(__rpc_handler_1152892137), "StopRpc");
			((NetworkBehaviour)this).__registerRpc(1675992513u, new RpcReceiveHandler(__rpc_handler_1675992513), "FrogJumpRPC");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_146954598(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HoppingScrap)(object)target).StartRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1152892137(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HoppingScrap)(object)target).StopRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1675992513(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: 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_0057: 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_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_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 destinationPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref destinationPos);
				bool setInElevator = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setInElevator, default(ForPrimitives));
				bool setInShipRoom = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setInShipRoom, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HoppingScrap)(object)target).FrogJumpRPC(destinationPos, setInElevator, setInShipRoom);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "HoppingScrap";
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace GlitchyScrap.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}