using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab.SaveData;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Input;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSLZ.Marrow.Utilities;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using SpiderLab;
using SpiderLab.Behaviours;
using SpiderLab.Data;
using SpiderLab.Preferences;
using SpiderLab.Utils;
using UnityEngine;
using UnityEngine.XR;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SpiderLab")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("SpiderLab")]
[assembly: AssemblyCopyright("Created by Parzival")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("2.3.2.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(Main), "SpiderLab Compat", "2.3.2", "Parzival; Patch 6 compatibility rebuild", "https://bonelab.thunderstore.io/package/Parzival/SpiderLab/")]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonIncompatibleAssemblies(new string[] { "SpiderlectricBoogaloo", "AvatarStatsLoader", "StatOverride" })]
[assembly: MelonAdditionalDependencies(new string[] { "BoneLib" })]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.3.2.0")]
[module: UnverifiableCode]
[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 SpiderLab
{
public static class BuildInfo
{
public const string Name = "SpiderLab";
public const string Author = "Parzival";
public const string Company = null;
public const string Version = "1.0.2";
public const string DownloadLink = "https://bonelab.thunderstore.io/package/Parzival/SpiderLab/";
public const string GameName = "BONELAB";
public const string DeveloperName = "Stress Level Zero";
}
public class Main : MelonMod
{
private float nextInitializationAttempt;
public override void OnInitializeMelon()
{
Prefs.Initialize();
Patches.Initialize();
Bundles.LoadAssets();
Hooking.OnLevelLoaded += OnLevelInitialized;
}
public override void OnDeinitializeMelon()
{
Prefs.prefsCategory.SaveToFile(true);
}
private void OnLevelInitialized(LevelInfo info)
{
TryInitializePlayer(logIfUnavailable: true);
}
public override void OnUpdate()
{
if (!(Time.unscaledTime < nextInitializationAttempt))
{
nextInitializationAttempt = Time.unscaledTime + 1f;
TryInitializePlayer(logIfUnavailable: false);
}
}
private static void TryInitializePlayer(bool logIfUnavailable)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Expected O, but got Unknown
if (!Player.HandsExist || (Object)Player.LeftHand == (Object)null || (Object)Player.RightHand == (Object)null)
{
if (logIfUnavailable)
{
MelonLogger.Warning("Couldn't initialize WebShooters yet; player hands are not ready.");
}
return;
}
bool flag = false;
GameObject gameObject = ((Component)Player.LeftHand).gameObject;
GameObject gameObject2 = ((Component)Player.RightHand).gameObject;
if ((Object)gameObject.GetComponent<WebShooter>() == (Object)null)
{
gameObject.AddComponent<WebShooter>();
flag = true;
}
if ((Object)gameObject2.GetComponent<WebShooter>() == (Object)null)
{
gameObject2.AddComponent<WebShooter>();
flag = true;
}
Component physicsRig = (Component)(object)Player.GetPhysicsRig();
if ((Object)physicsRig != (Object)null && (Object)physicsRig.gameObject.GetComponent<AirControl>() == (Object)null)
{
physicsRig.gameObject.AddComponent<AirControl>();
}
if (flag)
{
MelonLogger.Msg("WebShooters attached to both player hands.");
}
}
private void LogAvatarInfo(Avatar avatar)
{
Msg("===========================");
Msg("Name: " + ((Object)avatar).name);
Msg("Pointer: " + ((Il2CppObjectBase)avatar).Pointer.ToString("x"));
Msg("Strength Boost: " + Prefs.enableSpiderStrength.Value);
Msg("Mass: " + avatar.massTotal);
Msg("Strength Upper: " + avatar.strengthUpper);
Msg("Strength Lower: " + avatar.strengthLower);
float num = avatar.strengthUpper / avatar.massTotal;
Msg("Strength Upper to Total Mass: " + num);
Msg("Strength % of Mass: " + num * 100f);
Msg("Raw Strength Upper: " + avatar.strengthUpper / (avatar.massTotal / 75f));
static void Msg(string txt)
{
MelonLogger.Msg(txt);
}
}
}
internal static class Patches
{
public static void Initialize()
{
Hooking.CreateHook(typeof(WorldGrip).GetMethod("ValidateGripScore", AccessTools.all), typeof(Patches).GetMethod("WorldGripScorePostfix", AccessTools.all), false);
Hooking.CreateHook(typeof(PhysicsRig).GetMethod("SetAvatar", AccessTools.all), typeof(Patches).GetMethod("PhysicsRigSetAvatarPrefix", AccessTools.all), true);
}
private static void WorldGripScorePostfix(Hand hand, SimpleTransform handTransform, ref ValueTuple<float, float, Vector3, Vector3> __result, WorldGrip __instance)
{
//IL_0012: 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_002d: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_0042: 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)
if (Prefs.enableWallCrawling.Value)
{
Vector3 val = hand.palmPositionTransform.position - __instance.genericHandStates[hand].raycastPoint;
Vector3 normalized = ((Vector3)(ref val)).normalized;
if (Vector3.Dot(-normalized, hand.palmPositionTransform.forward) >= 0.75f)
{
__instance.genericHandStates[hand].raycastNormal = normalized;
__result.Item1 = 1.5f;
}
}
}
internal static void PhysicsRigSetAvatarPrefix(Avatar avatar)
{
if (Prefs.enableSpiderStrength.Value)
{
float num = Prefs.upperProportionalStrengthPerc.Value / 100f * avatar.massTotal * Prefs.upperStrengthBoostMultiplier.Value;
avatar._strengthUpper = Mathf.Max(num, avatar._strengthUpper);
float num2 = Prefs.lowerProportionalStrengthPerc.Value / 100f * avatar.massTotal * Prefs.lowerStrengthBoostMultiplier.Value;
avatar._strengthLower = Mathf.Max(num2, avatar._strengthLower);
}
}
}
}
namespace SpiderLab.Utils
{
public static class AssetBundleExtensions
{
public static T LoadAssetWithFlags<T>(this AssetBundle bundle, string name) where T : Object
{
T val = bundle.LoadAsset<T>(name);
((Object)val).hideFlags = (HideFlags)32;
return val;
}
}
public struct BoolTimer
{
private float resetTime;
public void Set(float time, bool overwrite = false)
{
if (overwrite)
{
resetTime = Time.time + time;
}
else
{
resetTime = Mathf.Max(resetTime, Time.time + time);
}
}
public void Reset()
{
resetTime = Time.time - 1f;
}
public bool GetValue()
{
return Time.time <= resetTime;
}
public static implicit operator bool(BoolTimer bt)
{
return bt.GetValue();
}
}
public static class ControllerInfo
{
public static bool GetTouchpadTouch(Handedness hand)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Invalid comparison between Unknown and I4
if (!TryGetXRController(hand, out var controller))
{
return false;
}
bool flag = controller.TouchpadTouch || controller.JoystickTouch;
if ((int)controller.Type == 0 || (int)controller.Type == 4)
{
InputDevice xrDevice = ((XRDevice)controller)._xrDevice;
bool flag2 = default(bool);
if (((InputDevice)(ref xrDevice)).TryGetFeatureValue(CommonUsages.thumbrest, ref flag2))
{
flag = flag || flag2;
}
}
return flag;
}
public static bool GetFaceButtonsTouch(Handedness hand)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if (!TryGetXRController(hand, out var controller))
{
return false;
}
if (controller.ATouch)
{
return controller.BTouch;
}
return false;
}
public static float GetTrigger(Handedness hand)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if (!TryGetXRController(hand, out var controller))
{
return 0f;
}
return controller.Trigger;
}
public static float GetGrip(Handedness hand)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if (!TryGetXRController(hand, out var controller))
{
return 0f;
}
return controller.Grip;
}
private unsafe static bool TryGetXRController(Handedness hand, out XRController controller)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
if ((int)hand != 1)
{
if ((int)hand == 2)
{
controller = MarrowGame.xr.RightController;
return true;
}
MelonLogger.Error("Invalid hand type: " + ((object)(*(Handedness*)(&hand))/*cast due to .constrained prefix*/).ToString());
controller = null;
return false;
}
controller = MarrowGame.xr.LeftController;
return true;
}
}
public static class GeneralExtensions
{
public static void MatchRotation(this ref Vector3 vector, Vector3 target, float maxRadiansDelta, float maxMagnitudeDelta)
{
//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_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
vector = Vector3.RotateTowards(vector, target, maxRadiansDelta, maxMagnitudeDelta);
}
public static void PointTowards(this ref Vector3 vector, Vector3 target, float maxRadiansDelta)
{
//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_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_0019: 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)
vector = Vector3.RotateTowards(vector, target - vector, maxRadiansDelta, 0f);
}
public static GameObject CreateChild(this GameObject go, string name, Vector3 localPosition = default(Vector3))
{
//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_0017: 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_002f: 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_003c: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.SetParent(go.transform);
if (localPosition == default(Vector3))
{
localPosition = Vector3.zero;
}
val.transform.localPosition = localPosition;
return val;
}
public static bool IsStaticLayer(this GameObject obj)
{
return (obj.layer & 0x2000) > 0;
}
}
public static class JointExtensions
{
public static Vector3 GetConnectedPoint(this ConfigurableJoint joint)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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)
if ((Object)((Joint)joint).connectedBody != (Object)null)
{
return ((Component)((Joint)joint).connectedBody).transform.TransformPoint(((Joint)joint).connectedAnchor);
}
return ((Joint)joint).connectedAnchor;
}
public static void SetConnectedPoint(this ConfigurableJoint joint, Vector3 worldPoint)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0033: 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_0027: Unknown result type (might be due to invalid IL or missing references)
((Joint)joint).autoConfigureConnectedAnchor = false;
if ((Object)((Joint)joint).connectedBody != (Object)null)
{
((Joint)joint).connectedAnchor = ((Component)((Joint)joint).connectedBody).transform.InverseTransformPoint(worldPoint);
}
else
{
((Joint)joint).connectedAnchor = worldPoint;
}
}
public static Vector3 GetAnchorPoint(this ConfigurableJoint joint)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return ((Component)joint).transform.TransformPoint(((Joint)joint).anchor);
}
public static void SetAnchorPoint(this ConfigurableJoint joint, Vector3 worldPoint)
{
//IL_0007: 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)
((Joint)joint).anchor = ((Component)joint).transform.InverseTransformPoint(worldPoint);
}
public static Vector3 GetTargetPosition(this ConfigurableJoint joint)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return ((Component)joint).transform.TransformPoint(joint.targetPosition);
}
public static void SetTargetPosition(this ConfigurableJoint joint, Vector3 worldPos)
{
//IL_0007: 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)
joint.targetPosition = ((Component)joint).transform.InverseTransformPoint(worldPos);
}
public static void SetLinearLimit(this ConfigurableJoint joint, float limit, float bounciness)
{
//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_0018: 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 = bounciness;
joint.linearLimit = linearLimit;
}
public static void SetLinearMotion(this ConfigurableJoint joint, ConfigurableJointMotion motion)
{
//IL_0001: 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_000f: Unknown result type (might be due to invalid IL or missing references)
joint.xMotion = motion;
joint.yMotion = motion;
joint.zMotion = motion;
}
public static void SetSpringLimit(this ConfigurableJoint joint, float spring, float damper)
{
//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_0018: 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 static void SetSpringDrive(this ConfigurableJoint joint, float spring, float damper, float max)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_002f: 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;
joint.xDrive = val;
joint.yDrive = val;
joint.zDrive = val;
}
}
}
namespace SpiderLab.Preferences
{
public enum HandGesture
{
SPIDEY,
GRIP
}
internal static class Prefs
{
public static MelonPreferences_Entry<bool> enableAimReticle;
public static MelonPreferences_Entry<bool> enableWallCrawling;
public static MelonPreferences_Entry<HandGesture> selectedGesture;
public static MelonPreferences_Entry<WeblineInput> weblineInput;
public static MelonPreferences_Entry<bool> enableWebSwinging;
public static MelonPreferences_Entry<float> webzipPullSpeedMin;
public static MelonPreferences_Entry<float> webzipStrengthMultiplier;
public static MelonPreferences_Entry<bool> enableTargetPulling;
public static MelonPreferences_Entry<float> targetPullStrengthMultiplier;
public static MelonPreferences_Entry<float> targetPullGestureSpeedMin;
public static MelonPreferences_Entry<bool> enableTargetAutoCatch;
public static MelonPreferences_Entry<float> targetAutoCatchDistance;
public static MelonPreferences_Entry<bool> enableSpiderStrength;
public static MelonPreferences_Entry<float> upperStrengthBoostMultiplier;
public static MelonPreferences_Entry<float> upperProportionalStrengthPerc;
public static MelonPreferences_Entry<float> lowerStrengthBoostMultiplier;
public static MelonPreferences_Entry<float> lowerProportionalStrengthPerc;
public static MelonPreferences_Category prefsCategory;
public static Page menuCategory;
public static bool WebShootersEnabled => enableWebSwinging.Value;
public static float WebzipPullSpeedMax => webzipPullSpeedMin.Value + 1f;
public static float WebzipImpulseSpeed => 50f * webzipStrengthMultiplier.Value;
public static float TargetPullImpulseSpeed => 12f * targetPullStrengthMultiplier.Value;
public static void Initialize()
{
prefsCategory = MelonPreferences.CreateCategory("SpiderLab");
selectedGesture = prefsCategory.CreateEntry<HandGesture>("Hand Gesture", HandGesture.GRIP, (string)null, "Required hand gesture for Webshooter inputs to register (SPIDEY, GRIP) (SPIDEY gesture requires finger tracking!)", false, false, (ValueValidator)null, (string)null);
weblineInput = prefsCategory.CreateEntry<WeblineInput>("Webline Input", WeblineInput.DOUBLE_TRIGGER_OR_GRIP, (string)null, "Choose DOUBLE_TRIGGER, DOUBLE_GRIP, DOUBLE_TRIGGER_OR_GRIP, a legacy input, or DISABLED. Double-trigger still uses the selected hand gesture; double-grip uses the grip itself.", false, false, (ValueValidator)null, (string)null);
enableWallCrawling = prefsCategory.CreateEntry<bool>("Enable Wall Crawling", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
enableWebSwinging = prefsCategory.CreateEntry<bool>("Enable Web Swinging", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
enableSpiderStrength = prefsCategory.CreateEntry<bool>("Enable Spider Strength", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
upperStrengthBoostMultiplier = prefsCategory.CreateEntry<float>("Upper Strength Boost Multiplier", 1f, (string)null, "Controls the how strong the upper-body strength boost is", false, false, (ValueValidator)null, (string)null);
upperProportionalStrengthPerc = prefsCategory.CreateEntry<float>("Upper Proportional Strength Percentage", 5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
lowerStrengthBoostMultiplier = prefsCategory.CreateEntry<float>("Lower Strength Boost Multiplier", 1f, (string)null, "Controls the how strong the lower-body strength boost is", false, false, (ValueValidator)null, (string)null);
lowerProportionalStrengthPerc = prefsCategory.CreateEntry<float>("Lower Proportional Strength Percentage", 3.45f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
webzipPullSpeedMin = prefsCategory.CreateEntry<float>("WebZip Minimum Pull Speed", 4f, (string)null, "Minimum pull speed for WebZip to kick in (m/s)", false, false, (ValueValidator)null, (string)null);
webzipStrengthMultiplier = prefsCategory.CreateEntry<float>("WebZip Strength Multiplier", 1f, (string)null, "Controls how strong a maxxed WebZip is", false, false, (ValueValidator)null, (string)null);
enableTargetPulling = prefsCategory.CreateEntry<bool>("Enable Target Pulling", true, (string)null, "Pull movable props, NPC bodies, and synchronized player bodies toward you when you yank a webline.", false, false, (ValueValidator)null, (string)null);
targetPullStrengthMultiplier = prefsCategory.CreateEntry<float>("Target Pull Strength Multiplier", 4f, (string)null, "Controls how quickly movable webbed targets are pulled toward your chest.", false, false, (ValueValidator)null, (string)null);
targetPullGestureSpeedMin = prefsCategory.CreateEntry<float>("Target Pull Minimum Hand Speed", 3f, (string)null, "Minimum backward hand speed required to yank a movable webbed target.", false, false, (ValueValidator)null, (string)null);
enableTargetAutoCatch = prefsCategory.CreateEntry<bool>("Enable Target Auto Catch", true, (string)null, "Automatically snatch a force-pullable prop into the web-shooting hand when it reaches grabbing distance.", false, false, (ValueValidator)null, (string)null);
targetAutoCatchDistance = prefsCategory.CreateEntry<float>("Target Auto Catch Distance", 0.45f, (string)null, "Maximum distance in meters between the hand and a pulled prop's grip before it is automatically caught.", false, false, (ValueValidator)null, (string)null);
enableAimReticle = prefsCategory.CreateEntry<bool>("Enable Aiming Reticle", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
SetupBoneMenu();
prefsCategory.SaveToFile(false);
}
private static void SetupBoneMenu()
{
//IL_000a: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0478: Unknown result type (might be due to invalid IL or missing references)
//IL_048a: Unknown result type (might be due to invalid IL or missing references)
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: Unknown result type (might be due to invalid IL or missing references)
menuCategory = Page.Root.CreatePage("SpiderLab", Color.red, 0, true);
Page obj = menuCategory.CreatePage("Input", Color.white, 0, true);
obj.CreateEnum(((MelonPreferences_Entry)selectedGesture).Identifier, Color.white, (Enum)selectedGesture.Value, (Action<Enum>)delegate(Enum gesture)
{
selectedGesture.Value = (HandGesture)(object)gesture;
});
obj.CreateEnum(((MelonPreferences_Entry)weblineInput).Identifier, Color.white, (Enum)weblineInput.Value, (Action<Enum>)delegate(Enum webInput)
{
weblineInput.Value = (WeblineInput)(object)webInput;
});
Page obj2 = menuCategory.CreatePage("Web Swinging", Color.white, 0, true);
obj2.CreateBool(((MelonPreferences_Entry)enableAimReticle).Identifier, Color.white, enableAimReticle.Value, (Action<bool>)delegate(bool value)
{
enableAimReticle.Value = value;
});
obj2.CreateBool(((MelonPreferences_Entry)enableWebSwinging).Identifier, Color.white, enableWebSwinging.Value, (Action<bool>)delegate(bool value)
{
enableWebSwinging.Value = value;
});
obj2.CreateFloat(((MelonPreferences_Entry)webzipPullSpeedMin).Identifier, Color.white, webzipPullSpeedMin.Value, 0.5f, 0f, 10f, (Action<float>)delegate(float value)
{
webzipPullSpeedMin.Value = value;
});
obj2.CreateFloat(((MelonPreferences_Entry)webzipStrengthMultiplier).Identifier, Color.white, webzipStrengthMultiplier.Value, 0.2f, 0f, 10f, (Action<float>)delegate(float value)
{
webzipStrengthMultiplier.Value = value;
});
obj2.CreateBool(((MelonPreferences_Entry)enableTargetPulling).Identifier, Color.white, enableTargetPulling.Value, (Action<bool>)delegate(bool value)
{
enableTargetPulling.Value = value;
});
obj2.CreateFloat(((MelonPreferences_Entry)targetPullStrengthMultiplier).Identifier, Color.white, targetPullStrengthMultiplier.Value, 0.1f, 0f, 5f, (Action<float>)delegate(float value)
{
targetPullStrengthMultiplier.Value = value;
});
obj2.CreateFloat(((MelonPreferences_Entry)targetPullGestureSpeedMin).Identifier, Color.white, targetPullGestureSpeedMin.Value, 0.25f, 0.5f, 5f, (Action<float>)delegate(float value)
{
targetPullGestureSpeedMin.Value = value;
});
obj2.CreateBool(((MelonPreferences_Entry)enableTargetAutoCatch).Identifier, Color.white, enableTargetAutoCatch.Value, (Action<bool>)delegate(bool value)
{
enableTargetAutoCatch.Value = value;
});
obj2.CreateFloat(((MelonPreferences_Entry)targetAutoCatchDistance).Identifier, Color.white, targetAutoCatchDistance.Value, 0.05f, 0.15f, 1f, (Action<float>)delegate(float value)
{
targetAutoCatchDistance.Value = value;
});
Page obj3 = menuCategory.CreatePage("Spider Strength", Color.white, 0, true);
obj3.CreateBool(((MelonPreferences_Entry)enableSpiderStrength).Identifier, Color.white, enableSpiderStrength.Value, (Action<bool>)delegate(bool value)
{
enableSpiderStrength.Value = value;
});
obj3.CreateFunction("Update Stats", Color.yellow, (Action)UpdateStrengthStats);
Page obj4 = obj3.CreatePage("Upper Strength", Color.white, 0, true);
obj4.CreateFloat("Strength Boost Multiplier", Color.white, upperStrengthBoostMultiplier.Value, 0.1f, 0f, 100f, (Action<float>)delegate(float value)
{
upperStrengthBoostMultiplier.Value = value;
});
obj4.CreateFloat("Proportional Strength Percentage", Color.white, upperProportionalStrengthPerc.Value, 1f, 0f, 100f, (Action<float>)delegate(float value)
{
upperProportionalStrengthPerc.Value = value;
});
Page obj5 = obj3.CreatePage("Lower Strength", Color.white, 0, true);
obj5.CreateFloat("Strength Boost Multiplier", Color.white, lowerStrengthBoostMultiplier.Value, 0.1f, 0f, 100f, (Action<float>)delegate(float value)
{
lowerStrengthBoostMultiplier.Value = value;
});
obj5.CreateFloat("Proportional Strength Percentage", Color.white, lowerProportionalStrengthPerc.Value, 1f, 0f, 100f, (Action<float>)delegate(float value)
{
lowerProportionalStrengthPerc.Value = value;
});
menuCategory.CreateBool(((MelonPreferences_Entry)enableWallCrawling).Identifier, Color.white, enableWallCrawling.Value, (Action<bool>)delegate(bool value)
{
enableWallCrawling.Value = value;
});
}
public static void UpdateStrengthStats()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
Avatar avatar = Player.Avatar;
if ((Object)avatar != (Object)null)
{
Patches.PhysicsRigSetAvatarPrefix(avatar);
}
}
}
public enum WeblineInput
{
TOUCHPAD,
DOUBLE_TOUCHPAD,
DOUBLE_GESTURE,
DOUBLE_TRIGGER,
DOUBLE_TOUCH_BUTTONS,
DOUBLE_GRIP,
DOUBLE_TRIGGER_OR_GRIP,
DISABLED
}
}
namespace SpiderLab.Data
{
public static class Bundles
{
public static AssetBundle spiderLabBundle;
public static GameObject webLinePrefab;
public static GameObject webShooterReticlePrefab;
public static AudioClip webLineAudioLow;
public static AudioClip webLineAudioHigh;
public static AudioClip webShotAudioLow;
public static AudioClip webShotAudioHigh;
public static void LoadAssets()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
spiderLabBundle = EmebeddedAssetBundle.LoadFromAssembly(Assembly.GetExecutingAssembly(), "SpiderLab.src.Data.spiderlab.bundle");
if ((Object)spiderLabBundle == (Object)null)
{
throw new NullReferenceException("SpiderLab bundle is null! Did you forget to compile the bundle into the dll?");
}
webLinePrefab = spiderLabBundle.LoadAssetWithFlags<GameObject>("prefabs/webline");
webShooterReticlePrefab = spiderLabBundle.LoadAssetWithFlags<GameObject>("prefabs/webshooterreticle");
webLineAudioHigh = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webline_high");
webLineAudioLow = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webline_low");
webShotAudioHigh = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webshot_high");
webShotAudioLow = spiderLabBundle.LoadAssetWithFlags<AudioClip>("audio/webshot_low");
spiderLabBundle.Unload(false);
}
}
public static class EmebeddedAssetBundle
{
public static AssetBundle LoadFromAssembly(Assembly assembly, string name)
{
if (assembly.GetManifestResourceNames().Contains(name))
{
MelonLogger.Msg(ConsoleColor.DarkCyan, "Loading embedded bundle " + name + "...");
byte[] array;
using (Stream stream = assembly.GetManifestResourceStream(name))
{
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
array = memoryStream.ToArray();
}
MelonLogger.Msg(ConsoleColor.DarkCyan, "Done!");
return AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
}
MelonLogger.Warning("Missing embedded bundle " + name);
return null;
}
}
}
namespace SpiderLab.Behaviours
{
[RegisterTypeInIl2Cpp]
public class AirControl : MonoBehaviour
{
private RigManager rigMan;
public AirControl(IntPtr ptr)
: base(ptr)
{
}
private void Start()
{
rigMan = Player.RigManager;
}
private void FixedUpdate()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: 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)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)rigMan.activeSeat != (Object)null) && !rigMan.physicsRig.physG.isGrounded)
{
Vector2 val = (Player.ControllerRig.isRightHanded ? Player.LeftHand.Controller.GetThumbStickAxis() : Player.RightHand.Controller.GetThumbStickAxis());
Vector3 val2 = Player.ControllerRig.directionMasterTransform.rotation * new Vector3(val.x, 0f, val.y) * 12f;
rigMan.physicsRig.torso.rbChest.AddForce(val2, (ForceMode)5);
}
}
}
[RegisterTypeInIl2Cpp]
public class WebLine : MonoBehaviour
{
public Vector3 anchorPoint;
public Vector3 connectedPoint;
private LineRenderer lRenderer;
private void EnsureRenderer()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
if ((Object)lRenderer == (Object)null)
{
lRenderer = ((Component)this).GetComponent<LineRenderer>();
}
}
public WebLine(IntPtr ptr)
: base(ptr)
{
}
private void Start()
{
EnsureRenderer();
}
public void SetActive(bool value)
{
EnsureRenderer();
((Renderer)lRenderer).enabled = value;
}
public void UpdateLine(Vector3 anchorPoint, Vector3 connectedPoint)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//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_0009: Unknown result type (might be due to invalid IL or missing references)
this.anchorPoint = anchorPoint;
this.connectedPoint = connectedPoint;
UpdateLine();
}
public void UpdateLine()
{
//IL_000e: 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)
EnsureRenderer();
lRenderer.SetPosition(0, anchorPoint);
lRenderer.SetPosition(1, connectedPoint);
}
public Vector3 GetLineSegment()
{
//IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references)
return connectedPoint - anchorPoint;
}
public Vector3 GetNormal()
{
//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)
Vector3 lineSegment = GetLineSegment();
return ((Vector3)(ref lineSegment)).normalized;
}
}
[RegisterTypeInIl2Cpp]
public class WebShooter : MonoBehaviour
{
private const float YOUNGS_MODULUS = 2E+11f;
private const float WEB_CROSS_SECTIONAL_AREA = 0.0001767f;
private const float LINEAR_SPRING_CONSTANT = 1372344f / (float)Math.E;
private const float LINEAR_SPRING_DAMPER = 50485.715f;
private float WEB_BREAK_FORCE = 1000000f;
private const float MAX_WEB_RANGE = 70f;
private const float LINEAR_DRIVE_SPRING = 500f;
private const float LINEAR_DRIVE_DAMPER = 1f;
private const float LINEAR_DRIVE_MAX = 2500f;
public bool doWebWrapping;
private LayerMask layerMask = LayerMask.op_Implicit(46081);
private WebLine webLine;
private Hand hand;
private Transform aimReticle;
private AudioSource audioSource;
private float webLine_lowestLength;
private ConfigurableJoint webJoint;
private Collider webbedCollider;
private bool webActive;
private BoolTimer isWebShotBtnPressMomentary;
private BoolTimer weblineDoubleTap;
private bool weblineLastDoubleTapState;
private BoolTimer triggerDoubleTap;
private bool triggerLastDoubleTapState;
private BoolTimer gripDoubleTap;
private bool gripLastDoubleTapState;
private BoolTimer webzipCooldown;
private Vector3 lastControllerPos;
private const int ROLLING_AVERAGE_VELOCITY_MAX = 8;
private Vector3[] controllerVelocities = (Vector3[])(object)new Vector3[8];
private int rollingAverageVelIndex;
private bool initialized;
private ForcePullGrip pendingAutoCatch;
private Grip pendingAutoCatchGrip;
private int pendingAutoCatchFrame;
[HideFromIl2Cpp]
public Hand Hand => hand;
[HideFromIl2Cpp]
public static event Action<WebShooter, RaycastHit> WebCreated;
[HideFromIl2Cpp]
public static event Action<WebShooter> WebDestroyed;
[HideFromIl2Cpp]
public static event Action<WebShooter, Rigidbody, Vector3> TargetPulled;
public WebShooter(IntPtr ptr)
: base(ptr)
{
}//IL_0011: 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)
private void Start()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
hand = ((Component)this).GetComponent<Hand>();
if ((Object)hand == (Object)null || (Object)Bundles.webLinePrefab == (Object)null || (Object)Bundles.webShooterReticlePrefab == (Object)null)
{
MelonLogger.Error("WebShooter could not initialize because its hand or embedded prefabs are unavailable.");
return;
}
webLine = Object.Instantiate<GameObject>(Bundles.webLinePrefab, ((Component)this).transform).AddComponent<WebLine>();
aimReticle = Object.Instantiate<GameObject>(Bundles.webShooterReticlePrefab).transform;
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.playOnAwake = false;
audioSource.minDistance = 0.5f;
audioSource.spatialBlend = 1f;
initialized = true;
}
private void LateUpdate()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
if (!initialized)
{
return;
}
if ((Object)pendingAutoCatch != (Object)null || (Object)pendingAutoCatchGrip != (Object)null)
{
UpdatePendingAutoCatch();
return;
}
if (!Prefs.WebShootersEnabled)
{
((Component)aimReticle).gameObject.SetActive(false);
if (IsWebAttatched())
{
DestroyWebJoint();
}
return;
}
if (IsWebAttatched())
{
UpdateWeb();
return;
}
if (webActive)
{
DestroyWebJoint();
}
webLine.SetActive(value: false);
HandleAiming();
}
private void UpdateWeb()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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)
//IL_0017: 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_00d2: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: 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_0023: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0036: 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_011a: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_00aa: 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_00bb: 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_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Expected O, but got Unknown
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = webJoint.GetConnectedPoint();
Vector3 anchorPoint = webJoint.GetAnchorPoint();
Vector3 val2;
if (doWebWrapping)
{
val2 = val - anchorPoint;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(anchorPoint, ((Vector3)(ref val2)).normalized, ref val3, 70f, ((LayerMask)(ref layerMask)).value, (QueryTriggerInteraction)1) && ((Component)((RaycastHit)(ref val3)).collider).gameObject.isStatic && (((RaycastHit)(ref val3)).colliderInstanceID != ((Object)webbedCollider).GetInstanceID() || Vector3.Distance(((RaycastHit)(ref val3)).point, val) > 0.01f))
{
((Joint)webJoint).connectedBody = ((RaycastHit)(ref val3)).rigidbody;
webJoint.SetConnectedPoint(((RaycastHit)(ref val3)).point);
val = ((RaycastHit)(ref val3)).point;
}
}
webLine.UpdateLine(hand.palmPositionTransform.position, val);
val2 = val - anchorPoint;
float magnitude = ((Vector3)(ref val2)).magnitude;
if (magnitude < webLine_lowestLength)
{
webJoint.SetLinearLimit(magnitude, 1f);
webLine_lowestLength = magnitude;
}
if ((Object)webbedCollider == (Object)null || !((Component)webbedCollider).gameObject.activeInHierarchy)
{
DestroyWebJoint();
return;
}
Rigidbody attachedRigidbody = webbedCollider.attachedRigidbody;
float num = (((Object)Player.Avatar == (Object)null) ? 75f : Mathf.Max(Player.Avatar.massTotal, 1f));
bool flag = Prefs.enableTargetPulling.Value && (Object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic && attachedRigidbody.mass < num * 10f && !IsLocalPlayerBody(attachedRigidbody);
if (flag && TryAutoCatchTarget(attachedRigidbody))
{
return;
}
float minimumPullSpeed = (flag ? Prefs.targetPullGestureSpeedMin.Value : Prefs.webzipPullSpeedMin.Value);
if (IsYanking(out var intensity, minimumPullSpeed))
{
bool flag2 = false;
if (flag)
{
flag2 = PullTargetTowardPlayer(attachedRigidbody, intensity);
}
else if ((Object)attachedRigidbody == (Object)null || attachedRigidbody.isKinematic || attachedRigidbody.mass >= num * 10f)
{
float num2 = Prefs.WebzipImpulseSpeed * intensity;
Player.RigManager.physicsRig.torso.rbChest.AddForce(webLine.GetNormal() * num2, (ForceMode)2);
flag2 = true;
}
if (flag2)
{
hand.Controller.haptor.Haptic_Knock();
webzipCooldown.Set(1f);
}
}
if (!IsPlayerGesturing(HandGesture.GRIP))
{
DestroyWebJoint();
}
}
private bool IsYanking(out float intensity, float minimumPullSpeed)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Player.ControllerRig.vrRoot.rotation * ((((Component)hand.Controller).transform.localPosition - lastControllerPos) / Time.deltaTime);
lastControllerPos = ((Component)hand.Controller).transform.localPosition;
controllerVelocities[rollingAverageVelIndex] = val;
rollingAverageVelIndex = (rollingAverageVelIndex + 1) % 8;
intensity = 0f;
if ((bool)webzipCooldown)
{
return false;
}
Vector3 val2 = Vector3.zero;
Vector3[] array = controllerVelocities;
foreach (Vector3 val3 in array)
{
val2 += val3;
}
val2 /= (float)controllerVelocities.Length;
if (Vector3.Dot(-webLine.GetNormal(), ((Vector3)(ref val2)).normalized) >= 0.4f && ((Vector3)(ref val2)).sqrMagnitude >= minimumPullSpeed * minimumPullSpeed)
{
float num = Mathf.InverseLerp(minimumPullSpeed, minimumPullSpeed + 1f, ((Vector3)(ref val2)).magnitude);
intensity = 1f - Mathf.Pow(1f - Mathf.Clamp01(num), 3f);
return true;
}
return false;
}
private static bool IsLocalPlayerBody(Rigidbody body)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_002d: 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: Expected O, but got Unknown
//IL_004b: Expected O, but got Unknown
if ((Object)body == (Object)null || (Object)Player.RigManager == (Object)null)
{
return false;
}
return (Object)((Component)body).transform.root == (Object)((Component)Player.RigManager).transform.root;
}
private bool PullTargetTowardPlayer(Rigidbody targetBody, float intensity)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0034: 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_0044: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
Rigidbody rbChest = Player.RigManager.physicsRig.torso.rbChest;
if ((Object)rbChest == (Object)null || (Object)targetBody == (Object)null)
{
return false;
}
Vector3 val = rbChest.worldCenterOfMass - targetBody.worldCenterOfMass;
float magnitude = ((Vector3)(ref val)).magnitude;
if (magnitude <= 0.25f)
{
return false;
}
Vector3 val2 = val / magnitude;
float num = Mathf.Min(Prefs.TargetPullImpulseSpeed * intensity, magnitude * 2.5f);
float num2 = Vector3.Dot(targetBody.velocity, val2);
float num3 = Mathf.Clamp(num - num2, 0f, Prefs.TargetPullImpulseSpeed);
if (num3 <= 0.01f)
{
return false;
}
Vector3 val3 = val2 * num3;
targetBody.AddForce(val3, (ForceMode)2);
WebShooter.TargetPulled?.Invoke(this, targetBody, val3);
return true;
}
private bool TryAutoCatchTarget(Rigidbody targetBody)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if (!Prefs.enableTargetAutoCatch.Value || hand.HasAttachedObject() || (Object)Player.GetObjectInHand(hand) != (Object)null)
{
return false;
}
if (!TryFindAutoCatchGrip(targetBody, out var forcePullGrip, out var grip) || grip.HasAttachedHands())
{
return false;
}
Vector3 position = grip.GetForcePullTransform(hand).position;
if (Vector3.Distance(hand.palmPositionTransform.position, position) > Prefs.targetAutoCatchDistance.Value)
{
return false;
}
pendingAutoCatch = forcePullGrip;
pendingAutoCatchGrip = grip;
pendingAutoCatchFrame = Time.frameCount + 2;
DestroyWebJoint();
return true;
}
private void UpdatePendingAutoCatch()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
//IL_00a4: Expected O, but got Unknown
if (Time.frameCount < pendingAutoCatchFrame)
{
return;
}
ForcePullGrip val = pendingAutoCatch;
Grip val2 = pendingAutoCatchGrip;
pendingAutoCatch = null;
pendingAutoCatchGrip = null;
if (!((Object)val2 == (Object)null) && ((Component)val2).gameObject.activeInHierarchy && !val2.HasAttachedHands() && !hand.HasAttachedObject() && !((Object)Player.GetObjectInHand(hand) != (Object)null))
{
if ((Object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy && (Object)val._grip == (Object)val2)
{
val.Pull(hand);
}
else
{
val2.Snatch(hand, true);
}
hand.Controller.haptor.Haptic_Tap();
}
}
private static bool TryFindAutoCatchGrip(Rigidbody targetBody, out ForcePullGrip forcePullGrip, out Grip grip)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
forcePullGrip = null;
grip = null;
Gun val = ((Component)targetBody).GetComponentInParent<Gun>();
if ((Object)val == (Object)null)
{
val = ((Component)targetBody).GetComponentInChildren<Gun>();
}
if ((Object)val != (Object)null && (Object)val.triggerGrip != (Object)null)
{
grip = val.triggerGrip;
forcePullGrip = FindForcePullForGrip(((Component)val).transform.root, grip);
return true;
}
forcePullGrip = ((Component)targetBody).GetComponentInChildren<ForcePullGrip>();
if ((Object)forcePullGrip == (Object)null)
{
forcePullGrip = ((Component)targetBody).GetComponentInParent<ForcePullGrip>();
}
if ((Object)forcePullGrip == (Object)null || (Object)forcePullGrip._grip == (Object)null)
{
return false;
}
grip = forcePullGrip._grip;
return true;
}
private static ForcePullGrip FindForcePullForGrip(Transform searchRoot, Grip grip)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_002a: 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_003a: Expected O, but got Unknown
//IL_003a: Expected O, but got Unknown
foreach (ForcePullGrip componentsInChild in ((Component)searchRoot).GetComponentsInChildren<ForcePullGrip>(true))
{
if ((Object)componentsInChild != (Object)null && (Object)componentsInChild._grip == (Object)grip)
{
return componentsInChild;
}
}
return null;
}
private void HandleAiming()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_002b: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
if ((Object)Player.GetObjectInHand(hand) != (Object)null)
{
ToggleReticle(value: false);
return;
}
aimReticle.rotation = Quaternion.LookRotation(Player.Head.forward);
if (TryGetAimHit(out var hit))
{
aimReticle.position = ((RaycastHit)(ref hit)).point;
ToggleReticle(value: true);
if (CanShootWebLine())
{
CreateWebJoint(hit);
PlayAudio(Bundles.webLineAudioHigh, Bundles.webLineAudioLow);
hand.Controller.haptor.Haptic_Tap();
ToggleReticle(value: false);
}
}
else
{
ToggleReticle(value: false);
}
}
private bool TryGetAimHit(out RaycastHit hit)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: 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)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//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)
Vector3 position = ((Component)this).transform.position;
Vector3 forward = ((Component)this).transform.forward;
bool flag = Physics.SphereCast(position, 0.07f, forward, ref hit, 70f, ((LayerMask)(ref layerMask)).value, (QueryTriggerInteraction)1);
float num = (flag ? ((RaycastHit)(ref hit)).distance : 70f);
foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(position, forward, 70f))
{
RaycastHit current = item;
if (!((Object)((RaycastHit)(ref current)).collider == (Object)null) && !(((RaycastHit)(ref current)).distance >= num))
{
Transform root = ((Component)((RaycastHit)(ref current)).collider).transform.root;
if ((Object)root != (Object)null && ((Object)root).name.StartsWith("[RigManager (Networked)]", StringComparison.Ordinal))
{
hit = current;
num = ((RaycastHit)(ref current)).distance;
flag = true;
}
}
}
return flag;
}
private void ToggleReticle(bool value)
{
((Component)aimReticle).gameObject.SetActive(Prefs.enableAimReticle.Value && value);
}
private bool CheckDoubleTapWebline(bool currentState)
{
return CheckDoubleTap(ref weblineDoubleTap, ref weblineLastDoubleTapState, currentState);
}
private static bool CheckDoubleTap(ref BoolTimer timer, ref bool lastState, bool currentState)
{
bool result = false;
if (currentState && !lastState)
{
if ((bool)timer)
{
timer.Reset();
result = true;
}
else
{
timer.Set(0.3f, overwrite: true);
}
}
lastState = currentState;
return result;
}
private bool CanShootWebLine()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
if (!Prefs.enableWebSwinging.Value)
{
return false;
}
switch (Prefs.weblineInput.Value)
{
case WeblineInput.TOUCHPAD:
if (ControllerInfo.GetTouchpadTouch(hand.handedness))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
case WeblineInput.DOUBLE_TOUCHPAD:
if (CheckDoubleTapWebline(ControllerInfo.GetTouchpadTouch(hand.handedness)))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
case WeblineInput.DOUBLE_GESTURE:
return CheckDoubleTapWebline(IsPlayerGesturing(Prefs.selectedGesture.Value));
case WeblineInput.DOUBLE_TRIGGER:
if (CheckDoubleTap(ref triggerDoubleTap, ref triggerLastDoubleTapState, ControllerInfo.GetTrigger(hand.handedness) >= 0.75f))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
case WeblineInput.DOUBLE_TOUCH_BUTTONS:
if (CheckDoubleTapWebline(ControllerInfo.GetFaceButtonsTouch(hand.handedness)))
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
case WeblineInput.DOUBLE_GRIP:
return CheckDoubleTap(ref gripDoubleTap, ref gripLastDoubleTapState, ControllerInfo.GetGrip(hand.handedness) >= 0.75f);
case WeblineInput.DOUBLE_TRIGGER_OR_GRIP:
{
bool flag = CheckDoubleTap(ref triggerDoubleTap, ref triggerLastDoubleTapState, ControllerInfo.GetTrigger(hand.handedness) >= 0.75f);
if (!CheckDoubleTap(ref gripDoubleTap, ref gripLastDoubleTapState, ControllerInfo.GetGrip(hand.handedness) >= 0.75f))
{
if (flag)
{
return IsPlayerGesturing(Prefs.selectedGesture.Value);
}
return false;
}
return true;
}
case WeblineInput.DISABLED:
return false;
default:
return false;
}
}
private bool CanShootWebShot()
{
if (!IsWebAttatched() && IsPlayerGesturing(Prefs.selectedGesture.Value))
{
if (!hand.Controller.GetBButtonDown())
{
if (hand.Controller.GetBButtonUp())
{
return isWebShotBtnPressMomentary;
}
return false;
}
isWebShotBtnPressMomentary.Set(0.2f);
}
return false;
}
private bool IsPlayerGesturing(HandGesture gesture)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
if ((Object)Player.GetObjectInHand(hand) != (Object)null || hand.Skeleton.IsSnatching())
{
return false;
}
BaseController controller = hand.Controller;
switch (gesture)
{
case HandGesture.SPIDEY:
if (controller.GetIndexCurlAxis() <= 0.3f && controller.GetMiddleCurlAxis() >= 0.7f && controller.GetRingCurlAxis() >= 0.7f)
{
return controller.GetPinkyCurlAxis() <= 0.3f;
}
return false;
case HandGesture.GRIP:
return controller.GetIndexCurlAxis() + controller.GetMiddleCurlAxis() + controller.GetRingCurlAxis() + controller.GetPinkyCurlAxis() >= 1.4f;
default:
return false;
}
}
private bool IsWebAttatched()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
return (Object)webJoint != (Object)null;
}
private void CreateWebJoint(RaycastHit hit)
{
//IL_002f: 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_00fe: 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_011a: Unknown result type (might be due to invalid IL or missing references)
webJoint = ((Component)this).gameObject.AddComponent<ConfigurableJoint>();
((Joint)webJoint).connectedBody = ((RaycastHit)(ref hit)).rigidbody;
webJoint.SetAnchorPoint(((Component)this).transform.position);
webJoint.SetConnectedPoint(((RaycastHit)(ref hit)).point);
webJoint.SetLinearMotion((ConfigurableJointMotion)1);
webJoint.SetLinearLimit(((RaycastHit)(ref hit)).distance + 0.075f, 1f);
webLine_lowestLength = ((RaycastHit)(ref hit)).distance;
webJoint.SetSpringLimit(1372344f / (float)Math.E, 50485.715f);
webJoint.SetSpringDrive(0f, 0f, 0f);
((Joint)webJoint).breakForce = WEB_BREAK_FORCE;
((Joint)webJoint).enableCollision = true;
webbedCollider = ((RaycastHit)(ref hit)).collider;
webActive = true;
webLine.SetActive(value: true);
webLine.UpdateLine(hand.palmPositionTransform.position, ((RaycastHit)(ref hit)).point);
WebShooter.WebCreated?.Invoke(this, hit);
}
private void DestroyWebJoint()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
if (webActive)
{
webActive = false;
ConfigurableJoint val = webJoint;
webJoint = null;
webbedCollider = null;
WebShooter.WebDestroyed?.Invoke(this);
webLine.SetActive(value: false);
if ((Object)val != (Object)null)
{
Object.Destroy((Object)val);
}
}
}
private void PlayAudio(AudioClip high, AudioClip low)
{
AudioClip val = ((Random.value > 0.5f) ? high : low);
float num = 0.5f * (DataManager.ActiveSave.PlayerSettings.VolumeSFX / 10f);
audioSource.loop = false;
audioSource.PlayOneShot(val, num);
}
}
}