Decompiled source of SpidermanMod v9.9.9

Mods/SpiderlectricBoogaloo.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AudioImportLib;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using Boneworks;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using SLZ.Marrow.Data;
using SLZ.Rig;
using SLZ.VRMK;
using SpiderlectricBoogaloo;
using UnhollowerBaseLib;
using UnhollowerRuntimeLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(thew), "SpiderlectricBoogaloo III (the first)", "1.0.0", "joe swan#228 (ill probably forget to set the version properly", null)]
[assembly: AssemblyTitle("SpiderlectricBoogaloo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SpiderlectricBoogaloo")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("adf5c3a4-c4e2-48ab-a117-db338d47968c")]
[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 SpiderlectricBoogaloo
{
	[HarmonyPatch(typeof(ControllerRig))]
	internal class crigPatch
	{
		public static DateTime? JumpChargeStartedDate;

		[HarmonyPostfix]
		[HarmonyPatch("JumpCharge")]
		public static void Jump(ControllerRig __instance, bool chargeInput)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a3: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			if (!thew.SuperJump.Value)
			{
				return;
			}
			if (chargeInput && !JumpChargeStartedDate.HasValue)
			{
				JumpChargeStartedDate = DateTime.Now;
			}
			else if (!chargeInput && JumpChargeStartedDate.HasValue)
			{
				PhysicsRig val = ((IEnumerable<PhysicsRig>)Object.FindObjectsOfType<PhysicsRig>()).First();
				Vector3 val2 = new Vector3(val.pelvisVelocity.x, 0f, val.pelvisVelocity.z);
				float magnitude = ((Vector3)(ref val2)).magnitude;
				Vector3 val3 = ((Rig)__instance).m_head.forward * magnitude * thew.ForwardLeapMultiplier.Value;
				Vector3 val4 = Vector3.up * thew.UpwardJumpMultiplier.Value;
				PhysGrounder val5 = Object.FindObjectOfType<PhysGrounder>();
				if (val5.isGrounded)
				{
					val.torso.rbPelvis.AddForce((val4 + val3) * thew.LeapMultiplier.Value, (ForceMode)2);
				}
				JumpChargeStartedDate = null;
			}
		}
	}
	public class thew : MelonMod
	{
		private float _LowestLimit = float.PositiveInfinity;

		public LineRenderer rrend;

		public LineRenderer lrend;

		private ConfigurableJoint rjoint;

		private ConfigurableJoint ljoint;

		private GameObject rhint;

		private GameObject lhint;

		private Vector3 rtarget;

		private Vector3 ltarget;

		private bool rgrappled = false;

		private bool lgrappled = false;

		public MelonPreferences_Category categ;

		private MelonPreferences_Entry<float> pull;

		private MelonPreferences_Entry<float> thickness;

		private MelonPreferences_Entry<float> range;

		public static MelonPreferences_Entry<float> ForwardLeapMultiplier;

		public static MelonPreferences_Entry<float> UpwardJumpMultiplier;

		public static MelonPreferences_Entry<float> LeapMultiplier;

		public static MelonPreferences_Entry<float> SpeedMulti;

		public static MelonPreferences_Entry<float> StrengthMulti;

		public static MelonPreferences_Entry<float> VitalityMultiplier;

		public static MelonPreferences_Entry<float> IntelligenceMultiplier;

		public static MelonPreferences_Entry<bool> SuperJump;

		public static MelonPreferences_Entry<bool> SpiderHints;

		public static AssetBundle assets;

		public AudioSource source;

		public GameObject webobj;

		public bool wasgrip;

		public float rdelayBetweenPresses = 0.2f;

		public bool rpressedFirstTime = false;

		public float rlastPressedTime;

		public float ldelayBetweenPresses = 0.2f;

		public bool lpressedFirstTime = false;

		public float llastPressedTime;

		public static Instance loggerInstance;

		private bool GripsSetup = false;

		private static HandPose pose;

		public override void OnUpdate()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_082d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0846: Unknown result type (might be due to invalid IL or missing references)
			//IL_0850: Unknown result type (might be due to invalid IL or missing references)
			//IL_0855: Unknown result type (might be due to invalid IL or missing references)
			//IL_086e: 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_009e: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0978: Unknown result type (might be due to invalid IL or missing references)
			//IL_098c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a27: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((Object)(object)Player.GetPhysicsRig() != (Object)null) || !((Object)(object)Player.GetPhysicsRig().rightHand != (Object)null))
				{
					return;
				}
				if (!Object.op_Implicit((Object)(object)rhint))
				{
					rhint = setupHint();
				}
				else
				{
					if (Object.op_Implicit((Object)(object)rhint))
					{
						if ((Object)(object)rjoint != (Object)null)
						{
							_ = rtarget;
						}
						else if (SpiderHints.Value)
						{
							RaycastHit val = default(RaycastHit);
							Physics.Raycast(((Component)Player.GetPhysicsRig().rightHand).gameObject.transform.position + ((Component)Player.GetPhysicsRig().rightHand).gameObject.transform.forward / 6f, ((Component)Player.GetPhysicsRig().rightHand).gameObject.transform.forward, ref val, range.Value);
							Transform transform = rhint.transform;
							_ = ((RaycastHit)(ref val)).point;
							transform.position = ((RaycastHit)(ref val)).point;
							rhint.transform.LookAt(Player.playerHead);
							goto IL_014a;
						}
					}
					rhint.transform.position = Vector3.zero;
				}
				goto IL_014a;
				IL_026c:
				BaseController leftController = Player.rigManager.ControllerRig.leftController;
				BaseController rightController = Player.rigManager.ControllerRig.rightController;
				if ((Object)(object)rjoint != (Object)null)
				{
					_ = rtarget;
					if (1 == 0)
					{
					}
				}
				if (Object.op_Implicit((Object)(object)ljoint))
				{
					_ = ltarget;
					if (1 == 0)
					{
					}
				}
				if (rightController.GetThumbStickDown() && rightController.GetGripForce() > 0.5f)
				{
					rgrappled = true;
					if (!Object.op_Implicit((Object)(object)rrend))
					{
						rrend = setupRender();
					}
					if (rgrappled)
					{
						RaycastHit val2 = default(RaycastHit);
						if (Physics.Raycast(((Component)Player.GetPhysicsRig().rightHand).gameObject.transform.position + ((Component)Player.GetPhysicsRig().rightHand).gameObject.transform.forward / 6f, ((Component)Player.GetPhysicsRig().rightHand).gameObject.transform.forward, ref val2, range.Value) && !Object.op_Implicit((Object)(object)rjoint))
						{
							rrend.startWidth = thickness.Value;
							rrend.endWidth = thickness.Value;
							rjoint = ((Component)Player.GetPhysicsRig().rightHand).gameObject.AddComponent<ConfigurableJoint>();
							Rigidbody val3 = ((!Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).rigidbody) || ((RaycastHit)(ref val2)).rigidbody.isKinematic) ? null : ((RaycastHit)(ref val2)).rigidbody);
							if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).rigidbody))
							{
								((Joint)rjoint).connectedBody = ((RaycastHit)(ref val2)).rigidbody;
							}
							float num = (Object.op_Implicit((Object)(object)val3) ? (Mathf.Max(1f, val3.mass) * 10f) : 10f);
							SetWorldAnchor(rjoint, ((Component)Player.GetPhysicsRig().rightHand).transform.position);
							SetWorldConnected(rjoint, ((RaycastHit)(ref val2)).point);
							SetLinearMotion(rjoint, (ConfigurableJointMotion)1);
							SetLinearLimit(rjoint, ((RaycastHit)(ref val2)).distance + 0.1f, 1f);
							SetSpringLimit(rjoint, 500000000f, 500000f * num * 1f);
							SetSpringDrive(rjoint, pull.Value, pull.Value, pull.Value);
							((Joint)rjoint).enableCollision = true;
							rtarget = ((RaycastHit)(ref val2)).point;
							rrend.positionCount = 2;
							try
							{
								string text = Path.Combine(MelonUtils.UserDataDirectory, "WebSounds");
								AudioClip val4 = API.LoadAudioClip(text + "/webSound.wav", true);
								source = (Object.op_Implicit((Object)(object)((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>()) ? ((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>() : ((Component)Player.GetPhysicsRig().rightHand).gameObject.AddComponent<AudioSource>());
								source.pitch = Random.Range(0.87f, 1.1f);
								source.PlayOneShot(val4, 1f);
							}
							catch
							{
							}
						}
					}
					else if (!rgrappled)
					{
						rrend.positionCount = 0;
						Object.Destroy((Object)(object)rjoint);
						try
						{
							string text2 = Path.Combine(MelonUtils.UserDataDirectory, "WebSounds");
							AudioClip val5 = API.LoadAudioClip(text2 + "/webRelease.wav", true);
							source = (Object.op_Implicit((Object)(object)((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>()) ? ((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>() : ((Component)Player.GetPhysicsRig().rightHand).gameObject.AddComponent<AudioSource>());
							source.pitch = Random.Range(0.87f, 1.1f);
							source.PlayOneShot(val5, 1f);
						}
						catch
						{
						}
					}
				}
				else if (rightController.GetGripForce() < 0.1f && (Object)(object)rjoint != (Object)null)
				{
					rgrappled = false;
					rrend.positionCount = 0;
					Object.Destroy((Object)(object)rjoint);
					try
					{
						string text3 = Path.Combine(MelonUtils.UserDataDirectory, "WebSounds");
						AudioClip val6 = API.LoadAudioClip(text3 + "/webRelease.wav", true);
						source = (Object.op_Implicit((Object)(object)((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>()) ? ((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>() : ((Component)Player.GetPhysicsRig().rightHand).gameObject.AddComponent<AudioSource>());
						source.pitch = Random.Range(0.87f, 1.1f);
						source.PlayOneShot(val6, 1f);
					}
					catch
					{
					}
				}
				if (leftController.GetThumbStickDown() && leftController.GetGripForce() > 0.5f)
				{
					lgrappled = true;
					if (!Object.op_Implicit((Object)(object)lrend))
					{
						lrend = setupRender();
					}
					if (lgrappled)
					{
						RaycastHit val7 = default(RaycastHit);
						if (Physics.Raycast(((Component)Player.GetPhysicsRig().leftHand).gameObject.transform.position + ((Component)Player.GetPhysicsRig().leftHand).gameObject.transform.forward / 6f, ((Component)Player.GetPhysicsRig().leftHand).gameObject.transform.forward, ref val7, range.Value) && !Object.op_Implicit((Object)(object)ljoint))
						{
							lrend.startWidth = thickness.Value;
							lrend.endWidth = thickness.Value;
							ljoint = ((Component)Player.GetPhysicsRig().leftHand).gameObject.AddComponent<ConfigurableJoint>();
							Rigidbody val8 = ((!Object.op_Implicit((Object)(object)((RaycastHit)(ref val7)).rigidbody) || ((RaycastHit)(ref val7)).rigidbody.isKinematic) ? null : ((RaycastHit)(ref val7)).rigidbody);
							if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val7)).rigidbody))
							{
								((Joint)ljoint).connectedBody = ((RaycastHit)(ref val7)).rigidbody;
							}
							float num2 = (Object.op_Implicit((Object)(object)val8) ? (Mathf.Max(1f, val8.mass) * 10f) : 10f);
							SetWorldAnchor(ljoint, ((Component)Player.GetPhysicsRig().leftHand).transform.position);
							SetWorldConnected(ljoint, ((RaycastHit)(ref val7)).point);
							SetLinearMotion(ljoint, (ConfigurableJointMotion)1);
							SetLinearLimit(ljoint, ((RaycastHit)(ref val7)).distance + 0.1f, 1f);
							SetSpringLimit(ljoint, 500000000f, 500000f * num2 * 1f);
							SetSpringDrive(ljoint, pull.Value, pull.Value, pull.Value);
							((Joint)ljoint).enableCollision = true;
							ltarget = ((RaycastHit)(ref val7)).point;
							lrend.positionCount = 2;
							try
							{
								string text4 = Path.Combine(MelonUtils.UserDataDirectory, "WebSounds");
								AudioClip val9 = API.LoadAudioClip(text4 + "/webSound.wav", true);
								source = (Object.op_Implicit((Object)(object)((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>()) ? ((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>() : ((Component)Player.GetPhysicsRig().rightHand).gameObject.AddComponent<AudioSource>());
								source.pitch = Random.Range(0.87f, 1.1f);
								source.PlayOneShot(val9, 1f);
								return;
							}
							catch
							{
								return;
							}
						}
					}
					else if (!lgrappled)
					{
						lrend.positionCount = 0;
						Object.Destroy((Object)(object)ljoint);
						try
						{
							string text5 = Path.Combine(MelonUtils.UserDataDirectory, "WebSounds");
							AudioClip val10 = API.LoadAudioClip(text5 + "/webRelease.wav", true);
							source = (Object.op_Implicit((Object)(object)((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>()) ? ((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>() : ((Component)Player.GetPhysicsRig().rightHand).gameObject.AddComponent<AudioSource>());
							source.pitch = Random.Range(0.87f, 1.1f);
							source.PlayOneShot(val10, 1f);
							return;
						}
						catch (Exception)
						{
							return;
						}
					}
				}
				else if (leftController.GetGripForce() < 0.1f && (Object)(object)ljoint != (Object)null)
				{
					lgrappled = false;
					lrend.positionCount = 0;
					Object.Destroy((Object)(object)ljoint);
					try
					{
						string text6 = Path.Combine(MelonUtils.UserDataDirectory, "WebSounds");
						AudioClip val11 = API.LoadAudioClip(text6 + "/webRelease.wav", true);
						source = (Object.op_Implicit((Object)(object)((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>()) ? ((Component)Player.GetPhysicsRig().rightHand).gameObject.GetComponent<AudioSource>() : ((Component)Player.GetPhysicsRig().rightHand).gameObject.AddComponent<AudioSource>());
						source.pitch = Random.Range(0.87f, 1.1f);
						source.PlayOneShot(val11, 1f);
						return;
					}
					catch
					{
						return;
					}
				}
				return;
				IL_014a:
				if (!Object.op_Implicit((Object)(object)lhint))
				{
					lhint = setupHint();
				}
				else
				{
					if (Object.op_Implicit((Object)(object)lhint))
					{
						if ((Object)(object)ljoint != (Object)null)
						{
							_ = ltarget;
						}
						else if (SpiderHints.Value)
						{
							RaycastHit val12 = default(RaycastHit);
							Physics.Raycast(((Component)Player.GetPhysicsRig().leftHand).gameObject.transform.position + ((Component)Player.GetPhysicsRig().leftHand).gameObject.transform.forward / 6f, ((Component)Player.GetPhysicsRig().leftHand).gameObject.transform.forward, ref val12, range.Value);
							Transform transform2 = lhint.transform;
							_ = ((RaycastHit)(ref val12)).point;
							transform2.position = ((RaycastHit)(ref val12)).point;
							lhint.transform.LookAt(Player.playerHead);
							goto IL_026c;
						}
					}
					lhint.transform.position = Vector3.zero;
				}
				goto IL_026c;
			}
			catch
			{
			}
		}

		public override void OnLateUpdate()
		{
			line();
		}

		private void line()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: 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_020c: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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)
			if ((Object)(object)Player.GetPhysicsRig() == (Object)null)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)rjoint))
			{
				if (!Object.op_Implicit((Object)(object)((Joint)rjoint).connectedBody))
				{
					rrend.SetPositions(Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[2]
					{
						((Component)Player.GetPhysicsRig().rightHand).transform.position,
						rtarget
					}));
				}
				else
				{
					Vector3 val = default(Vector3);
					((Vector3)(ref val))..ctor(((Joint)rjoint).connectedAnchor.x, ((Joint)rjoint).connectedAnchor.y, ((Joint)rjoint).connectedAnchor.z);
					Vector3 val2 = ((Component)((Joint)rjoint).connectedBody).gameObject.transform.TransformPoint(val);
					rrend.SetPositions(Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[2]
					{
						((Component)Player.GetPhysicsRig().rightHand).transform.position,
						val2
					}));
				}
			}
			if (Object.op_Implicit((Object)(object)ljoint))
			{
				if (!Object.op_Implicit((Object)(object)((Joint)ljoint).connectedBody))
				{
					lrend.SetPositions(Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[2]
					{
						((Component)Player.GetPhysicsRig().leftHand).transform.position,
						ltarget
					}));
				}
				else
				{
					Vector3 val3 = default(Vector3);
					((Vector3)(ref val3))..ctor(((Joint)ljoint).connectedAnchor.x, ((Joint)ljoint).connectedAnchor.y, ((Joint)ljoint).connectedAnchor.z);
					Vector3 val4 = ((Component)((Joint)ljoint).connectedBody).gameObject.transform.TransformPoint(val3);
					lrend.SetPositions(Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[2]
					{
						((Component)Player.GetPhysicsRig().leftHand).transform.position,
						val4
					}));
				}
			}
		}

		public override void OnDeinitializeMelon()
		{
			categ.SaveToFile(true);
		}

		public override void OnInitializeMelon()
		{
			//IL_01f8: 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_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			loggerInstance = ((MelonBase)this).LoggerInstance;
			categ = MelonPreferences.CreateCategory("SpiderLab");
			pull = categ.CreateEntry<float>("WebPullStrength", 1500f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			thickness = categ.CreateEntry<float>("WebLineThickness", 0.15f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			range = categ.CreateEntry<float>("WebRange", 1000f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ForwardLeapMultiplier = categ.CreateEntry<float>("JumpLeapMultiplier", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			UpwardJumpMultiplier = categ.CreateEntry<float>("JumpUpMultiplier", 18f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			LeapMultiplier = categ.CreateEntry<float>("JumpMultiplier", 3f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			SpeedMulti = categ.CreateEntry<float>("SpeedMultiplier", 1.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			IntelligenceMultiplier = categ.CreateEntry<float>("IntelligenceMultiplier", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			VitalityMultiplier = categ.CreateEntry<float>("VitalityMultiplier", 7f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			StrengthMulti = categ.CreateEntry<float>("StrengthMultiplier", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			SuperJump = categ.CreateEntry<bool>("SuperJumpEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			SpiderHints = categ.CreateEntry<bool>("SpiderHints", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			foreach (MelonPreferences_Entry entry in categ.Entries)
			{
				((MelonBase)this).LoggerInstance.Msg(entry.DisplayName);
			}
			MenuCategory val = MenuManager.CreateCategory("SpiderLab", "#1273de");
			SubPanelElement val2 = val.CreateSubPanel("Web Settings", Color.white);
			val2.CreateFloatElement("Web Pull", Color.white, pull.Value, 50f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				pull.Value = value;
			});
			val2.CreateFloatElement("Web Line Thickness", Color.white, thickness.Value, 0.01f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				thickness.Value = value;
			});
			val2.CreateFloatElement("Web Range", Color.white, range.Value, 50f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				range.Value = value;
			});
			SubPanelElement val3 = val.CreateSubPanel("Avatar Settings", Color.red);
			val3.CreateBoolElement("Super Jump Enabled", "#f31418", SuperJump.Value, (Action<bool>)delegate(bool value)
			{
				SuperJump.Value = value;
			});
			val3.CreateFloatElement("Jump Multi", "#f04b4e", LeapMultiplier.Value, 0.5f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				LeapMultiplier.Value = value;
			});
			val3.CreateFloatElement("Forward Jump Multi", "#ea6d6f", ForwardLeapMultiplier.Value, 0.5f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				ForwardLeapMultiplier.Value = value;
			});
			val3.CreateFloatElement("Upward Jump Multi", "#f29799", UpwardJumpMultiplier.Value, 0.5f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				UpwardJumpMultiplier.Value = value;
			});
			val3.CreateFloatElement("Speed Multi", "#0950fa", SpeedMulti.Value, 0.05f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				SpeedMulti.Value = value;
			});
			val3.CreateFloatElement("Strength Multi", "#306cfb", StrengthMulti.Value, 1f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				StrengthMulti.Value = value;
			});
			val3.CreateFloatElement("Intelligence Multi", "#5c8cff", IntelligenceMultiplier.Value, 1f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				IntelligenceMultiplier.Value = value;
			});
			val3.CreateFloatElement("Vitality Multi", "#86aaff", VitalityMultiplier.Value, 1f, 0f, 2.1474836E+09f, (Action<float>)delegate(float value)
			{
				VitalityMultiplier.Value = value;
			});
			SubPanelElement val4 = val.CreateSubPanel("Misc Settings", "#0046ff");
			val3.CreateBoolElement("SpiderHints Enabled", Color.white, SpiderHints.Value, (Action<bool>)delegate(bool value)
			{
				SpiderHints.Value = value;
			});
			((MelonBase)this).HarmonyInstance.PatchAll();
		}

		public LineRenderer setupRender()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			GameObject val = new GameObject();
			((Object)val).name = "_SPIDERMAN-MOD-RENDERER";
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			Material material = (((Renderer)val2).material = webMaterial());
			val.GetComponent<Renderer>().material = material;
			val2.SetWidth(thickness.Value, thickness.Value);
			return val2;
		}

		public GameObject setupHint()
		{
			string text = Path.Combine(MelonUtils.UserDataDirectory, "WebAssets");
			AssetBundle val = AssetBundle.LoadFromFile(text + "/spiderfx.sres");
			GameObject val2 = ((Il2CppObjectBase)val.LoadAsset("SpiderHint", Il2CppType.Of<GameObject>())).Cast<GameObject>();
			GameObject val3 = Object.Instantiate<GameObject>(val2);
			((Object)val3).hideFlags = (HideFlags)32;
			val.Unload(false);
			return val3;
		}

		public Material webMaterial()
		{
			string text = Path.Combine(MelonUtils.UserDataDirectory, "WebAssets");
			AssetBundle val = AssetBundle.LoadFromFile(text + "/spiderfx.sres");
			GameObject val2 = ((Il2CppObjectBase)val.LoadAsset("SpiderWeb_Renderer", Il2CppType.Of<GameObject>())).Cast<GameObject>();
			GameObject val3 = Object.Instantiate<GameObject>(val2);
			DrawLine2Points component = val3.GetComponent<DrawLine2Points>();
			Material material = ((Renderer)component.Liner).material;
			((Object)material).hideFlags = (HideFlags)32;
			val.Unload(false);
			return material;
		}

		public Material whiteMaterial()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(Shader.Find("Universal Render Pipeline/Lit (PBR Workflow)"));
			val.color = Color.white;
			return val;
		}

		public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			Object.Destroy((Object)(object)ljoint);
			Object.Destroy((Object)(object)rjoint);
			Object.Destroy((Object)(object)rrend);
			Object.Destroy((Object)(object)lrend);
			rtarget = Vector3.zero;
			ltarget = Vector3.zero;
			rgrappled = false;
			lgrappled = false;
		}

		public void SetSpringDrive(ConfigurableJoint joint, float spring, float damper, float max)
		{
			//IL_0003: 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_0026: 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)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			JointDrive val = default(JointDrive);
			((JointDrive)(ref val)).positionSpring = spring;
			((JointDrive)(ref val)).positionDamper = damper;
			((JointDrive)(ref val)).maximumForce = max;
			JointDrive zDrive = (joint.yDrive = (joint.xDrive = val));
			joint.zDrive = zDrive;
		}

		public void SetSpringLimit(ConfigurableJoint joint, float spring, float damper)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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)
			SoftJointLimitSpring linearLimitSpring = joint.linearLimitSpring;
			((SoftJointLimitSpring)(ref linearLimitSpring)).spring = spring;
			((SoftJointLimitSpring)(ref linearLimitSpring)).damper = damper;
			joint.linearLimitSpring = linearLimitSpring;
		}

		public void SetLinearLimit(ConfigurableJoint joint, float limit, float bounce)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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)
			SoftJointLimit linearLimit = joint.linearLimit;
			((SoftJointLimit)(ref linearLimit)).limit = limit;
			((SoftJointLimit)(ref linearLimit)).bounciness = bounce;
			joint.linearLimit = linearLimit;
			if (limit < _LowestLimit)
			{
				_LowestLimit = limit;
			}
		}

		public void SetLinearMotion(ConfigurableJoint joint, ConfigurableJointMotion motion)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			joint.xMotion = motion;
			joint.yMotion = motion;
			joint.zMotion = motion;
		}

		public void SetWorldAnchor(ConfigurableJoint joint, Vector3 anchor)
		{
			//IL_0008: 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)
			((Joint)joint).anchor = ((Component)joint).transform.InverseTransformPoint(anchor);
		}

		public void SetWorldConnected(ConfigurableJoint joint, Vector3 anchor)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			((Joint)joint).autoConfigureConnectedAnchor = false;
			((Joint)joint).connectedAnchor = (Object.op_Implicit((Object)(object)((Joint)joint).connectedBody) ? ((Component)((Joint)joint).connectedBody).transform.InverseTransformPoint(anchor) : anchor);
		}
	}
}
namespace SpiderlectricBoogaloo.Patch
{
	[HarmonyPatch(typeof(Avatar))]
	public static class avatarPatch
	{
		private static bool IsMainRig(Avatar avatar)
		{
			if ((Object)(object)Player.rigManager != (Object)null)
			{
				return (Object)(object)Player.rigManager.avatar == (Object)(object)avatar;
			}
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("ComputeMass")]
		public static void ComputeMass(Avatar __instance)
		{
			if (IsMainRig(__instance))
			{
				__instance._massChest *= thew.StrengthMulti.Value;
				__instance._massHead *= thew.StrengthMulti.Value;
				__instance._massPelvis *= thew.StrengthMulti.Value;
				__instance._massArm *= thew.StrengthMulti.Value;
				__instance._massLeg *= thew.StrengthMulti.Value;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ComputeBaseStats")]
		public static void ComputeBaseStats(Avatar __instance)
		{
			if (IsMainRig(__instance))
			{
				__instance._strengthUpper *= thew.StrengthMulti.Value;
				__instance._strengthLower *= thew.StrengthMulti.Value;
				__instance._strengthGrip *= thew.StrengthMulti.Value;
				__instance._speed *= thew.SpeedMulti.Value;
				__instance._agility *= thew.SpeedMulti.Value;
				__instance._intelligence *= thew.IntelligenceMultiplier.Value;
				__instance._vitality = thew.VitalityMultiplier.Value;
			}
		}
	}
	[HarmonyPatch(typeof(ControllerRig), "Jump")]
	public static class PlayerPatches
	{
		public static void Postfix(this ControllerRig __instance)
		{
			PhysicsRig val = ((IEnumerable<PhysicsRig>)Object.FindObjectsOfType<PhysicsRig>()).First();
			PhysGrounder val2 = Object.FindObjectOfType<PhysGrounder>();
			if (!val2.isGrounded)
			{
			}
		}
	}
}