using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Spiderman;
using Spiderman.Utils;
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(Main), "Spiderman", "1.0.0", "sparklingspacess", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("Spiderman")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Spiderman")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1ba8a4e6-e5fa-429e-921f-15e46d3fb489")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public enum HandPose
{
Neutral,
WebSling
}
public enum HandType
{
Left,
Right
}
public enum InputMode
{
DoubleTrigger,
Gesture
}
namespace Spiderman
{
[HarmonyPatch(typeof(RigManager), "Awake")]
public class LevelLoadHook
{
[HarmonyPostfix]
private static void Postfix(RigManager __instance)
{
Main.OnRigAwake(__instance);
}
}
public class Main : MelonMod
{
public static LineRenderer leftweb;
public static LineRenderer rightweb;
public static RigManager rigman;
public static Transform lefthand;
public static Transform righthand;
public static Transform hmd;
public static Transform leftcontroller;
public static Transform rightcontroller;
public static Transform leftwebpoint;
public static Transform rightwebpoint;
public static SpringJoint leftwebjoint;
public static SpringJoint rightwebjoint;
public static AudioClip websling;
public static AudioSource leftwebsource;
public static AudioSource rightwebsource;
public static Texture2D webtexture;
public static AssetBundle bundle;
public static HandPose poseleft;
public static HandPose poseright;
public static Texture2D reticletexture;
public static GameObject reticleprefab;
public static Transform reticleleft;
public static Transform reticleright;
public static bool slingingtononrigidl;
public static bool slingingtononrigidr;
public static InputMode inputmode;
private float lastquesttriggerl = 0f;
private float lastquesttriggerr = 0f;
private bool leftquesttriggerheld = false;
private bool rightquesttriggerheld = false;
private const float questtapthreshold = 0.35f;
private const float questpressedthreshold = 0.96f;
public static bool menuinit = false;
public static float pulleystrength = 6f;
public static float yankintensity = 2.5f;
public static bool gesturemode = false;
public static bool spideygrip = false;
public static bool aimreticleson = true;
private static MelonPreferences_Category prefs;
private static MelonPreferences_Entry<float> pullpref;
private static MelonPreferences_Entry<float> yankpref;
private static MelonPreferences_Entry<InputMode> inputpref;
private static MelonPreferences_Entry<bool> grippref;
private static MelonPreferences_Entry<bool> reticlepref;
public static int GetLayerMaskThatIgnoresLayers(params string[] layers)
{
int num = -1;
foreach (string text in layers)
{
int num2 = LayerMask.NameToLayer(text);
if (num2 >= 0)
{
num &= ~(1 << num2);
}
}
return num;
}
public override void OnApplicationStart()
{
prefs = MelonPreferences.CreateCategory("Spiderman");
pullpref = prefs.CreateEntry<float>("Pull Strength", 6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
yankpref = prefs.CreateEntry<float>("Yank Intensity", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
inputpref = prefs.CreateEntry<InputMode>("Input Mode", InputMode.DoubleTrigger, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
grippref = prefs.CreateEntry<bool>("Spidey Grip", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
reticlepref = prefs.CreateEntry<bool>("Aiming Reticles", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
pulleystrength = pullpref.Value;
yankintensity = yankpref.Value;
inputmode = inputpref.Value;
spideygrip = grippref.Value;
aimreticleson = reticlepref.Value;
bundle = AssetBundle.LoadFromFile("spiderman.bundle");
}
public static HandPose GetHandPose(string pose)
{
WorldGrip[] array = Il2CppArrayBase<WorldGrip>.op_Implicit(Resources.FindObjectsOfTypeAll<WorldGrip>());
WorldGrip[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
Grip val = (Grip)(object)array2[i];
if (((Object)val.handPose).name == pose)
{
return val.handPose;
}
}
return null;
}
public static void OnRigAwake(RigManager rig)
{
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
if (!(((Object)((Component)rig).transform).name == "RigManager(bonelab) [0]"))
{
return;
}
websling = bundle.LoadAsset<AudioClip>("assets/custombundles/spidermanstuff/sling.mp3");
webtexture = bundle.LoadAsset<Texture2D>("assets/custombundles/spidermanstuff/web.png");
reticletexture = bundle.LoadAsset<Texture2D>("assets/custombundles/spidermanstuff/aimreticle.png");
reticleprefab = bundle.LoadAsset<GameObject>("assets/custombundles/spidermanstuff/reticle.prefab");
lefthand = ((Component)rig.physicsRig.leftHand).transform;
righthand = ((Component)rig.physicsRig.rightHand).transform;
hmd = ((Rig)rig.physicsRig).m_head;
rigman = ((Component)rig).GetComponent<RigManager>();
leftcontroller = ((Component)rig.controllerRig.leftController).transform;
rightcontroller = ((Component)rig.controllerRig.rightController).transform;
leftweb = LineUtils.CreateDragline(lefthand.Find("PalmCenter"), 0.01f);
rightweb = LineUtils.CreateDragline(righthand.Find("PalmCenter"), 0.01f);
((Renderer)leftweb).material.mainTexture = (Texture)(object)webtexture;
((Renderer)rightweb).material.mainTexture = (Texture)(object)webtexture;
leftwebsource = ((Component)lefthand.Find("PalmCenter")).gameObject.AddComponent<AudioSource>();
leftwebsource.playOnAwake = false;
leftwebsource.volume = 0.5f;
leftwebsource.clip = websling;
rightwebsource = ((Component)righthand.Find("PalmCenter")).gameObject.AddComponent<AudioSource>();
rightwebsource.playOnAwake = false;
rightwebsource.volume = 0.5f;
rightwebsource.clip = websling;
reticleleft = Object.Instantiate<GameObject>(reticleprefab, Vector3.zero, Quaternion.identity).transform;
((Renderer)((Component)reticleleft).GetComponent<MeshRenderer>()).material = LineUtils.CreateUnlitVRMaterial();
((Renderer)((Component)reticleleft).GetComponent<MeshRenderer>()).material.renderQueue = 5000;
((Renderer)((Component)reticleleft).GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)reticletexture;
reticleright = Object.Instantiate<GameObject>(reticleprefab, Vector3.zero, Quaternion.identity).transform;
((Renderer)((Component)reticleright).GetComponent<MeshRenderer>()).material = LineUtils.CreateUnlitVRMaterial();
((Renderer)((Component)reticleright).GetComponent<MeshRenderer>()).material.renderQueue = 5000;
((Renderer)((Component)reticleright).GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)reticletexture;
if (!menuinit)
{
menuinit = true;
Page val = Page.Root.CreatePage("Spiderman", Color.red, 0, true);
val.CreateFloat("Pull Strength", Color.white, pulleystrength, 0.1f, 0.1f, float.PositiveInfinity, (Action<float>)delegate(float pull)
{
pulleystrength = pull;
pullpref.Value = pull;
});
val.CreateFloat("Yank Intensity", Color.white, yankintensity, 0.1f, 0.1f, float.PositiveInfinity, (Action<float>)delegate(float yank)
{
yankintensity = yank;
yankpref.Value = yank;
});
val.CreateEnum("Input Mode", Color.white, (Enum)inputmode, (Action<Enum>)delegate(Enum mode)
{
inputmode = (InputMode)(object)mode;
inputpref.Value = (InputMode)(object)mode;
});
val.CreateBool("Spidey Grip", Color.white, spideygrip, (Action<bool>)delegate(bool on)
{
//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_001e: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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)
//IL_003a: 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)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
spideygrip = on;
grippref.Value = on;
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Spiderman"),
Message = NotificationText.op_Implicit("Reload the scene for changes to take affect"),
Type = (NotificationType)0,
PopupLength = 2f,
ShowTitleOnPopup = true
});
});
val.CreateBool("Aiming Reticles", Color.white, aimreticleson, (Action<bool>)delegate(bool on)
{
aimreticleson = on;
reticlepref.Value = on;
});
}
if (!spideygrip)
{
return;
}
Collider[] array = Il2CppArrayBase<Collider>.op_Implicit(Resources.FindObjectsOfTypeAll<Collider>());
Collider[] array2 = array;
foreach (Collider val2 in array2)
{
Transform transform = ((Component)val2).transform;
if (((Component)transform).gameObject.layer == LayerMask.NameToLayer("Default") && (Object)(object)((Component)transform).GetComponent<Grip>() == (Object)null)
{
GenericGrip val3 = ((Component)transform).gameObject.AddComponent<GenericGrip>();
((Grip)val3).handPose = GetHandPose("SoftGrab");
((Grip)val3).gripDistance = float.PositiveInfinity;
((Grip)val3).defaultGripDistance = float.PositiveInfinity;
((Grip)val3).isThrowable = true;
((Grip)val3).targetTransform = transform;
((Grip)val3).gripOptions = (InteractionOptions)1;
((Grip)val3).gripColliders = Il2CppReferenceArray<Collider>.op_Implicit(((IEnumerable<Collider>)((Component)transform).GetComponents<Collider>()).ToArray());
((Grip)val3).additionalGripColliders = Il2CppReferenceArray<Collider>.op_Implicit(((IEnumerable<Collider>)((Component)transform).GetComponents<Collider>()).ToArray());
((Grip)val3).radius = 0.25f;
((HandReciever)val3).IsEnabled = true;
((Grip)val3).priority = 1f;
((Grip)val3).maxBreakForce = float.PositiveInfinity;
((Grip)val3).minBreakForce = float.PositiveInfinity;
}
}
}
public static Vector3 CalculatePull(Transform hand, Transform controller, float intensity)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_002a: 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)
float num = Vector3.Distance(hand.position, controller.position);
return hand.forward * num * intensity * pulleystrength;
}
public override void OnDeinitializeMelon()
{
MelonPreferences.Save();
}
private void HandleTouchInput(HandType hand)
{
switch (hand)
{
case HandType.Left:
{
float indexCurlAxis2 = ((Component)leftcontroller).GetComponent<BaseController>().GetIndexCurlAxis();
ref float reference3 = ref lastquesttriggerl;
ref bool reference4 = ref leftquesttriggerheld;
if (indexCurlAxis2 > 0.96f && !reference4)
{
reference4 = true;
float num2 = Time.time - reference3;
if (num2 <= 0.35f)
{
poseleft = HandPose.WebSling;
}
lastquesttriggerl = Time.time;
}
if ((indexCurlAxis2 < 0.2f) & reference4)
{
reference4 = false;
poseleft = HandPose.Neutral;
}
leftquesttriggerheld = reference4;
break;
}
case HandType.Right:
{
float indexCurlAxis = ((Component)rightcontroller).GetComponent<BaseController>().GetIndexCurlAxis();
ref float reference = ref lastquesttriggerr;
ref bool reference2 = ref rightquesttriggerheld;
if (indexCurlAxis > 0.96f && !reference2)
{
reference2 = true;
float num = Time.time - reference;
if (num <= 0.35f)
{
poseright = HandPose.WebSling;
}
lastquesttriggerr = Time.time;
}
if ((indexCurlAxis < 0.2f) & reference2)
{
reference2 = false;
poseright = HandPose.Neutral;
}
rightquesttriggerheld = reference2;
break;
}
}
}
public void SlingWeb(HandType type)
{
//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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)lefthand != (Object)null) || !((Object)(object)righthand != (Object)null))
{
return;
}
switch (type)
{
case HandType.Left:
{
Ray val3 = default(Ray);
((Ray)(ref val3))..ctor(lefthand.position, lefthand.forward);
RaycastHit val4 = default(RaycastHit);
if (Physics.Raycast(val3, ref val4, 1000f, GetLayerMaskThatIgnoresLayers("Player", "NoCollide", "Deciverse")))
{
if ((Object)(object)leftwebpoint != (Object)null)
{
Object.Destroy((Object)(object)leftwebpoint);
}
if ((Object)(object)leftwebjoint != (Object)null)
{
Object.Destroy((Object)(object)leftwebjoint);
}
Vector3 point2 = ((RaycastHit)(ref val4)).point;
Transform transform2 = ((Component)((RaycastHit)(ref val4)).collider).transform;
leftwebpoint = new GameObject("webl").transform;
leftwebpoint.parent = transform2;
leftwebpoint.position = point2;
((Renderer)leftweb).enabled = true;
leftwebjoint = ((Component)lefthand).gameObject.AddComponent<SpringJoint>();
if ((Object)(object)((Component)transform2).GetComponentInParent<Rigidbody>() != (Object)null)
{
((Joint)leftwebjoint).autoConfigureConnectedAnchor = false;
((Joint)leftwebjoint).connectedBody = ((Component)transform2).GetComponentInParent<Rigidbody>();
((Joint)leftwebjoint).connectedAnchor = transform2.InverseTransformPoint(point2);
((Joint)leftwebjoint).massScale = rigman.avatar.massTotal * yankintensity;
((Joint)leftwebjoint).connectedMassScale = ((Component)transform2).GetComponentInParent<Rigidbody>().mass * pulleystrength;
slingingtononrigidl = false;
}
if ((Object)(object)((Component)transform2).GetComponentInParent<Rigidbody>() == (Object)null)
{
((Joint)leftwebjoint).autoConfigureConnectedAnchor = false;
((Joint)leftwebjoint).connectedAnchor = point2;
((Joint)leftwebjoint).massScale = ((Component)lefthand).GetComponent<Rigidbody>().mass * pulleystrength;
((Joint)leftwebjoint).connectedMassScale = 1.35f;
slingingtononrigidl = true;
}
leftwebjoint.spring = 4.5f;
leftwebjoint.damper = 0.25f;
leftwebjoint.minDistance = 0.25f;
leftwebjoint.maxDistance = Vector3.Distance(lefthand.position, transform2.position) / pulleystrength;
if ((Object)(object)leftwebsource != (Object)null)
{
leftwebsource.Play();
}
}
break;
}
case HandType.Right:
{
Ray val = default(Ray);
((Ray)(ref val))..ctor(righthand.position, righthand.forward);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(val, ref val2, 1000f, GetLayerMaskThatIgnoresLayers("Player", "NoCollide", "Deciverse")))
{
if ((Object)(object)rightwebpoint != (Object)null)
{
Object.Destroy((Object)(object)rightwebpoint);
}
if ((Object)(object)rightwebjoint != (Object)null)
{
Object.Destroy((Object)(object)rightwebjoint);
}
Vector3 point = ((RaycastHit)(ref val2)).point;
Transform transform = ((Component)((RaycastHit)(ref val2)).collider).transform;
rightwebpoint = new GameObject("webr").transform;
rightwebpoint.parent = transform;
rightwebpoint.position = point;
((Renderer)rightweb).enabled = true;
rightwebjoint = ((Component)righthand).gameObject.AddComponent<SpringJoint>();
if ((Object)(object)((Component)transform).GetComponentInParent<Rigidbody>() != (Object)null)
{
((Joint)rightwebjoint).autoConfigureConnectedAnchor = false;
((Joint)rightwebjoint).connectedBody = ((Component)transform).GetComponentInParent<Rigidbody>();
((Joint)rightwebjoint).connectedAnchor = transform.InverseTransformPoint(point);
((Joint)rightwebjoint).massScale = rigman.avatar.massTotal * yankintensity;
((Joint)rightwebjoint).connectedMassScale = ((Component)transform).GetComponentInParent<Rigidbody>().mass * pulleystrength;
slingingtononrigidr = false;
}
if ((Object)(object)((Component)transform).GetComponentInParent<Rigidbody>() == (Object)null)
{
((Joint)rightwebjoint).autoConfigureConnectedAnchor = false;
((Joint)rightwebjoint).connectedAnchor = point;
((Joint)rightwebjoint).massScale = ((Component)righthand).GetComponent<Rigidbody>().mass * yankintensity;
((Joint)rightwebjoint).connectedMassScale = 1.35f;
slingingtononrigidr = true;
}
rightwebjoint.spring = pulleystrength;
rightwebjoint.damper = 0.25f;
rightwebjoint.minDistance = 0f;
rightwebjoint.maxDistance = Vector3.Distance(righthand.position, transform.position) / pulleystrength;
if ((Object)(object)rightwebsource != (Object)null)
{
rightwebsource.Play();
}
}
break;
}
}
}
public void ReleaseWeb(HandType type)
{
switch (type)
{
case HandType.Left:
((Renderer)leftweb).enabled = false;
if ((Object)(object)leftwebpoint != (Object)null && (Object)(object)leftwebjoint != (Object)null)
{
Object.Destroy((Object)(object)leftwebpoint);
Object.Destroy((Object)(object)leftwebjoint);
}
break;
case HandType.Right:
((Renderer)rightweb).enabled = false;
if ((Object)(object)rightwebpoint != (Object)null && (Object)(object)rightwebjoint != (Object)null)
{
Object.Destroy((Object)(object)rightwebpoint);
Object.Destroy((Object)(object)rightwebjoint);
}
break;
}
}
public bool IsGrabbing(HandType type)
{
return type switch
{
HandType.Left => (Object)(object)((Component)lefthand).GetComponent<Hand>().AttachedReceiver != (Object)null,
HandType.Right => (Object)(object)((Component)righthand).GetComponent<Hand>().AttachedReceiver != (Object)null,
_ => false,
};
}
public override void OnUpdate()
{
//IL_0202: 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_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_0578: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
//IL_049a: Unknown result type (might be due to invalid IL or missing references)
//IL_05da: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0461: Unknown result type (might be due to invalid IL or missing references)
//IL_0468: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0477: Unknown result type (might be due to invalid IL or missing references)
//IL_048c: Unknown result type (might be due to invalid IL or missing references)
//IL_0756: Unknown result type (might be due to invalid IL or missing references)
//IL_076c: Unknown result type (might be due to invalid IL or missing references)
//IL_079a: Unknown result type (might be due to invalid IL or missing references)
//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)leftcontroller != (Object)null && (Object)(object)rightcontroller != (Object)null)
{
if (inputmode == InputMode.Gesture)
{
if (((Component)leftcontroller).GetComponent<BaseController>().GetIndexCurlAxis() < 0.45f && ((Component)leftcontroller).GetComponent<BaseController>().GetPinkyCurlAxis() < 0.45f && ((Component)leftcontroller).GetComponent<BaseController>().GetMiddleCurlAxis() > 0.83f && ((Component)leftcontroller).GetComponent<BaseController>().GetRingCurlAxis() > 0.83f)
{
poseleft = HandPose.WebSling;
}
if (((Component)leftcontroller).GetComponent<BaseController>().GetMiddleCurlAxis() < 0.7f && ((Component)leftcontroller).GetComponent<BaseController>().GetRingCurlAxis() < 0.7f)
{
poseleft = HandPose.Neutral;
}
if (((Component)rightcontroller).GetComponent<BaseController>().GetIndexCurlAxis() < 0.45f && ((Component)rightcontroller).GetComponent<BaseController>().GetPinkyCurlAxis() < 0.45f && ((Component)rightcontroller).GetComponent<BaseController>().GetMiddleCurlAxis() > 0.83f && ((Component)rightcontroller).GetComponent<BaseController>().GetRingCurlAxis() > 0.83f)
{
poseright = HandPose.WebSling;
}
if (((Component)rightcontroller).GetComponent<BaseController>().GetMiddleCurlAxis() < 0.7f && ((Component)rightcontroller).GetComponent<BaseController>().GetRingCurlAxis() < 0.7f)
{
poseright = HandPose.Neutral;
}
}
else if (inputmode == InputMode.DoubleTrigger)
{
HandleTouchInput(HandType.Left);
HandleTouchInput(HandType.Right);
}
}
if ((Object)(object)lefthand != (Object)null && (Object)(object)reticleleft != (Object)null && (Object)(object)righthand != (Object)null && (Object)(object)reticleright != (Object)null && (Object)(object)hmd != (Object)null)
{
if (aimreticleson)
{
Ray val = default(Ray);
((Ray)(ref val))..ctor(lefthand.position, lefthand.forward);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(val, ref val2, 1000f, GetLayerMaskThatIgnoresLayers("Player", "NoCollide", "Deciverse", "UI")))
{
if (IsGrabbing(HandType.Left))
{
((Component)reticleleft).gameObject.SetActive(false);
}
if ((Object)(object)leftwebjoint != (Object)null && !IsGrabbing(HandType.Left))
{
((Component)reticleleft).gameObject.SetActive(false);
}
else if ((Object)(object)leftwebjoint == (Object)null && !IsGrabbing(HandType.Left))
{
((Component)reticleleft).gameObject.SetActive(true);
}
reticleleft.position = ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.002f;
reticleleft.LookAt(hmd.position);
}
else if (!Physics.Raycast(val, 1000f, GetLayerMaskThatIgnoresLayers("Player", "NoCollide", "Deciverse", "UI")))
{
((Component)reticleleft).gameObject.SetActive(false);
}
Ray val3 = default(Ray);
((Ray)(ref val3))..ctor(righthand.position, righthand.forward);
RaycastHit val4 = default(RaycastHit);
if (Physics.Raycast(val3, ref val4, 1000f, GetLayerMaskThatIgnoresLayers("Player", "NoCollide", "Deciverse", "UI")))
{
if (IsGrabbing(HandType.Right))
{
((Component)reticleright).gameObject.SetActive(false);
}
if ((Object)(object)rightwebjoint != (Object)null && !IsGrabbing(HandType.Right))
{
((Component)reticleright).gameObject.SetActive(false);
}
else if ((Object)(object)rightwebjoint == (Object)null && !IsGrabbing(HandType.Right))
{
((Component)reticleright).gameObject.SetActive(true);
}
reticleright.position = ((RaycastHit)(ref val4)).point + ((RaycastHit)(ref val2)).normal * 0.002f;
reticleright.LookAt(hmd.position);
}
else if (!Physics.Raycast(val, 1000f, GetLayerMaskThatIgnoresLayers("Player", "NoCollide", "Deciverse", "UI")))
{
((Component)reticleright).gameObject.SetActive(false);
}
}
else if (!aimreticleson)
{
((Component)reticleleft).gameObject.SetActive(false);
((Component)reticleright).gameObject.SetActive(false);
}
}
if (slingingtononrigidl && (Object)(object)lefthand != (Object)null && (Object)(object)leftcontroller != (Object)null && (Object)(object)leftwebjoint != (Object)null)
{
((Component)lefthand).GetComponent<Rigidbody>().AddForce(CalculatePull(lefthand, leftcontroller, pulleystrength * yankintensity), (ForceMode)5);
}
if (slingingtononrigidr && (Object)(object)righthand != (Object)null && (Object)(object)rightcontroller != (Object)null && (Object)(object)rightwebjoint != (Object)null)
{
((Component)righthand).GetComponent<Rigidbody>().AddForce(CalculatePull(righthand, rightcontroller, pulleystrength * yankintensity), (ForceMode)5);
}
if (poseleft == HandPose.WebSling && (Object)(object)leftwebjoint == (Object)null && (Object)(object)lefthand != (Object)null && !IsGrabbing(HandType.Left))
{
SlingWeb(HandType.Left);
}
if (poseright == HandPose.WebSling && (Object)(object)rightwebjoint == (Object)null && (Object)(object)righthand != (Object)null && !IsGrabbing(HandType.Right))
{
SlingWeb(HandType.Right);
}
if (poseleft == HandPose.Neutral && (Object)(object)leftwebjoint != (Object)null)
{
ReleaseWeb(HandType.Left);
}
if ((Object)(object)lefthand != (Object)null && IsGrabbing(HandType.Left))
{
ReleaseWeb(HandType.Left);
}
if ((Object)(object)righthand != (Object)null && IsGrabbing(HandType.Right))
{
ReleaseWeb(HandType.Right);
}
if (poseright == HandPose.Neutral && (Object)(object)rightwebjoint != (Object)null)
{
ReleaseWeb(HandType.Right);
}
if ((Object)(object)leftweb != (Object)null && (Object)(object)rightweb != (Object)null)
{
if ((Object)(object)leftwebpoint != (Object)null)
{
leftweb.SetPosition(0, ((Component)leftweb).transform.position);
leftweb.SetPosition(1, leftwebpoint.position);
}
if ((Object)(object)rightwebpoint != (Object)null)
{
rightweb.SetPosition(0, ((Component)rightweb).transform.position);
rightweb.SetPosition(1, rightwebpoint.position);
}
}
}
public override void OnGUI()
{
}
}
}
namespace Spiderman.Utils
{
public class LineUtils
{
public static Shader LoadShader(string shader)
{
foreach (Material item in Resources.FindObjectsOfTypeAll<Material>())
{
if ((Object)(object)item.shader != (Object)null && ((Object)item.shader).name == shader)
{
return item.shader;
}
}
return null;
}
public static LineRenderer CreateDragline(Transform attach, float width)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
LineRenderer val = ((Component)attach).gameObject.AddComponent<LineRenderer>();
Material val2 = new Material(LoadShader("Universal Render Pipeline/Unlit"));
val2.color = new Color(1f, 1f, 1f, 1f);
val2.SetFloat("_Surface", 1f);
val2.SetOverrideTag("RenderType", "Fade");
val2.renderQueue = 3000;
val2.EnableKeyword("_ALPHATEST_ON");
val2.EnableKeyword("_ALPHABLEND_ON");
val2.DisableKeyword("_ALPHAPREMULTIPLY_ON");
val2.SetInt("_SrcBlend", 5);
val2.SetInt("_DstBlend", 10);
val2.SetInt("_ZWrite", 0);
val.startWidth = width;
val.positionCount = 2;
val.endWidth = width;
((Renderer)val).material = val2;
val.textureMode = (LineTextureMode)1;
((Renderer)val).enabled = false;
return val;
}
public static Material CreateUnlitVRMaterial()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Material val = new Material(LoadShader("Universal Render Pipeline/Unlit"));
val.color = new Color(1f, 1f, 1f, 1f);
val.SetFloat("_Surface", 1f);
val.SetOverrideTag("RenderType", "Fade");
val.renderQueue = 3000;
val.EnableKeyword("_ALPHATEST_ON");
val.EnableKeyword("_ALPHABLEND_ON");
val.DisableKeyword("_ALPHAPREMULTIPLY_ON");
val.SetInt("_SrcBlend", 5);
val.SetInt("_DstBlend", 10);
val.SetInt("_ZWrite", 0);
return val;
}
}
}