Decompiled source of Fold Ultimate Pack v1.0.0

FoldUltimatePack.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
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: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 RepoArchMod
{
	[BepInPlugin("com.fold.repoarchmod", "FoldUltimatePack Mod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"===> [FoldUltimatePack Mod] loaded");
			Harmony val = new Harmony("com.fold.repoarchmod");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "Update")]
	public class UltimatePlayerPatch
	{
		private static bool isZeroGravityActive = false;

		private static Vector3 originalGlobalGravity = new Vector3(0f, -9.81f, 0f);

		private static Rigidbody grabbedRb = null;

		private static float holdDistance = 3.5f;

		[HarmonyPostfix]
		private static void Postfix(PlayerAvatar __instance)
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: 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_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null || !Traverse.Create((object)__instance).Field("isLocal").GetValue<bool>() || (Object)(object)__instance.localCamera == (Object)null)
			{
				return;
			}
			Transform transform = ((Component)__instance.localCamera).transform;
			if (Input.GetKeyDown((KeyCode)103))
			{
				isZeroGravityActive = !isZeroGravityActive;
				if (isZeroGravityActive)
				{
					originalGlobalGravity = Physics.gravity;
					Physics.gravity = Vector3.zero;
					Debug.Log((object)"[FoldUltimatePack Mod] gravity on");
				}
				else
				{
					Physics.gravity = originalGlobalGravity;
					Debug.Log((object)"[FoldUltimatePack Mod] gravity off");
				}
			}
			if (isZeroGravityActive)
			{
				Rigidbody value = Traverse.Create((object)__instance).Field("rb").GetValue<Rigidbody>();
				if ((Object)(object)value != (Object)null)
				{
					float num = 5f;
					if (Input.GetKey((KeyCode)32))
					{
						value.AddForce(Vector3.up * num, (ForceMode)5);
					}
					if (Input.GetKey((KeyCode)306))
					{
						value.AddForce(Vector3.down * num, (ForceMode)5);
					}
				}
			}
			if (Input.GetKey((KeyCode)102))
			{
				RaycastHit val = default(RaycastHit);
				if ((Object)(object)grabbedRb == (Object)null && Physics.Raycast(transform.position, transform.forward, ref val, 50f))
				{
					Rigidbody val2 = ((Component)((RaycastHit)(ref val)).transform).GetComponentInParent<Rigidbody>() ?? ((Component)((RaycastHit)(ref val)).transform).GetComponent<Rigidbody>();
					if ((Object)(object)val2 != (Object)null && !val2.isKinematic && (Object)(object)((Component)val2).transform != (Object)(object)((Component)__instance).transform)
					{
						grabbedRb = val2;
						grabbedRb.useGravity = false;
					}
				}
				if ((Object)(object)grabbedRb != (Object)null)
				{
					Vector3 val3 = transform.position + transform.forward * holdDistance;
					Vector3 val4 = val3 - grabbedRb.position;
					grabbedRb.velocity = val4 * 15f;
					grabbedRb.angularVelocity = Vector3.zero;
					if (Input.GetMouseButtonDown(0))
					{
						grabbedRb.useGravity = !isZeroGravityActive;
						float num2 = 80f;
						float num3 = num2 * Mathf.Max(1f, grabbedRb.mass * 0.1f);
						grabbedRb.AddForce(transform.forward * num3, (ForceMode)1);
						grabbedRb = null;
					}
				}
			}
			else if ((Object)(object)grabbedRb != (Object)null)
			{
				grabbedRb.useGravity = !isZeroGravityActive;
				grabbedRb = null;
			}
		}
	}
	[HarmonyPatch(typeof(ItemGun), "Start")]
	public class ItemGunPatch
	{
		[HarmonyPostfix]
		private static void Postfix(ItemGun __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				__instance.batteryDrain = 0f;
				__instance.batteryDrainFullBar = false;
				__instance.batteryDrainFullBars = 0;
				__instance.gunRandomSpread = 0f;
				__instance.gunRecoilForce = 0f;
				__instance.cameraShakeMultiplier = 0f;
				__instance.gunRange = 500f;
				__instance.shootCooldown = 0.05f;
				__instance.numberOfBullets = 5;
				__instance.misfirePercentageChange = 0f;
				Debug.Log((object)"[FoldUltimatePack Mod] Weapon stats have been changed.");
			}
		}
	}
}